fix for full name in user ws service. Minor fix in group ws service when gateways are retrieved
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@141622 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d3005a099c
commit
3d764d1fd5
|
@ -652,7 +652,6 @@ public class LiferayWSGroupManager implements GroupManager {
|
||||||
|
|
||||||
// real gateways have no children as well
|
// real gateways have no children as well
|
||||||
for (int i = 0; i < idsCandidateGateways.size(); i++) {
|
for (int i = 0; i < idsCandidateGateways.size(); i++) {
|
||||||
List<String> children = getChildren(idsCandidateGateways.get(i));
|
|
||||||
String friendlyUrl = (String) ((JSONObject)candidateGateways.get(i)).get("friendlyURL");
|
String friendlyUrl = (String) ((JSONObject)candidateGateways.get(i)).get("friendlyURL");
|
||||||
|
|
||||||
// check if it is not a group created by Liferay
|
// check if it is not a group created by Liferay
|
||||||
|
@ -661,6 +660,7 @@ public class LiferayWSGroupManager implements GroupManager {
|
||||||
if(defaultGroup)
|
if(defaultGroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
List<String> children = getChildren(idsCandidateGateways.get(i));
|
||||||
if(children == null || children.isEmpty())
|
if(children == null || children.isEmpty())
|
||||||
gateways.add(mapLRGroup(((JSONObject)candidateGateways.get(i)).toJSONString()));
|
gateways.add(mapLRGroup(((JSONObject)candidateGateways.get(i)).toJSONString()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class LiferayWSUserManager implements UserManager{
|
||||||
private static final String GET_USER_BY_USERNAME = "/user/get-user-by-screen-name/company-id/$COMPANY_ID/screen-name/$USER_ID";
|
private static final String GET_USER_BY_USERNAME = "/user/get-user-by-screen-name/company-id/$COMPANY_ID/screen-name/$USER_ID";
|
||||||
private static final String GET_USERS_BY_GROUP = "/user/get-group-users/group-id/$GROUP_ID";
|
private static final String GET_USERS_BY_GROUP = "/user/get-group-users/group-id/$GROUP_ID";
|
||||||
private static final String GET_USER_CUSTOM_FIELD_BY_KEY = "/expandovalue/get-json-data/company-id/$COMPANY_ID/class-name/com.liferay.portal.model.User/table-name/CUSTOM_FIELDS/column-name/$CUSTOM_FIELD_KEY/class-pk/$USER_ID";
|
private static final String GET_USER_CUSTOM_FIELD_BY_KEY = "/expandovalue/get-json-data/company-id/$COMPANY_ID/class-name/com.liferay.portal.model.User/table-name/CUSTOM_FIELDS/column-name/$CUSTOM_FIELD_KEY/class-pk/$USER_ID";
|
||||||
|
//private static final String UPDATE_USER_CUSTOM_FIELD_BY_KEY = "/expandovalue/add-value/company-id/$COMPANY_ID/class-name/com.liferay.portal.model.User/table-name/CUSTOM_FIELDS/column-name/$CUSTOM_FIELD_KEY/class-pk/$USER_ID/data/$VALUE";
|
||||||
private static final String GET_CONTACT_BY_USER_ID = "/contact/get-contact/contact-id/$CONTACT_ID";
|
private static final String GET_CONTACT_BY_USER_ID = "/contact/get-contact/contact-id/$CONTACT_ID";
|
||||||
|
|
||||||
// logger
|
// logger
|
||||||
|
@ -148,6 +149,7 @@ public class LiferayWSUserManager implements UserManager{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps the JSON user to the GCubeUser.class object
|
* Maps the JSON user to the GCubeUser.class object
|
||||||
* @param json
|
* @param json
|
||||||
|
@ -185,7 +187,7 @@ public class LiferayWSUserManager implements UserManager{
|
||||||
(String)userJSON.get("firstName"),
|
(String)userJSON.get("firstName"),
|
||||||
(String)userJSON.get("middleName"),
|
(String)userJSON.get("middleName"),
|
||||||
(String)userJSON.get("lastName"),
|
(String)userJSON.get("lastName"),
|
||||||
(String)userJSON.get("fullName"),
|
buildFullName(userJSON),
|
||||||
(long)userJSON.get("createDate"),
|
(long)userJSON.get("createDate"),
|
||||||
null, // skip for now TODO getUserAvatarAbsoluteURL(u)
|
null, // skip for now TODO getUserAvatarAbsoluteURL(u)
|
||||||
(boolean)contactJSON.get("male"),
|
(boolean)contactJSON.get("male"),
|
||||||
|
@ -199,6 +201,23 @@ public class LiferayWSUserManager implements UserManager{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From the json representing the user builds the fullname (which is missing, so firstname, lastname and middlename will be used)
|
||||||
|
* @param userJSON
|
||||||
|
* @return String representing the fullname
|
||||||
|
*/
|
||||||
|
private String buildFullName(JSONObject userJSON) {
|
||||||
|
String first = (String)userJSON.get("firstName");
|
||||||
|
String middle = (String)userJSON.get("middleName");
|
||||||
|
String last = (String)userJSON.get("lastName");
|
||||||
|
String fullname =
|
||||||
|
(first == null | first.isEmpty() ? "" : first + " ") +
|
||||||
|
(middle == null | middle.isEmpty() ? "" : middle + " ") +
|
||||||
|
(last == null | last.isEmpty() ? "" : last + " ");
|
||||||
|
logger.info("Built fullname is " + fullname);
|
||||||
|
return fullname;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given the contactId value, retrieves the json object releted to this information
|
* Given the contactId value, retrieves the json object releted to this information
|
||||||
* @param contactId
|
* @param contactId
|
||||||
|
@ -555,7 +574,6 @@ public class LiferayWSUserManager implements UserManager{
|
||||||
public void saveCustomAttr(long userId, String attributeKey,
|
public void saveCustomAttr(long userId, String attributeKey,
|
||||||
Serializable value) throws UserRetrievalFault {
|
Serializable value) throws UserRetrievalFault {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemExcep
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.ws.LiferayWSUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.ws.LiferayWSUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
import org.junit.Before;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,13 +20,13 @@ public class LiferayWSUserTest{
|
||||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(LiferayWSUserTest.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(LiferayWSUserTest.class);
|
||||||
|
|
||||||
private UserManager userManager = null;
|
private UserManager userManager = null;
|
||||||
private String user = "";
|
private String user = "jsonws.user@d4science.org";
|
||||||
private String password = ""; // Put a valid password here
|
private String password = "gcuberandom321"; // Put a valid password here
|
||||||
private String host = "";
|
private String host = "dev2.d4science.org";
|
||||||
private String schema = "";
|
private String schema = "https";
|
||||||
private int port = -1;
|
private int port = 443;
|
||||||
|
|
||||||
//@Before
|
@Before
|
||||||
public void init() throws Exception{
|
public void init() throws Exception{
|
||||||
|
|
||||||
logger.info("Init method, building LiferayWSUserManager");
|
logger.info("Init method, building LiferayWSUserManager");
|
||||||
|
|
Loading…
Reference in New Issue