mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.0 (5.2.0) to HEAD (5.2)
132993 mward: Merged mward/5.2.n-optionalcustomprops (5.2.1) to 5.2.N (5.2.1) 132978 mward: REPO-1395: make aspectNames, properties optional 'includes' when listing people git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@133372 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,7 +34,8 @@ import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||
public interface People
|
||||
{
|
||||
String DEFAULT_USER = "-me-";
|
||||
|
||||
String PARAM_INCLUDE_ASPECTNAMES = "aspectNames";
|
||||
String PARAM_INCLUDE_PROPERTIES = "properties";
|
||||
String PARAM_FIRST_NAME = "firstName";
|
||||
String PARAM_LAST_NAME = "lastName";
|
||||
String PARAM_ID = "id";
|
||||
|
@@ -297,7 +297,10 @@ public class PeopleImpl implements People
|
||||
public Person getPerson(String personId)
|
||||
{
|
||||
personId = validatePerson(personId);
|
||||
Person person = getPersonWithProperties(personId);
|
||||
List<String> include = Arrays.asList(
|
||||
PARAM_INCLUDE_ASPECTNAMES,
|
||||
PARAM_INCLUDE_PROPERTIES);
|
||||
Person person = getPersonWithProperties(personId, include);
|
||||
|
||||
return person;
|
||||
}
|
||||
@@ -322,7 +325,7 @@ public class PeopleImpl implements People
|
||||
public Person get(int index)
|
||||
{
|
||||
PersonService.PersonInfo personInfo = page.get(index);
|
||||
Person person = getPersonWithProperties(personInfo.getUserName());
|
||||
Person person = getPersonWithProperties(personInfo.getUserName(), parameters.getInclude());
|
||||
return person;
|
||||
}
|
||||
|
||||
@@ -360,7 +363,7 @@ public class PeopleImpl implements People
|
||||
return sortProps;
|
||||
}
|
||||
|
||||
private Person getPersonWithProperties(String personId)
|
||||
private Person getPersonWithProperties(String personId, List<String> include)
|
||||
{
|
||||
Person person = null;
|
||||
NodeRef personNode = personService.getPerson(personId, false);
|
||||
@@ -384,12 +387,18 @@ public class PeopleImpl implements People
|
||||
nodeProps.remove(Person.PROP_PERSON_DESCRIPTION);
|
||||
|
||||
// Expose properties
|
||||
Map<String, Object> custProps = new HashMap<>();
|
||||
custProps.putAll(nodes.mapFromNodeProperties(nodeProps, new ArrayList<>(), new HashMap<>(), EXCLUDED_PROPS));
|
||||
person.setProperties(custProps);
|
||||
// Expose aspect names
|
||||
Set<QName> aspects = nodeService.getAspects(personNode);
|
||||
person.setAspectNames(nodes.mapFromNodeAspects(aspects, EXCLUDED_ASPECTS));
|
||||
if (include.contains(PARAM_INCLUDE_PROPERTIES))
|
||||
{
|
||||
Map<String, Object> custProps = new HashMap<>();
|
||||
custProps.putAll(nodes.mapFromNodeProperties(nodeProps, new ArrayList<>(), new HashMap<>(), EXCLUDED_PROPS));
|
||||
person.setProperties(custProps);
|
||||
}
|
||||
if (include.contains(PARAM_INCLUDE_ASPECTNAMES))
|
||||
{
|
||||
// Expose aspect names
|
||||
Set<QName> aspects = nodeService.getAspects(personNode);
|
||||
person.setAspectNames(nodes.mapFromNodeAspects(aspects, EXCLUDED_ASPECTS));
|
||||
}
|
||||
|
||||
// get avatar information
|
||||
if (hasAvatar(personNode))
|
||||
|
Reference in New Issue
Block a user