]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-1257: UCB ContactValidatorHandler Contrib (#382)
authorMichael Ritter <mikejritter@users.noreply.github.com>
Thu, 14 Dec 2023 01:18:01 +0000 (20:18 -0500)
committerGitHub <noreply@github.com>
Thu, 14 Dec 2023 01:18:01 +0000 (20:18 -0500)
Co-authored-by: Richard Millet <richard.millet@berkeley.edu>
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml
services/contact/service/src/main/java/org/collectionspace/services/contact/nuxeo/ContactValidatorHandler.java [new file with mode: 0644]

index 3a271d6876e8329b761a0342afb6bb1c0924cdaa..b38b4dc1b0e1207b7f9a0f78a7d03f42283d9c92 100644 (file)
                        <service:repositoryDomain xmlns:service="http://collectionspace.org/services/config/service">default-domain</service:repositoryDomain>
                        <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler
                        </service:documentHandler>
+                       <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.contact.nuxeo.ContactValidatorHandler
+                       </service:validatorHandler>
                        <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
                                <service:params>
                                        <service:ListResultsFields>
diff --git a/services/contact/service/src/main/java/org/collectionspace/services/contact/nuxeo/ContactValidatorHandler.java b/services/contact/service/src/main/java/org/collectionspace/services/contact/nuxeo/ContactValidatorHandler.java
new file mode 100644 (file)
index 0000000..6ebbbfb
--- /dev/null
@@ -0,0 +1,55 @@
+package org.collectionspace.services.contact.nuxeo;
+
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandlerImpl;
+import org.collectionspace.services.contact.ContactsCommon;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ContactValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn, PoxPayloadOut> {
+
+    private static final Logger logger = LoggerFactory.getLogger(ContactValidatorHandler.class);
+
+    // Error strings
+    private static final String VALIDATION_ERROR =
+        "The contact record payload was invalid. See log file for more details.";
+
+    @Override
+    protected Class<?> getCommonPartClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    protected void handleCreate() throws InvalidDocumentException {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    protected void handleGet() throws InvalidDocumentException {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    protected void handleGetAll() throws InvalidDocumentException {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    protected void handleUpdate() throws InvalidDocumentException {
+        try {
+            ContactsCommon contactsCommon = (ContactsCommon) getCommonPart();
+        } catch (AssertionError e) {
+            logger.error("Exception validating ContactsCommon", e);
+            throw new InvalidDocumentException(VALIDATION_ERROR, e);
+        }
+    }
+
+    @Override
+    protected void handleDelete() throws InvalidDocumentException {
+        // TODO Auto-generated method stub
+    }
+
+}