updated to user full names

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/vre-definition@82388 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-10-03 14:49:45 +00:00
parent 6595ab7d3b
commit fbcf5d3ed6
1 changed files with 22 additions and 10 deletions

View File

@ -271,8 +271,9 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
return getFakeBelongingUsers(); return getFakeBelongingUsers();
} }
else { else {
UserManager um = null;
try { try {
UserManager um = new LiferayUserManager(); um = new LiferayUserManager();
long currOrgid = getASLSession().getGroupId(); long currOrgid = getASLSession().getGroupId();
RoleManager rm = new LiferayRoleManager(); RoleManager rm = new LiferayRoleManager();
@ -301,7 +302,7 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
try { try {
ArrayList<String> managers = new ArrayList<String>(); ArrayList<String> managers = new ArrayList<String>();
for (int i = 0; i < belongingUsers.size(); i++) { for (int i = 0; i < belongingUsers.size(); i++) {
managers.add(belongingUsers.get(i).getScreenName()); managers.add(belongingUsers.get(i).getFullname()+" ("+belongingUsers.get(i).getScreenName()+")");
} }
toReturn.put("Manager", managers); toReturn.put("Manager", managers);
@ -312,10 +313,12 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
" There must be at least one."); " There must be at least one.");
} }
toReturn.put("Designer", username);
try { try {
String fullName = um.getUserByScreenName(username).getFullname();
toReturn.put("Designer", fullName+" ("+username+")");
VREDescriptionBean vre = getVREInSession(); VREDescriptionBean vre = getVREInSession();
if(vre!= null) { if(vre!= null) {
toReturn.put("vreName",vre.getName()); toReturn.put("vreName",vre.getName());
@ -326,7 +329,7 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
toReturn.put("vreEndTime",vre.getEndTime()); toReturn.put("vreEndTime",vre.getEndTime());
} }
} catch (Exception e){ } catch (Exception e){
e.printStackTrace();
} }
} }
@ -339,12 +342,12 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
ArrayList<String> managers = new ArrayList<String>(); ArrayList<String> managers = new ArrayList<String>();
managers.add("antonio.gioia"); managers.add("Pasquale Pagano (pasquale.pagano)");
managers.add("andrea.manzi"); managers.add("Andrea Manzi (andrea.manzi)");
managers.add("massimiliano.assante"); managers.add("Massimiliano Assante (massimiliano.assante)");
ret.put("Manager",managers); ret.put("Manager",managers);
ret.put("Designer", "antonio.gioia"); ret.put("Designer", "Leanoardo Candela (leonardo.candela)");
try { try {
VREDescriptionBean vre = getVREInSession(); VREDescriptionBean vre = getVREInSession();
if(vre!= null) { if(vre!= null) {
@ -362,9 +365,18 @@ public class VREDefinitionServiceImpl extends RemoteServiceServlet implements VR
return ret; return ret;
} }
private String extractUserName(String toExtract) {
int openBracket = toExtract.indexOf("(")+1;
int closeBracket = toExtract.indexOf(")");
return toExtract.substring(openBracket, closeBracket);
}
public String setVRE(VREDescriptionBean bean, String[] functionalityIDs, HashMap<String, List<ExternalResourceModel>> funcToExternalResources) public String setVRE(VREDescriptionBean bean, String[] functionalityIDs, HashMap<String, List<ExternalResourceModel>> funcToExternalResources)
throws VREDefinitionException { throws VREDefinitionException {
bean.setDesigner(extractUserName(bean.getDesigner()));
bean.setManager(extractUserName(bean.getManager()));
setVREDescription(bean); setVREDescription(bean);
setFunctionality(functionalityIDs, funcToExternalResources); setFunctionality(functionalityIDs, funcToExternalResources);
try { try {