]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-114: Fixed some compile issues that mistakenly made it into the last commit.
authorremillet <remillet@yahoo.com>
Thu, 25 Jan 2018 09:01:47 +0000 (01:01 -0800)
committerremillet <remillet@yahoo.com>
Thu, 25 Jan 2018 09:01:47 +0000 (01:01 -0800)
3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java
3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateRelationsOnDelete.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java

index 78570530c5b266a5ff38db9a2707e49905b8655a..83ee4558162bd264ddd4853327ebd056333a0b5b 100644 (file)
@@ -12,6 +12,7 @@ import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants;
 import org.collectionspace.services.common.api.Tools;
+import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.relation.nuxeo.RelationConstants;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.movement.nuxeo.MovementConstants;
@@ -19,7 +20,7 @@ import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
 import org.collectionspace.services.nuxeo.listener.AbstractCSEventListenerImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-
+import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
@@ -299,9 +300,10 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      * @throws ClientException
      * @return the CSIDs of the CollectionObject records, if any, which are
      * related to the Movement record.
+     * @throws DocumentException 
      */
     private Set<String> getCollectionObjectCsidsRelatedToMovement(String movementCsid,
-            CoreSessionInterface coreSession) {
+            CoreSessionInterface coreSession) throws ClientException {
 
         Set<String> csids = new HashSet<>();
 
@@ -326,7 +328,13 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
                 + ACTIVE_DOCUMENT_WHERE_CLAUSE_FRAGMENT,
                 RELATION_DOCTYPE, RELATIONS_COMMON_SCHEMA, movementCsid, COLLECTIONOBJECT_DOCTYPE);
         
-        DocumentModelList relationDocModels = coreSession.query(query);
+        DocumentModelList relationDocModels = null;
+               try {
+                       relationDocModels = coreSession.query(query);
+               } catch (DocumentException e) {
+                       logger.error(e);
+               }
+               
         if (relationDocModels == null || relationDocModels.isEmpty()) {
             return csids;
         }
@@ -491,10 +499,11 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      * @throws ClientException
      * @return the most recent Movement record related to the CollectionObject
      * identified by the supplied CSID.
+     * @throws DocumentException 
      */
     protected String getMostRecentLocation(Event event,
                CoreSessionInterface session, String collectionObjectCsid,
-            boolean isAboutToBeRemovedEvent, String eventMovementCsid) {
+            boolean isAboutToBeRemovedEvent, String eventMovementCsid) throws ClientException {
        //
        // Assume we can determine the most recent location by creating an indeterminate result
        //
@@ -516,7 +525,14 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
                 RELATION_DOCTYPE, RELATIONS_COMMON_SCHEMA, collectionObjectCsid, MOVEMENT_DOCTYPE);
         logger.trace("query=" + query);
 
-        DocumentModelList relationDocModels = session.query(query);
+        DocumentModelList relationDocModels;
+               try {
+                       relationDocModels = session.query(query);
+               } catch (DocumentException e) {
+                       logger.error(e);
+                       return null;
+               }
+               
        if (isCreatingNewRelationship(event) == true) {
                DocumentModel newRelation = ((DocumentEventContext)event.getContext()).getSourceDocument();
                relationDocModels.add(newRelation);
index 861838cbe9607e2568d24b7208847fb8d143ee3a..dbf63645ed64d04e2f1c2f9cb71ac9851ddd9e7f 100644 (file)
@@ -7,6 +7,7 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
 import org.collectionspace.services.nuxeo.listener.AbstractCSEventListenerImpl;
@@ -81,11 +82,11 @@ public class UpdateRelationsOnDelete extends AbstractCSEventListenerImpl {
             DocumentModelList matchingDocuments;
             try {
                 matchingDocuments = session.query(queryString.toString(), workflowStateFilter);
-            } catch (Exception ce) {
-                logger.warn("Error attempting to retrieve relation records where "
+            } catch (DocumentException ce) {
+                logger.error("Error attempting to retrieve relation records where "
                         + "record of type '" + docModel.getType() + "' with CSID " + csid
                         + " is the subject or object of any relation: " + ce.getMessage());
-                throw ce;
+                return;
             }
 
             // Cycle through the list results, soft deleting each matching relation record
index 60ceabd8bce774304001ab3882e1600097da170e..51b914d237a6c6912a6246c943feb7512403d274 100644 (file)
@@ -64,6 +64,7 @@ import org.nuxeo.ecm.core.NXCore;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.Blob;
+import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.IdRef;
@@ -920,7 +921,7 @@ public class NuxeoUtils {
     }
     
     public static boolean documentExists(CoreSessionInterface repoSession,
-               String csid) {
+               String csid) throws ClientException, DocumentException {
                boolean result = false;
                
                String statement = String.format(