]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5137,CSPACE-5167: On create and update requests, service validator handlers...
authorAron Roberts <aron@socrates.berkeley.edu>
Tue, 15 May 2012 22:37:10 +0000 (15:37 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Tue, 15 May 2012 22:37:10 +0000 (15:37 -0700)
services/concept/service/src/main/java/org/collectionspace/services/concept/nuxeo/ConceptValidatorHandler.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationValidatorHandler.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationValidatorHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java
services/place/service/src/main/java/org/collectionspace/services/place/nuxeo/PlaceValidatorHandler.java
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonValidatorHandler.java

index 12a758aac0807fdfd31ea67f16e843685be7af52..100c4cdd63b1965282f65984df6cf338cc039335 100644 (file)
@@ -45,15 +45,15 @@ public class ConceptValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(ConceptValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+            "The record payload was invalid. See log file for more details.";
     private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
     private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_ERROR =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -72,7 +72,7 @@ public class ConceptValidatorHandler extends ValidatorHandlerImpl {
                     CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
                 CS_ASSERT(containsAtLeastOneTerm(concept), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(concept), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(concept), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -100,7 +100,7 @@ public class ConceptValidatorHandler extends ValidatorHandlerImpl {
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
                 CS_ASSERT(containsAtLeastOneTerm(concept), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(concept), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(concept), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -134,11 +134,11 @@ public class ConceptValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(ConceptsCommon concept) {
+    private boolean allTermsContainDisplayName(ConceptsCommon concept) {
         ConceptTermGroupList termGroupList = concept.getConceptTermGroupList();
         List<ConceptTermGroup> termGroups = termGroupList.getConceptTermGroup();
         for (ConceptTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }
index fd72db9ab775e73002b372a33206b4b69744528d..d2dc263aefee60baf920ba956bdb700a31dd63a6 100644 (file)
@@ -45,15 +45,15 @@ public class LocationValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(LocationValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+               "The record payload was invalid. See log file for more details.";
     private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
     private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_ERROR =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -72,7 +72,7 @@ public class LocationValidatorHandler extends ValidatorHandlerImpl {
                     CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
                 CS_ASSERT(containsAtLeastOneTerm(location), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(location), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(location), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -100,7 +100,7 @@ public class LocationValidatorHandler extends ValidatorHandlerImpl {
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
                 CS_ASSERT(containsAtLeastOneTerm(location), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(location), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(location), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -134,11 +134,11 @@ public class LocationValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(LocationsCommon person) {
+    private boolean allTermsContainDisplayName(LocationsCommon person) {
         LocTermGroupList termGroupList = person.getLocTermGroupList();
         List<LocTermGroup> termGroups = termGroupList.getLocTermGroup();
         for (LocTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }
index a48aa48996139118ef927b61cda9d7fceb31ba4b..26ae057cf930f2ad568b8d5d1439ee02436e0a9b 100644 (file)
@@ -45,15 +45,15 @@ public class OrganizationValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(OrganizationValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+            "The record payload was invalid. See log file for more details.";
     private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
     private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_ERROR =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -72,7 +72,7 @@ public class OrganizationValidatorHandler extends ValidatorHandlerImpl {
                     CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
                 CS_ASSERT(containsAtLeastOneTerm(organization), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(organization), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(organization), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -100,7 +100,7 @@ public class OrganizationValidatorHandler extends ValidatorHandlerImpl {
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
                 CS_ASSERT(containsAtLeastOneTerm(organization), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(organization), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(organization), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -134,11 +134,11 @@ public class OrganizationValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(OrganizationsCommon organization) {
+    private boolean allTermsContainDisplayName(OrganizationsCommon organization) {
         OrgTermGroupList termGroupList = organization.getOrgTermGroupList();
         List<OrgTermGroup> termGroups = termGroupList.getOrgTermGroup();
         for (OrgTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }
index bca6a4fdf7bbb97d293d1a5e96f180a3256b639b..6c80dbe046ceedfe680356382152794d8a8e3c7a 100644 (file)
@@ -44,15 +44,15 @@ public class PersonValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(PersonValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
-    private static final String SHORT_ID_BAD_CHARS_MSG =
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+            "The record payload was invalid. See log file for more details.";
+    private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
-    private static final String HAS_NO_TERMS_MSG =
+    private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_MSG =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -68,10 +68,10 @@ public class PersonValidatorHandler extends ValidatorHandlerImpl {
             try {
                 String shortId = person.getShortIdentifier();
                 if (shortId != null) {
-                    CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_MSG);
+                    CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
-                CS_ASSERT(containsAtLeastOneTerm(person), HAS_NO_TERMS_MSG);
-                CS_ASSERT(allTermsContainNameOrDisplayName(person), HAS_AN_EMPTY_TERM_MSG);
+                CS_ASSERT(containsAtLeastOneTerm(person), HAS_NO_TERMS_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(person), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -98,8 +98,8 @@ public class PersonValidatorHandler extends ValidatorHandlerImpl {
                 // shortIdentifier is among a set of fields that are
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
-                CS_ASSERT(containsAtLeastOneTerm(person), HAS_NO_TERMS_MSG);
-                CS_ASSERT(allTermsContainNameOrDisplayName(person), HAS_AN_EMPTY_TERM_MSG);
+                CS_ASSERT(containsAtLeastOneTerm(person), HAS_NO_TERMS_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(person), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -133,11 +133,11 @@ public class PersonValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(PersonsCommon person) {
+    private boolean allTermsContainDisplayName(PersonsCommon person) {
         PersonTermGroupList termGroupList = person.getPersonTermGroupList();
         List<PersonTermGroup> termGroups = termGroupList.getPersonTermGroup();
         for (PersonTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }
index 9b330b5e36f2985b7e48cdd58b5ad250b778d81f..e8401602b9320c01cec18cb98d38a1ca36dafce8 100644 (file)
@@ -46,15 +46,15 @@ public class PlaceValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(PlaceValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+            "The record payload was invalid. See log file for more details.";
     private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
     private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_ERROR =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -73,7 +73,7 @@ public class PlaceValidatorHandler extends ValidatorHandlerImpl {
                     CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
                 CS_ASSERT(containsAtLeastOneTerm(place), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(place), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(place), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -101,7 +101,7 @@ public class PlaceValidatorHandler extends ValidatorHandlerImpl {
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
                 CS_ASSERT(containsAtLeastOneTerm(place), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(place), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(place), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -135,11 +135,11 @@ public class PlaceValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(PlacesCommon place) {
+    private boolean allTermsContainDisplayName(PlacesCommon place) {
         PlaceTermGroupList termGroupList = place.getPlaceTermGroupList();
         List<PlaceTermGroup> termGroups = termGroupList.getPlaceTermGroup();
         for (PlaceTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }
index 7d455a36c3e84eaf95eb361f848703579924476e..2849df8f9716c5694bc6310d2556fedb6f22f260 100644 (file)
@@ -45,15 +45,15 @@ public class TaxonValidatorHandler extends ValidatorHandlerImpl {
 
     final Logger logger = LoggerFactory.getLogger(TaxonValidatorHandler.class);
     // 'Bad pattern' for shortIdentifiers matches any non-word characters
-    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]"); //.matcher(input).matches()
-    private static final String VALIDATION_ERROR = "The record payload was invalid. See log file for more details.";
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String VALIDATION_ERROR =
+            "The record payload was invalid. See log file for more details.";
     private static final String SHORT_ID_BAD_CHARS_ERROR =
             "shortIdentifier must only contain standard word characters";
     private static final String HAS_NO_TERMS_ERROR =
             "Authority items must contain at least one term.";
-    private static final String HAS_AN_EMPTY_TERM_ERROR =
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
             "Each term group in an authority item must contain "
-            + "a non-empty term name or "
             + "a non-empty term display name.";
 
     @Override
@@ -72,7 +72,7 @@ public class TaxonValidatorHandler extends ValidatorHandlerImpl {
                     CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
                 }
                 CS_ASSERT(containsAtLeastOneTerm(organization), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(organization), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(organization), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -100,7 +100,7 @@ public class TaxonValidatorHandler extends ValidatorHandlerImpl {
                 // prevented from being changed on an update, and thus
                 // we don't need to check its value here.
                 CS_ASSERT(containsAtLeastOneTerm(organization), HAS_NO_TERMS_ERROR);
-                CS_ASSERT(allTermsContainNameOrDisplayName(organization), HAS_AN_EMPTY_TERM_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(organization), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
             } catch (AssertionError e) {
                 if (logger.isErrorEnabled()) {
                     logger.error(e.getMessage(), e);
@@ -134,11 +134,11 @@ public class TaxonValidatorHandler extends ValidatorHandlerImpl {
         return true;
     }
 
-    private boolean allTermsContainNameOrDisplayName(TaxonCommon organization) {
+    private boolean allTermsContainDisplayName(TaxonCommon organization) {
         TaxonTermGroupList termGroupList = organization.getTaxonTermGroupList();
         List<TaxonTermGroup> termGroups = termGroupList.getTaxonTermGroup();
         for (TaxonTermGroup termGroup : termGroups) {
-            if (Tools.isBlank(termGroup.getTermName()) && Tools.isBlank(termGroup.getTermDisplayName())) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
                 return false;
             }
         }