From faadd09aaf8bd6ddc5ac747001100ea8ef6743fc Mon Sep 17 00:00:00 2001 From: Laramie Crocker Date: Wed, 23 Feb 2011 18:48:17 +0000 Subject: [PATCH] CSPACE-3178 --- .../person/nuxeo/PersonValidatorHandler.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java index 78eee7972..b32293873 100644 --- a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java +++ b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java @@ -51,6 +51,7 @@ package org.collectionspace.services.person.nuxeo; import java.util.regex.Pattern; +import org.collectionspace.services.common.Tools; import org.collectionspace.services.person.PersonsCommon; import org.collectionspace.services.common.context.MultipartServiceContext; import org.collectionspace.services.common.context.ServiceContext; @@ -80,15 +81,22 @@ public class PersonValidatorHandler implements ValidatorHandler { PersonsCommon person = (PersonsCommon) mctx.getInputPart(mctx.getCommonPartLabel(), PersonsCommon.class); String msg = ""; + String displayName = person.getDisplayName(); boolean invalid = false; - if(!person.isDisplayNameComputed() && (person.getDisplayName()==null)) { + if(!person.isDisplayNameComputed() && (displayName==null)) { invalid = true; msg += "displayName must be non-null if displayNameComputed is false!"; } - String shortId = person.getShortIdentifier(); + String shortId = person.getShortIdentifier(); + if(shortId==null){ - invalid = true; - msg += "shortIdentifier must be non-null"; + if (Tools.notEmpty(displayName)){ //TODO: && action == CREATE ...... + //CSPACE-3178 OK to have null shortIdentifier if displayName set, because we will compute the shortIdentifier before storing. + invalid = false; + } else { + invalid = true; + msg += "shortIdentifier must be non-null"; + } } else if(shortIdBadPattern.matcher(shortId).find()) { invalid = true; msg += "shortIdentifier must only contain standard word characters"; -- 2.47.3