REPO-1646: V1 REST API - cannot unset optional fields (eg. when updating person / site details ...)

- part 2 (Update Person)
- REPO-1268, REPO-893

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133293 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2016-11-30 13:33:55 +00:00
parent c6a643ae99
commit 78a7208ad7
7 changed files with 384 additions and 128 deletions

View File

@@ -486,8 +486,15 @@ public class PeopleImpl implements People
@Override
public Void doWork() throws Exception
{
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_PERSONDESC, true);
writer.putContent(description);
if (description != null)
{
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_PERSONDESC, true);
writer.putContent(description);
}
else
{
nodeService.setProperty(nodeRef, ContentModel.PROP_PERSONDESC, null);
}
return null;
}
});
@@ -566,7 +573,7 @@ public class PeopleImpl implements People
}
NodeRef personNodeRef = personService.getPerson(personIdToUpdate, false);
if (person.getDescription() != null)
if (person.wasSet(Person.PROP_PERSON_DESCRIPTION))
{
// Remove person description from saved properties
properties.remove(ContentModel.PROP_PERSONDESC);