mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
131886 mward: REPO-892: ensure presence of mandatory fields git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132312 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -286,10 +286,7 @@ public class PeopleImpl implements People
|
||||
@Override
|
||||
public Person create(PersonUpdate person)
|
||||
{
|
||||
if (person.getUserName() == null)
|
||||
{
|
||||
throw new InvalidArgumentException("Field 'id' is null, but is required.");
|
||||
}
|
||||
validateCreatePersonData(person);
|
||||
|
||||
// TODO: check, is this transaction safe?
|
||||
// Unfortunately PersonService.createPerson(...) only throws an AlfrescoRuntimeException
|
||||
@@ -311,6 +308,22 @@ public class PeopleImpl implements People
|
||||
// return getPerson(person.getUserName());
|
||||
}
|
||||
|
||||
private void validateCreatePersonData(PersonUpdate person)
|
||||
{
|
||||
checkRequiredField("id", person.getUserName());
|
||||
checkRequiredField("firstName", person.getFirstName());
|
||||
checkRequiredField("email", person.getEmail());
|
||||
checkRequiredField("enabled", person.isEnabled());
|
||||
}
|
||||
|
||||
private void checkRequiredField(String fieldName, Object fieldValue)
|
||||
{
|
||||
if (fieldValue == null)
|
||||
{
|
||||
throw new InvalidArgumentException("Field '"+fieldName+"' is null, but is required.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
public Person updatePerson(String personId, final Person person)
|
||||
|
Reference in New Issue
Block a user