From: Laramie Crocker Date: Wed, 23 Feb 2011 18:48:17 +0000 (+0000) Subject: CSPACE-3178 X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=faadd09aaf8bd6ddc5ac747001100ea8ef6743fc;p=tmp%2Fjakarta-migration.git CSPACE-3178 --- 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";