From 9aa4a1f466759f20aad60e8129a2234931a59a48 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 15 Dec 2023 13:13:21 -0500 Subject: [PATCH] DRYD-1253: UCB Botgarden Contributions (#362) Co-authored-by: Richard Millet Co-authored-by: Ray Lee --- .../nuxeo/nuxeo-platform-listener/build.xml | 6 +- .../UpdateFormattedDisplayNameListener.java | 4 +- .../nuxeo/nuxeo-platform-listener/pom.xml | 2 +- .../{ => tenants}/botgarden/build.properties | 0 .../{ => tenants}/botgarden/build.xml | 2 +- .../{ => tenants}/botgarden/pom.xml | 8 +- .../botgarden/CreateVersionListener.java | 0 .../botgarden/DeleteDeadLocationListener.java | 5 +- .../botgarden/UpdateAccessCodeListener.java | 17 +- .../botgarden/UpdateDeadFlagListener.java | 9 +- .../botgarden/UpdateLocationListener.java | 7 +- .../botgarden/UpdateRareFlagListener.java | 20 +- .../botgarden/UpdateStyledNameListener.java | 2 +- .../src/main/resources/META-INF/MANIFEST.MF | 0 .../resources/OSGI-INF/core-types-contrib.xml | 0 .../OSGI-INF/default-life-cycle-contrib.xml | 0 .../OSGI-INF/deployment-fragment.xml | 0 .../resources/OSGI-INF/ecm-types-contrib.xml | 0 .../resources/OSGI-INF/layouts-contrib.xml | 0 .../nuxeo-platform-listener/tenants/build.xml | 45 +++++ .../nuxeo-platform-listener/tenants/pom.xml | 42 ++++ cspace-ui/build.xml | 1 + .../ClearLocationLabelRequestBatchJob.java | 3 +- .../ClearPotTagLabelRequestBatchJob.java | 5 +- .../ClearVoucherLabelRequestBatchJob.java | 3 +- .../CreateVoucherBatchJob.java | 32 +-- .../FormatVoucherNameBatchJob.java | 25 +-- .../UpdateAccessCodeBatchJob.java | 40 ++-- .../UpdateDeadFlagBatchJob.java | 14 +- .../botgarden/UpdateHybridNameBatchJob.java | 187 ++++++++++++++++++ .../botgarden/UpdateObjectFieldsBatchJob.java | 136 +++++++++++++ .../UpdateRareFlagBatchJob.java | 27 +-- .../client/CollectionSpaceClient.java | 1 + .../test/AbstractAuthorityServiceTest.java | 16 +- .../CollectionObjectBotGardenConstants.java | 38 ---- ...llectionObjectNaturalHistoryConstants.java | 47 +++++ ...ardenCollectionObjectValidatorHandler.java | 3 +- ...PahmaCollectionObjectValidatorHandler.java | 13 ++ ...CJepsCollectionObjectValidatorHandler.java | 19 ++ .../services/common/api/RefNameUtils.java | 38 +++- .../botgarden-tenant-bindings.delta.xml | 2 +- .../nuxeo/MovementBotGardenConstants.java | 13 +- .../taxonomy/nuxeo/TaxonConstants.java | 11 +- ...java => TaxonNaturalHistoryConstants.java} | 2 +- .../nuxeo/TaxonomyAuthorityConstants.java | 2 +- 45 files changed, 692 insertions(+), 155 deletions(-) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/build.properties (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/build.xml (98%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/pom.xml (97%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java (92%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java (94%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java (92%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java (88%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java (92%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java (98%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/META-INF/MANIFEST.MF (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/OSGI-INF/core-types-contrib.xml (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/OSGI-INF/default-life-cycle-contrib.xml (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/OSGI-INF/deployment-fragment.xml (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/OSGI-INF/ecm-types-contrib.xml (100%) rename 3rdparty/nuxeo/nuxeo-platform-listener/{ => tenants}/botgarden/src/main/resources/OSGI-INF/layouts-contrib.xml (100%) create mode 100644 3rdparty/nuxeo/nuxeo-platform-listener/tenants/build.xml create mode 100644 3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/ClearLocationLabelRequestBatchJob.java (97%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/ClearPotTagLabelRequestBatchJob.java (96%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/ClearVoucherLabelRequestBatchJob.java (96%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/CreateVoucherBatchJob.java (88%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/FormatVoucherNameBatchJob.java (88%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/UpdateAccessCodeBatchJob.java (91%) rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/UpdateDeadFlagBatchJob.java (92%) create mode 100644 services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateHybridNameBatchJob.java create mode 100644 services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateObjectFieldsBatchJob.java rename services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/{ => botgarden}/UpdateRareFlagBatchJob.java (92%) create mode 100644 services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/CollectionObjectNaturalHistoryConstants.java rename services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/{ => validators}/BotGardenCollectionObjectValidatorHandler.java (69%) create mode 100644 services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/validators/PahmaCollectionObjectValidatorHandler.java create mode 100644 services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/validators/UCJepsCollectionObjectValidatorHandler.java rename services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/{TaxonBotGardenConstants.java => TaxonNaturalHistoryConstants.java} (95%) diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/build.xml b/3rdparty/nuxeo/nuxeo-platform-listener/build.xml index 87dd0d928..b2653f941 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/build.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/build.xml @@ -120,7 +120,7 @@ - + - + - + diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java index fdacc7585..5416b4480 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java @@ -13,7 +13,7 @@ import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.common.api.RefName; import org.collectionspace.services.common.api.TaxonFormatter; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; -import org.collectionspace.services.taxonomy.nuxeo.TaxonBotGardenConstants; +import org.collectionspace.services.taxonomy.nuxeo.TaxonNaturalHistoryConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityConstants; @@ -74,7 +74,7 @@ public class UpdateFormattedDisplayNameListener extends AbstractCSEventSyncListe logger.debug("parentShortId=" + parentShortId); - if (!parentShortId.equals(TaxonBotGardenConstants.COMMON_VOCABULARY_SHORTID)) { + if (!parentShortId.equals(TaxonNaturalHistoryConstants.COMMON_VOCABULARY_SHORTID)) { if (event.getName().equals(DocumentEventTypes.DOCUMENT_CREATED)) { // Save the document, to get the BEFORE_DOC_UPDATE branch to run. doc.getCoreSession().saveDocument(doc); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml index ef2bea300..4d32c0ddf 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml @@ -18,7 +18,7 @@ updaterelationsondelete updateimagederivatives naturalhistory - botgarden + tenants diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/build.properties b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/build.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/build.properties rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/build.properties diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/build.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/build.xml similarity index 98% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/build.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/build.xml index b8d2e3003..84fef484b 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/build.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/build.xml @@ -3,7 +3,7 @@ CollectionSpace Nuxeo listener component type - + diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml similarity index 97% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/pom.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml index db79e6b9b..d632e1e60 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml @@ -4,18 +4,19 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.collectionspace.services.3rdparty.nuxeo.listener + org.collectionspace.services.3rdparty.nuxeo.listener.tenants org.collectionspace.services - ${revision} + ${revision} + UTF-8 + org.collectionspace.services.listener.botgarden org.collectionspace.services.listener.botgarden http://maven.apache.org - org.nuxeo.ecm.core @@ -44,7 +45,6 @@ - diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java similarity index 92% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java index 4e3a3a0b0..43e4f97af 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java @@ -4,6 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.collectionspace.services.client.workflow.WorkflowClient; +import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.movement.nuxeo.MovementBotGardenConstants; import org.collectionspace.services.movement.nuxeo.MovementConstants; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; @@ -49,8 +50,8 @@ public class DeleteDeadLocationListener extends AbstractCSEventSyncListenerImpl MovementBotGardenConstants.ACTION_CODE_FIELD_NAME); logger.debug("actionCode=" + actionCode); - - if (actionCode != null && actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) { + + if (actionCode != null && RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE)) { CoreSession session = context.getCoreSession(); if (session.getAllowedStateTransitions(doc.getRef()).contains(WorkflowClient.WORKFLOWTRANSITION_DELETE)) { diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java similarity index 94% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java index 04f0a218b..ddd33e8e5 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java @@ -13,21 +13,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.collectionspace.services.batch.BatchResource; -import org.collectionspace.services.batch.nuxeo.UpdateAccessCodeBatchJob; -import org.collectionspace.services.batch.nuxeo.UpdateAccessCodeBatchJob.UpdateAccessCodeResults; +import org.collectionspace.services.batch.nuxeo.botgarden.UpdateAccessCodeBatchJob; +import org.collectionspace.services.batch.nuxeo.botgarden.UpdateAccessCodeBatchJob.UpdateAccessCodeResults; import org.collectionspace.services.client.BatchClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.ResourceMap; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.common.relation.nuxeo.RelationConstants; import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; -import org.collectionspace.services.taxonomy.nuxeo.TaxonBotGardenConstants; +import org.collectionspace.services.taxonomy.nuxeo.TaxonNaturalHistoryConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityConstants; @@ -44,7 +45,7 @@ import org.nuxeo.ecm.core.event.impl.DocumentEventContext; * A listener that updates the access code on taxon records when collectionobjects * or taxon records are created or modified. * - * @see org.collectionspace.services.batch.nuxeo.UpdateAccessCodeBatchJob + * @see org.collectionspace.services.batch.nuxeo.botgarden.UpdateAccessCodeBatchJob * @author ray * */ @@ -56,7 +57,7 @@ public class UpdateAccessCodeListener extends AbstractCSEventSyncListenerImpl { public static final String PREVIOUS_ACCESS_CODE_PROPERTY_NAME = "UpdateAccessCodeListener.previousAccessCode"; public static final String DELETED_RELATION_PARENT_CSID_PROPERTY_NAME = "UpdateAccessCodeListener.deletedRelationParentCsid"; - private static final String[] TAXON_PATH_ELEMENTS = CollectionObjectBotGardenConstants.TAXON_FIELD_NAME.split("/"); + private static final String[] TAXON_PATH_ELEMENTS = CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME.split("/"); private static final String TAXONOMIC_IDENT_GROUP_LIST_FIELD_NAME = TAXON_PATH_ELEMENTS[0]; private static final String TAXON_FIELD_NAME = TAXON_PATH_ELEMENTS[2]; @@ -205,7 +206,7 @@ public class UpdateAccessCodeListener extends AbstractCSEventSyncListenerImpl { // Stash the previous access code value, so it can be retrieved in the documentModified handler. DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL); - String previousAccessCode = (String) previousDoc.getProperty(TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); + String previousAccessCode = (String) previousDoc.getProperty(TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); context.setProperty(PREVIOUS_ACCESS_CODE_PROPERTY_NAME, previousAccessCode); } @@ -218,7 +219,7 @@ public class UpdateAccessCodeListener extends AbstractCSEventSyncListenerImpl { // record if it has. String previousAccessCode = (String) context.getProperty(PREVIOUS_ACCESS_CODE_PROPERTY_NAME); - String currentAccessCode = (String) doc.getProperty(TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); + String currentAccessCode = (String) doc.getProperty(TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); if (previousAccessCode == null) { previousAccessCode = ""; @@ -321,7 +322,7 @@ public class UpdateAccessCodeListener extends AbstractCSEventSyncListenerImpl { } private List getTaxonNames(DocumentModel doc) { - List> taxonomicIdentGroupList = (List>) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, + List> taxonomicIdentGroupList = (List>) doc.getProperty(CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, TAXONOMIC_IDENT_GROUP_LIST_FIELD_NAME); List taxonNames = new ArrayList(); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java similarity index 92% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java index 76aca736a..9106cdf76 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java @@ -4,13 +4,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.collectionspace.services.batch.BatchResource; -import org.collectionspace.services.batch.nuxeo.UpdateDeadFlagBatchJob; +import org.collectionspace.services.batch.nuxeo.botgarden.UpdateDeadFlagBatchJob; import org.collectionspace.services.client.BatchClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; import org.collectionspace.services.common.ResourceMap; +import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.common.relation.nuxeo.RelationConstants; @@ -36,7 +37,7 @@ public class UpdateDeadFlagListener extends AbstractCSEventSyncListenerImpl { } /* - * Set the dead flag and dead date on collectionobjects related to a new or modified movement record. + * Set the dead flag and dead date on CollectionObjects related to a new or modified movement record. */ @Override public void handleCSEvent(Event event) { @@ -89,7 +90,9 @@ public class UpdateDeadFlagListener extends AbstractCSEventSyncListenerImpl { logger.debug("actionCode=" + actionCode); - if (actionCode != null && (actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE) || actionCode.equals(MovementBotGardenConstants.REVIVED_ACTION_CODE))) { + if (actionCode != null && + (RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE) || + RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.REVIVED_ACTION_CODE))) { String movementCsid = doc.getName(); try { diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java similarity index 88% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java index f92e6b0af..e559ce4ea 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java @@ -4,6 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.collectionspace.services.client.workflow.WorkflowClient; +import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.movement.nuxeo.MovementBotGardenConstants; import org.collectionspace.services.movement.nuxeo.MovementConstants; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; @@ -66,7 +67,7 @@ public class UpdateLocationListener extends AbstractCSEventSyncListenerImpl { * event to fire, taking us into the other branch of this code, with the current document * becoming the previous document. */ - if (actionCode != null && actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) { + if (actionCode != null && RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE)) { context.getCoreSession().saveDocument(doc); /* @@ -77,7 +78,7 @@ public class UpdateLocationListener extends AbstractCSEventSyncListenerImpl { } } else { - if (actionCode != null && actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) { + if (actionCode != null && RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE)) { doc.setProperty(MovementConstants.CURRENT_LOCATION_SCHEMA_NAME, MovementConstants.CURRENT_LOCATION_FIELD_NAME, MovementConstants.NONE_LOCATION); } @@ -86,7 +87,7 @@ public class UpdateLocationListener extends AbstractCSEventSyncListenerImpl { logger.debug("previousLocation=" + previousLocation); - doc.setProperty(MovementConstants.PREVIOUS_LOCATION_SCHEMA_NAME, MovementConstants.PREVIOUS_LOCATION_FIELD_NAME, previousLocation); + doc.setProperty(MovementBotGardenConstants.PREVIOUS_LOCATION_SCHEMA_NAME, MovementBotGardenConstants.PREVIOUS_LOCATION_FIELD_NAME, previousLocation); } } diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java similarity index 92% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java index 0efc873a1..844f07904 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java @@ -7,19 +7,19 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.collectionspace.services.batch.BatchResource; -import org.collectionspace.services.batch.nuxeo.UpdateRareFlagBatchJob; +import org.collectionspace.services.batch.nuxeo.botgarden.UpdateRareFlagBatchJob; import org.collectionspace.services.client.BatchClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; -import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.ResourceMap; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; -import org.collectionspace.services.taxonomy.nuxeo.TaxonBotGardenConstants; +import org.collectionspace.services.taxonomy.nuxeo.TaxonNaturalHistoryConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityConstants; @@ -36,7 +36,7 @@ import org.nuxeo.ecm.core.event.impl.DocumentEventContext; * A listener that updates the rare flag on collectionobjects when collectionobjects * are created or modified, and when taxon records are modified. * - * @see org.collectionspace.services.batch.nuxeo.UpdateRareFlagBatchJob + * @see org.collectionspace.services.batch.nuxeo.botgarden.UpdateRareFlagBatchJob * @author ray * */ @@ -46,7 +46,7 @@ public class UpdateRareFlagListener extends AbstractCSEventSyncListenerImpl { public static final String PREVIOUS_TAXON_PROPERTY_NAME = "UpdateRareFlagListener.previousTaxon"; public static final String PREVIOUS_HAS_RARE_CONSERVATION_CATEGORY_PROPERTY_NAME = "UpdateRareFlagListener.previousHasRareConservationCategory"; - private static final String[] CONSERVATION_CATEGORY_PATH_ELEMENTS = TaxonBotGardenConstants.CONSERVATION_CATEGORY_FIELD_NAME.split("/"); + private static final String[] CONSERVATION_CATEGORY_PATH_ELEMENTS = TaxonNaturalHistoryConstants.CONSERVATION_CATEGORY_FIELD_NAME.split("/"); private static final String PLANT_ATTRIBUTES_GROUP_LIST_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[0]; private static final String CONSERVATION_CATEGORY_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[2]; @@ -73,8 +73,8 @@ public class UpdateRareFlagListener extends AbstractCSEventSyncListenerImpl { // Stash the previous primary taxonomic ident, so it can be retrieved in the documentModified handler. DocumentModel previousDoc = (DocumentModel) context.getProperty(CoreEventConstants.PREVIOUS_DOCUMENT_MODEL); - String previousTaxon = (String) previousDoc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.PRIMARY_TAXON_FIELD_NAME); + String previousTaxon = (String) previousDoc.getProperty(CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.PRIMARY_TAXON_FIELD_NAME); context.setProperty(PREVIOUS_TAXON_PROPERTY_NAME, previousTaxon); } @@ -86,8 +86,8 @@ public class UpdateRareFlagListener extends AbstractCSEventSyncListenerImpl { // of the collectionobject has changed. We only need to update the rare flag if it has. String previousTaxon = (String) context.getProperty(PREVIOUS_TAXON_PROPERTY_NAME); - String currentTaxon = (String) doc.getProperty(CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.PRIMARY_TAXON_FIELD_NAME); + String currentTaxon = (String) doc.getProperty(CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.PRIMARY_TAXON_FIELD_NAME); if (previousTaxon == null) { previousTaxon = ""; @@ -177,7 +177,7 @@ public class UpdateRareFlagListener extends AbstractCSEventSyncListenerImpl { } private boolean hasRareConservationCategory(DocumentModel doc) { - List> plantAttributesGroupList = (List>) doc.getProperty(TaxonBotGardenConstants.CONSERVATION_CATEGORY_SCHEMA_NAME, + List> plantAttributesGroupList = (List>) doc.getProperty(TaxonNaturalHistoryConstants.CONSERVATION_CATEGORY_SCHEMA_NAME, PLANT_ATTRIBUTES_GROUP_LIST_FIELD_NAME); boolean hasRareConservationCategory = false; diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java similarity index 98% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java index f6c61b72c..6b46af12d 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java @@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory; import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.collectionspace.services.batch.BatchResource; -import org.collectionspace.services.batch.nuxeo.FormatVoucherNameBatchJob; +import org.collectionspace.services.batch.nuxeo.botgarden.FormatVoucherNameBatchJob; import org.collectionspace.services.client.BatchClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/META-INF/MANIFEST.MF b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/META-INF/MANIFEST.MF similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/META-INF/MANIFEST.MF rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/META-INF/MANIFEST.MF diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/core-types-contrib.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/core-types-contrib.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/core-types-contrib.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/core-types-contrib.xml diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/default-life-cycle-contrib.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/default-life-cycle-contrib.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/default-life-cycle-contrib.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/default-life-cycle-contrib.xml diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/deployment-fragment.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/deployment-fragment.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/deployment-fragment.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/deployment-fragment.xml diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/ecm-types-contrib.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/ecm-types-contrib.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/ecm-types-contrib.xml diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/layouts-contrib.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/layouts-contrib.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/resources/OSGI-INF/layouts-contrib.xml rename to 3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/resources/OSGI-INF/layouts-contrib.xml diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/build.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/build.xml new file mode 100644 index 000000000..7257de35f --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/build.xml @@ -0,0 +1,45 @@ + + + Deploy Nuxeo event listeners + + + + + CSpace Release is ${cspace.release} + + + + + + + + + + + + + + Deploy tenant listeners for ${tenant.shortname} + + + + + + + + + + + + Undeploy tenant listeners for ${tenant.shortname} + + + + + + + + + + + diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml new file mode 100644 index 000000000..3d7de3cda --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml @@ -0,0 +1,42 @@ + + + + + org.collectionspace.services + org.collectionspace.services.3rdparty.nuxeo.listener + ${revision} + + + 4.0.0 + org.collectionspace.services.3rdparty.nuxeo.listener.tenants + pom + services.3rdparty.nuxeo.listener.tenants + + + botgarden + + + + + org.osgi + org.osgi.core + 4.1.0 + + + org.nuxeo.ecm.core + nuxeo-core-storage-sql + + + org.nuxeo.ecm.platform + nuxeo-platform-filemanager-api + ${nuxeo.platform.version} + + + org.nuxeo.ecm.platform + nuxeo-platform-imaging-api + ${nuxeo.platform.version} + provided + + + + diff --git a/cspace-ui/build.xml b/cspace-ui/build.xml index 3fceeabe6..08ec1076d 100644 --- a/cspace-ui/build.xml +++ b/cspace-ui/build.xml @@ -122,6 +122,7 @@ + Binding file here: ../../services/common/src/main/cspace/config/services/tenants/${tenant.shortname}/${tenant.shortname}-tenant-bindings.delta.xml diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearLocationLabelRequestBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearLocationLabelRequestBatchJob.java similarity index 97% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearLocationLabelRequestBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearLocationLabelRequestBatchJob.java index 4b64312f9..933d25e4d 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearLocationLabelRequestBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearLocationLabelRequestBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.ArrayList; @@ -7,6 +7,7 @@ import java.util.List; import javax.ws.rs.core.UriInfo; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.MovementClient; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.VocabularyClient; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearPotTagLabelRequestBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearPotTagLabelRequestBatchJob.java similarity index 96% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearPotTagLabelRequestBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearPotTagLabelRequestBatchJob.java index 9448844d3..8b6591f32 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearPotTagLabelRequestBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearPotTagLabelRequestBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.ArrayList; @@ -7,6 +7,7 @@ import java.util.List; import javax.ws.rs.core.UriInfo; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.PottagClient; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.invocable.InvocationResults; @@ -68,7 +69,7 @@ public class ClearPotTagLabelRequestBatchJob extends AbstractBatchJob { clearLabelRequest(potTagCsid); numAffected = numAffected + 1; } - + results.setNumAffected(numAffected); results.setUserNote("Removed " + numAffected + " label " + (numAffected == 1 ? "request" : "requests")); diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearVoucherLabelRequestBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearVoucherLabelRequestBatchJob.java similarity index 96% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearVoucherLabelRequestBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearVoucherLabelRequestBatchJob.java index 71b8119db..e5ae0d65b 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearVoucherLabelRequestBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/ClearVoucherLabelRequestBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.ArrayList; @@ -7,6 +7,7 @@ import java.util.List; import javax.ws.rs.core.UriInfo; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.LoanoutClient; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.invocable.InvocationResults; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/CreateVoucherBatchJob.java similarity index 88% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/CreateVoucherBatchJob.java index 30c39a37d..1429313b6 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/CreateVoucherBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.Arrays; @@ -10,12 +10,14 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.CollectionSpaceClientUtils; import org.collectionspace.services.client.LoanoutClient; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.common.relation.nuxeo.RelationConstants; @@ -80,7 +82,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { InvocationResults results = new InvocationResults(); PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid); - String collectionObjectWorkflowState = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.WORKFLOW_STATE_SCHEMA_NAME, + String collectionObjectWorkflowState = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.WORKFLOW_STATE_SCHEMA_NAME, CollectionObjectBotGardenConstants.WORKFLOW_STATE_FIELD_NAME); if (collectionObjectWorkflowState.equals(WorkflowClient.WORKFLOWSTATE_DELETED)) { @@ -134,8 +136,8 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { placeNote = reverseFieldCollectionPlace; } else { - String taxonomicRange = this.getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.TAXONOMIC_RANGE_SCHEMA_NAME, - CollectionObjectBotGardenConstants.TAXONOMIC_RANGE_FIELD_NAME); + String taxonomicRange = this.getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.TAXONOMIC_RANGE_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.TAXONOMIC_RANGE_FIELD_NAME); if (StringUtils.isNotBlank(taxonomicRange)) { placeNote = "Geographic range " + taxonomicRange; @@ -161,8 +163,8 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { private String getReverseFieldCollectionPlace(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException, Exception { String reverseDisplayName = null; - String fieldCollectionPlaceRefName = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_SCHEMA_NAME, - CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_FIELD_NAME); + String fieldCollectionPlaceRefName = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.FIELD_COLLECTION_PLACE_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.FIELD_COLLECTION_PLACE_FIELD_NAME); if (StringUtils.isNotBlank(fieldCollectionPlaceRefName)) { PoxPayloadOut placePayload = null; @@ -202,20 +204,20 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { private String getAnnotation(PoxPayloadOut collectionObjectPayload) { String annotation = ""; - String determinationKind = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.DETERMINATION_KIND_SCHEMA_NAME, - CollectionObjectBotGardenConstants.DETERMINATION_KIND_FIELD_NAME); + String determinationKind = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.DETERMINATION_KIND_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.DETERMINATION_KIND_FIELD_NAME); - if (determinationKind.equals(CollectionObjectBotGardenConstants.DETERMINATION_KIND_DETERMINATION_VALUE)) { - String determinationBy = getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.DETERMINATION_BY_SCHEMA_NAME, - CollectionObjectBotGardenConstants.DETERMINATION_BY_FIELD_NAME)); + if (determinationKind.equals(CollectionObjectNaturalHistoryConstants.DETERMINATION_KIND_DETERMINATION_VALUE)) { + String determinationBy = getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.DETERMINATION_BY_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.DETERMINATION_BY_FIELD_NAME)); if (StringUtils.isNotBlank(determinationBy)) { annotation += "det. by " + determinationBy; - String determinationInstitution = getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.DETERMINATION_INSTITUTION_SCHEMA_NAME, - CollectionObjectBotGardenConstants.DETERMINATION_INSTITUTION_FIELD_NAME)); - String determinationDate = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.DETERMINATION_DATE_SCHEMA_NAME, - CollectionObjectBotGardenConstants.DETERMINATION_DATE_FIELD_NAME); + String determinationInstitution = getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.DETERMINATION_INSTITUTION_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.DETERMINATION_INSTITUTION_FIELD_NAME)); + String determinationDate = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.DETERMINATION_DATE_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.DETERMINATION_DATE_FIELD_NAME); if (StringUtils.isNotBlank(determinationInstitution)) { annotation += ", " + determinationInstitution; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatVoucherNameBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/FormatVoucherNameBatchJob.java similarity index 88% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatVoucherNameBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/FormatVoucherNameBatchJob.java index cbe43949f..2c3e83646 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatVoucherNameBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/FormatVoucherNameBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.ArrayList; @@ -8,11 +8,12 @@ import java.util.List; import javax.ws.rs.core.UriInfo; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.LoanoutClient; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; -import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.api.TaxonFormatter; import org.collectionspace.services.common.invocable.InvocationResults; @@ -135,19 +136,19 @@ public class FormatVoucherNameBatchJob extends AbstractBatchJob { if (collectionObjectPayload != null) { name = new VoucherName(); - name.setName(getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.TAXON_FIELD_NAME))); - name.setHybrid(getBooleanFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.HYBRID_FLAG_SCHEMA_NAME, - CollectionObjectBotGardenConstants.HYBRID_FLAG_FIELD_NAME)); + name.setName(getDisplayNameFromRefName(getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME))); + name.setHybrid(getBooleanFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.HYBRID_FLAG_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.HYBRID_FLAG_FIELD_NAME)); if (name.isHybrid()) { - List hybridParents = this.getFieldValues(collectionObjectPayload, CollectionObjectBotGardenConstants.HYBRID_PARENT_SCHEMA_NAME, - CollectionObjectBotGardenConstants.HYBRID_PARENT_FIELD_NAME); - List hybridQualifiers = this.getFieldValues(collectionObjectPayload, CollectionObjectBotGardenConstants.HYBRID_QUALIFIER_SCHEMA_NAME, - CollectionObjectBotGardenConstants.HYBRID_QUALIFIER_FIELD_NAME); + List hybridParents = this.getFieldValues(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.HYBRID_PARENT_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.HYBRID_PARENT_FIELD_NAME); + List hybridQualifiers = this.getFieldValues(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.HYBRID_QUALIFIER_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.HYBRID_QUALIFIER_FIELD_NAME); - int femaleIndex = hybridQualifiers.indexOf(CollectionObjectBotGardenConstants.HYBRID_QUALIFIER_FEMALE_VALUE); - int maleIndex = hybridQualifiers.indexOf(CollectionObjectBotGardenConstants.HYBRID_QUALIFIER_MALE_VALUE); + int femaleIndex = hybridQualifiers.indexOf(CollectionObjectNaturalHistoryConstants.HYBRID_QUALIFIER_FEMALE_VALUE); + int maleIndex = hybridQualifiers.indexOf(CollectionObjectNaturalHistoryConstants.HYBRID_QUALIFIER_MALE_VALUE); if (femaleIndex >= 0) { name.setFemaleParentName(getDisplayNameFromRefName(hybridParents.get(femaleIndex))); diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateAccessCodeBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateAccessCodeBatchJob.java similarity index 91% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateAccessCodeBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateAccessCodeBatchJob.java index e49339fd4..cfc31e06c 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateAccessCodeBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateAccessCodeBatchJob.java @@ -1,19 +1,21 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.TaxonomyAuthorityClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.api.RefName; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.common.vocabulary.AuthorityResource; -import org.collectionspace.services.taxonomy.nuxeo.TaxonBotGardenConstants; +import org.collectionspace.services.taxonomy.nuxeo.TaxonNaturalHistoryConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; import org.dom4j.DocumentException; import org.slf4j.Logger; @@ -35,7 +37,7 @@ import org.slf4j.LoggerFactory; public class UpdateAccessCodeBatchJob extends AbstractBatchJob { final Logger logger = LoggerFactory.getLogger(UpdateAccessCodeBatchJob.class); - private final String[] TAXON_FIELD_NAME_PARTS = CollectionObjectBotGardenConstants.TAXON_FIELD_NAME.split("\\/"); + private final String[] TAXON_FIELD_NAME_PARTS = CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME.split("\\/"); private final String TAXON_FIELD_NAME_WITHOUT_PATH = TAXON_FIELD_NAME_PARTS[TAXON_FIELD_NAME_PARTS.length - 1]; public UpdateAccessCodeBatchJob() { @@ -124,7 +126,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { public InvocationResults updateParentAccessCode(String taxonCsid, boolean propagate) throws URISyntaxException, DocumentException, Exception { PoxPayloadOut taxonPayload = findTaxonByCsid(taxonCsid); String taxonRefName = getFieldValue(taxonPayload, TaxonConstants.REFNAME_SCHEMA_NAME, TaxonConstants.REFNAME_FIELD_NAME); - String accessCode = getFieldValue(taxonPayload, TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); + String accessCode = getFieldValue(taxonPayload, TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); logger.debug("updating parent access code: taxonRefName=" + taxonRefName + " propagate=" + propagate + " accessCode=" + accessCode); @@ -162,8 +164,8 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { logger.debug("updating referenced access codes: collectionObjectCsid=" + collectionObjectCsid + " propagate=" + propagate + " isAlive=" + isAlive); - List taxonRefNames = getFieldValues(collectionObjectPayload, CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.TAXON_FIELD_NAME); + List taxonRefNames = getFieldValues(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME); long numAffected = 0; for (String taxonRefName : taxonRefNames) { @@ -232,7 +234,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { String taxonCsid = getCsid(taxonPayload); String taxonRefName = getFieldValue(taxonPayload, TaxonConstants.REFNAME_SCHEMA_NAME, TaxonConstants.REFNAME_FIELD_NAME); - String accessCode = getFieldValue(taxonPayload, TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); + String accessCode = getFieldValue(taxonPayload, TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); logger.debug("updating access code: taxonRefName=" + taxonRefName + " deep=" + deep + " knownAlive=" + knownAlive); @@ -252,7 +254,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { if (!childResults.isSoftDeleted()) { String childAccessCode = childResults.getAccessCode(); - boolean isChildAlive = !childAccessCode.equals(TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE); + boolean isChildAlive = !childAccessCode.equals(TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE); if (isChildAlive) { foundAlive = true; @@ -273,9 +275,9 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { for (String childTaxonCsid : childTaxonCsids) { PoxPayloadOut childTaxonPayload = findTaxonByCsid(childTaxonCsid); - String childAccessCode = getFieldValue(childTaxonPayload, TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, - TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); - boolean isChildAlive = !childAccessCode.equals(TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE); + String childAccessCode = getFieldValue(childTaxonPayload, TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, + TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); + boolean isChildAlive = !childAccessCode.equals(TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE); if (isChildAlive) { foundAlive = true; @@ -292,7 +294,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { String vocabularyShortId = item.getParentShortIdentifier(); List collectionObjectCsids = findReferencingCollectionObjects(TaxonomyAuthorityClient.SERVICE_NAME, vocabularyShortId, taxonCsid, - CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME + ":" + TAXON_FIELD_NAME_WITHOUT_PATH); + CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME + ":" + TAXON_FIELD_NAME_WITHOUT_PATH); for (String collectionObjectCsid : collectionObjectCsids) { PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid); @@ -319,11 +321,11 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { // living example, and the access code is not dead, the current value of unrestricted // or restricted should be retained. - if (foundAlive && (StringUtils.isEmpty(accessCode) || accessCode.equals(TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE))) { - newAccessCode = TaxonBotGardenConstants.ACCESS_CODE_UNRESTRICTED_VALUE; + if (foundAlive && (StringUtils.isEmpty(accessCode) || accessCode.equals(TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE))) { + newAccessCode = TaxonNaturalHistoryConstants.ACCESS_CODE_UNRESTRICTED_VALUE; } else if (!foundAlive) { - newAccessCode = TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE; + newAccessCode = TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE; } else { newAccessCode = accessCode; @@ -379,13 +381,13 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { */ public UpdateAccessCodeResults updateAccessCode(String taxonRefNameOrCsid, boolean deep, String newChildTaxonCsid) throws URISyntaxException, DocumentException, Exception { PoxPayloadOut newChildTaxonPayload = findTaxonByCsid(newChildTaxonCsid); - String newChildTaxonAccessCode = getFieldValue(newChildTaxonPayload, TaxonBotGardenConstants.ACCESS_CODE_SCHEMA_NAME, TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME); + String newChildTaxonAccessCode = getFieldValue(newChildTaxonPayload, TaxonNaturalHistoryConstants.ACCESS_CODE_SCHEMA_NAME, TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME); if (newChildTaxonAccessCode == null) { newChildTaxonAccessCode = ""; } - boolean knownAlive = !newChildTaxonAccessCode.equals(TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE); + boolean knownAlive = !newChildTaxonAccessCode.equals(TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE); return updateAccessCode(taxonRefNameOrCsid, deep, knownAlive); } @@ -414,7 +416,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { logger.debug("updating parent access code: taxonCsid=" + taxonCsid + " accessCode=" + accessCode + " propagate=" + propagate); if (parentTaxonCsid != null) { - boolean isAlive = (accessCode == null) || !accessCode.equals(TaxonBotGardenConstants.ACCESS_CODE_DEAD_VALUE); + boolean isAlive = (accessCode == null) || !accessCode.equals(TaxonNaturalHistoryConstants.ACCESS_CODE_DEAD_VALUE); UpdateAccessCodeResults parentUpdateResults = updateAccessCode(parentTaxonCsid, false, isAlive); @@ -453,7 +455,7 @@ public class UpdateAccessCodeBatchJob extends AbstractBatchJob { "" + "" + "" + - getFieldXml(TaxonBotGardenConstants.ACCESS_CODE_FIELD_NAME, accessCode) + + getFieldXml(TaxonNaturalHistoryConstants.ACCESS_CODE_FIELD_NAME, accessCode) + "" + ""; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateDeadFlagBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateDeadFlagBatchJob.java similarity index 92% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateDeadFlagBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateDeadFlagBatchJob.java index 34c8e434d..3e1615d54 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateDeadFlagBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateDeadFlagBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.ArrayList; @@ -6,12 +6,14 @@ import java.util.Arrays; import java.util.List; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; import org.collectionspace.services.common.NuxeoBasedResource; +import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.movement.nuxeo.MovementBotGardenConstants; import org.collectionspace.services.movement.nuxeo.MovementConstants; @@ -71,7 +73,8 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob { String actionCode = getFieldValue(payload, MovementBotGardenConstants.ACTION_CODE_SCHEMA_NAME, MovementBotGardenConstants.ACTION_CODE_FIELD_NAME); logger.debug("actionCode=" + actionCode); - if (actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE) || actionCode.equals(MovementBotGardenConstants.REVIVED_ACTION_CODE)) { + if (RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE) || + RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.REVIVED_ACTION_CODE)) { String actionDate = getFieldValue(payload, MovementBotGardenConstants.ACTION_DATE_SCHEMA_NAME, MovementBotGardenConstants.ACTION_DATE_FIELD_NAME); logger.debug("actionDate=" + actionDate); @@ -117,7 +120,8 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob { MovementBotGardenConstants.ACTION_CODE_FIELD_NAME); logger.debug("actionCode=" + actionCode); - if (actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE) || actionCode.equals(MovementBotGardenConstants.REVIVED_ACTION_CODE)) { + if (RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE) || + RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.REVIVED_ACTION_CODE)) { String actionDate = getFieldValue(payload, MovementBotGardenConstants.ACTION_DATE_SCHEMA_NAME, MovementBotGardenConstants.ACTION_DATE_FIELD_NAME); logger.debug("actionDate=" + actionDate); @@ -157,7 +161,7 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob { logger.debug("updating dead flag: collectionObjectCsid=" + collectionObjectCsid + " actionCode=" + actionCode + " isDead=" + isDead); - if (actionCode.equals(MovementBotGardenConstants.REVIVED_ACTION_CODE)) { + if (RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.REVIVED_ACTION_CODE)) { if (isDead) { /* * The object is dead, but a location was revived. Unset the dead flag and date on the object. @@ -168,7 +172,7 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob { results.setUserNote(collectionObjectCsid + " set to alive"); } } - else if (actionCode.equals(MovementBotGardenConstants.DEAD_ACTION_CODE)) { + else if (RefNameUtils.doShortIDsMatch(actionCode, MovementBotGardenConstants.DEAD_ACTION_CODE)) { if (!isDead) { /* * The object is not dead, but a location was marked dead. If there are no remaining live locations, diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateHybridNameBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateHybridNameBatchJob.java new file mode 100644 index 000000000..f226f4498 --- /dev/null +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateHybridNameBatchJob.java @@ -0,0 +1,187 @@ +package org.collectionspace.services.batch.nuxeo.botgarden; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Iterator; + +import org.dom4j.Element; +import org.dom4j.Node; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; +import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.common.api.RefNameUtils; +import org.collectionspace.services.common.invocable.InvocationResults; +import org.collectionspace.services.common.NuxeoBasedResource; +import org.collectionspace.services.common.ResourceMap; +import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UpdateHybridNameBatchJob extends AbstractBatchJob { + final Logger logger = LoggerFactory.getLogger(UpdateHybridNameBatchJob.class); + + public UpdateHybridNameBatchJob() { + setSupportedInvocationModes(Collections.singletonList(INVOCATION_MODE_LIST)); + } + + @Override + public void run() { + setCompletionStatus(0); + + try { + String mode = getInvocationContext().getMode(); + + if (mode.equalsIgnoreCase(INVOCATION_MODE_LIST)) { + List csids = getInvocationContext().getListCSIDs().getCsid(); + setResults(updateHybridNames(csids)); + } else { + throw new Exception("Unsupported invocation mode: " + mode); + } + + } catch (Exception e) { + setCompletionStatus(STATUS_ERROR); + setErrorInfo(new InvocationError(INT_ERROR_STATUS, e.getMessage())); + } + } + + private InvocationResults updateHybridNames(List csids) throws Exception { + InvocationResults results = new InvocationResults(); + int numAffected = 0; + + for (String csid : csids) { + updateRecord(csid); + + numAffected += 1; + } + + results.setNumAffected(numAffected); + return results; + } + + private void updateRecord(String csid) throws Exception { + PoxPayloadOut currentRecord = findCollectionObjectByCsid(csid); + + // Get the GroupList element + Element naturalHistoryElement = currentRecord.getPart("collectionobjects_naturalhistory").asElement(); + Element taxonIdentGroupList = null; + Iterator childIterator = naturalHistoryElement.elementIterator(); + + // so now we have our termGroupList element + while (childIterator.hasNext()) { + Element candidateElement = childIterator.next(); + + // note: the candidateElement at some point is the "hybridParentGroupList" + if (candidateElement.getName().contains("taxonomicIdentGroupList")) { + taxonIdentGroupList = candidateElement; + } + } + + if (taxonIdentGroupList == null) { + throw new Exception("No lists to update on record with csid " + csid); + } + + ArrayList updatedTermGroups = new ArrayList(); + childIterator = taxonIdentGroupList.elementIterator(); + + // now to iterate through each term group, and key and prepare the payload, put it in a list + while (childIterator.hasNext()) { + Element termGroupElement = childIterator.next(); + updateElement(termGroupElement); + } + String payload = "" + + "" + + "" + + taxonIdentGroupList.asXML() + + "" + + ""; + + ResourceMap resource = getResourceMap(); + NuxeoBasedResource collectionObjectResource = (NuxeoBasedResource) resource.get(CollectionObjectClient.SERVICE_NAME); + byte[] responseBytes = collectionObjectResource.update(getServiceContext(), resource, createUriInfo(), csid, payload); + + logger.debug("Batch resource: Response from CollectionObject (cataloging record) update: {}", + new String(responseBytes)); + } + + public void updateElement(Element termGroupElement) { + String taxonomicIdentHybridName = ""; + + Node hybridFlagNode = termGroupElement.selectSingleNode(TaxonConstants.HYBRID_FLAG); + String affinityTaxon = termGroupElement.selectSingleNode(TaxonConstants.AFF_TAXON).getText(); + affinityTaxon = affinityTaxon.isEmpty() ? "" : RefNameUtils.getDisplayName(affinityTaxon); + + String taxon = termGroupElement.selectSingleNode(TaxonConstants.TAXON_NAME).getText(); + taxon = taxon.isEmpty() ? "" : RefNameUtils.getDisplayName(taxon); + + + if (!hybridFlagNode.getText().equals("true")) { + if (affinityTaxon == null) { + taxonomicIdentHybridName = taxon; + } if (affinityTaxon != null) { + taxonomicIdentHybridName = affinityTaxon; + } + } else { + Iterator hybridParentGroupListIterator = termGroupElement.elementIterator(); + Element hybridParentGroupList = null; + + // get the hybrid parent group list + while (hybridParentGroupListIterator.hasNext()) { + Element candidateElement = hybridParentGroupListIterator.next(); + + if (candidateElement.getName().contains(TaxonConstants.TAXON_HYBRID_PARENT_GROUP_LIST)) { + hybridParentGroupList = candidateElement; + } + } + + List hybridParentGroup = hybridParentGroupList.selectNodes(TaxonConstants.TAXON_HYBRID_PARENT_GROUP); + + if (hybridParentGroup.size() != 2) { + return; + } + + Node firstParentNode = hybridParentGroup.get(0); + Node secondParentNode =hybridParentGroup.get(1); + + String firstParentSex = firstParentNode.selectSingleNode(TaxonConstants.TAXON_HYBRID_PARENT_QUALIF).getText(); + + Node maleParentNode = firstParentSex.equals("male") ? firstParentNode : secondParentNode; + Node femaleParentNode = firstParentSex.equals("female") ? firstParentNode : secondParentNode; + + + String maleParentName = RefNameUtils.getDisplayName(maleParentNode.selectSingleNode(TaxonConstants.TAXON_HYBRID_PARENT).getText()); + String femaleParentName = RefNameUtils.getDisplayName(femaleParentNode.selectSingleNode(TaxonConstants.TAXON_HYBRID_PARENT).getText()); + + int maleParentGenusIndex = maleParentName.indexOf(' '); + + String maleParentGenus = maleParentGenusIndex != -1 ? maleParentName.substring(0, maleParentGenusIndex) : maleParentName; + String femaleParentGenus = femaleParentName.indexOf(' ') != -1 ? femaleParentName.substring(0, femaleParentName.indexOf(' ')) : femaleParentName; + + String maleParentRest = maleParentGenusIndex != -1 ? maleParentName.substring(maleParentGenusIndex + 1) : maleParentName; + + if (affinityTaxon == null || affinityTaxon.isEmpty()) { + if (femaleParentName.isEmpty()) { + taxonomicIdentHybridName = ""; + } else if (maleParentName.isEmpty()) { + taxonomicIdentHybridName = ""; + } else if (femaleParentGenus.equals(maleParentGenus)) { + taxonomicIdentHybridName = femaleParentName + " × " + maleParentGenus.charAt(0) + ". " + maleParentRest; + } else { + taxonomicIdentHybridName = femaleParentName + " × " + maleParentName; + } + } else { + if (maleParentName.isEmpty()) { + taxonomicIdentHybridName = ""; + } else if (femaleParentGenus.equals(maleParentGenus)) { + taxonomicIdentHybridName = affinityTaxon + " × " + maleParentGenus.charAt(0) + ". " + maleParentRest; + } else { + taxonomicIdentHybridName = affinityTaxon + " × " + maleParentName; + } + } + } + + Node hybridNameNode = termGroupElement.selectSingleNode(TaxonConstants.TAXON_HYBRID_NAME); + hybridNameNode.setText(taxonomicIdentHybridName) ; + } +} \ No newline at end of file diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateObjectFieldsBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateObjectFieldsBatchJob.java new file mode 100644 index 000000000..9c7f7b335 --- /dev/null +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateObjectFieldsBatchJob.java @@ -0,0 +1,136 @@ +package org.collectionspace.services.batch.nuxeo.botgarden; + +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.List; +import java.util.HashMap; +import java.util.ArrayList; + +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; +import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.common.NuxeoBasedResource; +import org.collectionspace.services.common.invocable.InvocationContext; +import org.collectionspace.services.common.invocable.InvocationResults; +import org.collectionspace.services.common.invocable.InvocationContext.Params.Param; +import org.collectionspace.services.common.ResourceMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This batch job updates certain fields in collectionobject records, specified as invocation + * parameters. Supported fields include: sex in collectionobjects_common, and any top-level + * (non-repeating) field in collectionobjects_botgarden. + * + * It can be invoked in either list or single mode. + * @author Cesar Villalobos + * + */ +public class UpdateObjectFieldsBatchJob extends AbstractBatchJob { + final Logger logger = LoggerFactory.getLogger(UpdateObjectFieldsBatchJob.class); + + public UpdateObjectFieldsBatchJob() { + this.setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST)); + } + + @Override + public void run() { + setCompletionStatus(STATUS_MIN_PROGRESS); + + try { + InvocationContext ctx = getInvocationContext(); + String mode = ctx.getMode(); + + ArrayList csids = new ArrayList(); + + if (mode.equalsIgnoreCase(INVOCATION_MODE_SINGLE)) { + String csid = ctx.getSingleCSID(); + csids.add(csid); + } else if (mode.equalsIgnoreCase(INVOCATION_MODE_LIST)) { + csids.addAll(ctx.getListCSIDs().getCsid()); + } else { + throw new Exception("Unsupported invocation mode: " + mode); + } + + HashMap fieldsToValues = this.getValues(); + + if (fieldsToValues.isEmpty()) { + throw new Exception("There is nothing to update. Aborting..."); + } + + setResults(updateRecords(csids, fieldsToValues)); + setCompletionStatus(STATUS_COMPLETE); + } catch (Exception e) { + setCompletionStatus(STATUS_ERROR); + setErrorInfo(new InvocationError(INT_ERROR_STATUS, e.getMessage())); + } + } + + public InvocationResults updateRecords(List csids, HashMap values) { + InvocationResults results = new InvocationResults(); + int numAffected = 0; + + try { + for (String csid : csids) { + updateRecord(csid, values); + numAffected += 1; + } + } catch (Exception e) { + setErrorInfo(new InvocationError(INT_ERROR_STATUS, e.getMessage())); + } + + String userNote = ""; + + results.setNumAffected(numAffected); + results.setUserNote(userNote); + + return results; + } + + public void updateRecord(String csid, HashMap values) throws URISyntaxException { + StringBuilder valuesToUpdate = new StringBuilder(); + String sex = ""; + + for (String key : values.keySet()) { + if (key.equals("sex")) { + sex = getFieldXml(key, values.get(key)); + } else { + valuesToUpdate.append(getFieldXml(key, values.get(key))); + } + } + + String payload = "" + + "" + + "" + + sex + "" + + "" + + valuesToUpdate + + "" + + ""; + + + ResourceMap resource = getResourceMap(); + NuxeoBasedResource collectionObjectResource = (NuxeoBasedResource) resource.get(CollectionObjectClient.SERVICE_NAME); + byte[] responseBytes = collectionObjectResource.update(getServiceContext(), resource, createUriInfo(), csid, payload); + + logger.debug("Batch resource: Response from CollectionObject (cataloging record) update: {}", + new String(responseBytes)); + } + + public HashMap getValues() { + HashMap results = new HashMap(); + for (Param param : this.getParams()) { + if (param.getKey() != null) { + String value = param.getValue(); + if (value != null && !value.isEmpty()) { + results.put(param.getKey(), param.getValue()); + } + } + } + return results; + } +} diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateRareFlagBatchJob.java similarity index 92% rename from services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java rename to services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateRareFlagBatchJob.java index c91f32f11..0fb530678 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/botgarden/UpdateRareFlagBatchJob.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.batch.nuxeo; +package org.collectionspace.services.batch.nuxeo.botgarden; import java.net.URISyntaxException; import java.util.Arrays; @@ -8,18 +8,21 @@ import java.util.List; import javax.ws.rs.WebApplicationException; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.nuxeo.AbstractBatchJob; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.TaxonomyAuthorityClient; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants; import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants; +import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectNaturalHistoryConstants; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.api.RefName; import org.collectionspace.services.common.invocable.InvocationContext.ListCSIDs; import org.collectionspace.services.common.invocable.InvocationResults; -import org.collectionspace.services.taxonomy.nuxeo.TaxonBotGardenConstants; +import org.collectionspace.services.taxonomy.nuxeo.TaxonNaturalHistoryConstants; import org.collectionspace.services.taxonomy.nuxeo.TaxonConstants; + import org.dom4j.DocumentException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +33,7 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { // All conservation categories are considered rare, except for ones that start with the following prefixes. public static final List NON_RARE_CONSERVATION_CATEGORY_PREFIXES = Arrays.asList("none", "DD ", "LC ", "LR (lc) "); - private static final String[] TAXON_FIELD_NAME_PARTS = CollectionObjectBotGardenConstants.TAXON_FIELD_NAME.split("\\/"); + private static final String[] TAXON_FIELD_NAME_PARTS = CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME.split("\\/"); private static final String TAXON_FIELD_NAME_WITHOUT_PATH = TAXON_FIELD_NAME_PARTS[TAXON_FIELD_NAME_PARTS.length - 1]; public UpdateRareFlagBatchJob() { @@ -120,7 +123,7 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { String vocabularyShortId = item.getParentShortIdentifier(); List collectionObjectCsids = findReferencingCollectionObjects(TaxonomyAuthorityClient.SERVICE_NAME, vocabularyShortId, taxonCsid, - CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME + ":" + TAXON_FIELD_NAME_WITHOUT_PATH); + CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME + ":" + TAXON_FIELD_NAME_WITHOUT_PATH); long numFound = 0; long numAffected = 0; @@ -128,8 +131,8 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { // Filter out results where the taxon is referenced in the correct field, but isn't the primary value. PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid); - String primaryTaxonRefName = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.TAXON_FIELD_NAME); + String primaryTaxonRefName = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME); if (primaryTaxonRefName.equals(taxonRefName)) { numFound++; @@ -190,10 +193,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { logger.debug("skipping deleted collectionobject: " + collectionObjectCsid); } else { - String taxonRefName = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.TAXON_SCHEMA_NAME, - CollectionObjectBotGardenConstants.TAXON_FIELD_NAME); - String oldIsRare = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.RARE_FLAG_SCHEMA_NAME, - CollectionObjectBotGardenConstants.RARE_FLAG_FIELD_NAME); + String taxonRefName = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.TAXON_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.TAXON_FIELD_NAME); + String oldIsRare = getFieldValue(collectionObjectPayload, CollectionObjectNaturalHistoryConstants.RARE_FLAG_SCHEMA_NAME, + CollectionObjectNaturalHistoryConstants.RARE_FLAG_FIELD_NAME); if (oldIsRare == null) { oldIsRare = ""; @@ -214,8 +217,8 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { if (taxonPayload != null) { // UCBG-369: Changing this so that it only checks the primary conservation category. - String conservationCategory = getFieldValue(taxonPayload, TaxonBotGardenConstants.CONSERVATION_CATEGORY_SCHEMA_NAME, - TaxonBotGardenConstants.CONSERVATION_CATEGORY_FIELD_NAME); + String conservationCategory = getFieldValue(taxonPayload, TaxonNaturalHistoryConstants.CONSERVATION_CATEGORY_SCHEMA_NAME, + TaxonNaturalHistoryConstants.CONSERVATION_CATEGORY_FIELD_NAME); if (isRare(conservationCategory)) { newIsRare = "true"; diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java index 5bd08415a..8324310e8 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java @@ -76,6 +76,7 @@ public interface CollectionSpaceClient - org.collectionspace.services.collectionobject.nuxeo.BotGardenCollectionObjectValidatorHandler + org.collectionspace.services.collectionobject.nuxeo.validators.BotGardenCollectionObjectValidatorHandler diff --git a/services/movement/service/src/main/java/org/collectionspace/services/movement/nuxeo/MovementBotGardenConstants.java b/services/movement/service/src/main/java/org/collectionspace/services/movement/nuxeo/MovementBotGardenConstants.java index 0aea05b37..8468ac89f 100644 --- a/services/movement/service/src/main/java/org/collectionspace/services/movement/nuxeo/MovementBotGardenConstants.java +++ b/services/movement/service/src/main/java/org/collectionspace/services/movement/nuxeo/MovementBotGardenConstants.java @@ -12,15 +12,20 @@ public class MovementBotGardenConstants { public static final String BOTGARDEN_PROFILE_NAME = MovementClient.BOTGARDEN_PROFILE_NAME; public static final String BOTGARDEN_SCHEMA_NAME = MovementClient.SERVICE_NAME + CollectionSpaceClient.PART_LABEL_SEPARATOR + BOTGARDEN_PROFILE_NAME; + public static final String PREVIOUS_LOCATION_SCHEMA_NAME = BOTGARDEN_SCHEMA_NAME; + public static final String PREVIOUS_LOCATION_FIELD_NAME = "previousLocation"; + public static final String ACTION_CODE_SCHEMA_NAME = MovementConstants.COMMON_SCHEMA_NAME; public static final String ACTION_CODE_FIELD_NAME = "reasonForMove"; public static final String ACTION_DATE_SCHEMA_NAME = MovementConstants.COMMON_SCHEMA_NAME; public static final String ACTION_DATE_FIELD_NAME = "locationDate"; - - public static final String DEAD_ACTION_CODE = "Dead"; - public static final String REVIVED_ACTION_CODE = "Revived"; - public static final String OTHER_ACTION_CODE = "Other"; + + // See CollectionSpace wiki documentation for "RefName" values + // https://collectionspace.atlassian.net/wiki/spaces/DOC/pages/2754224504/RefName + public static final String DEAD_ACTION_CODE = "urn:NID:NAMESPACE:vocabularies:name(actionCode):item:name(actCode00)"; + public static final String REVIVED_ACTION_CODE = "urn:NID:NAMESPACE:vocabularies:name(actionCode):item:name(actCode06)"; + public static final String OTHER_ACTION_CODE = "urn:NID:NAMESPACE:vocabularies:name(actionCode):item:name(actCode05)"; public static final String LABEL_REQUESTED_SCHEMA_NAME = BOTGARDEN_SCHEMA_NAME; public static final String LABEL_REQUESTED_FIELD_NAME = "labelRequested"; diff --git a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonConstants.java b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonConstants.java index ed2ac881f..1bf8f2b70 100644 --- a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonConstants.java +++ b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonConstants.java @@ -52,5 +52,14 @@ public class TaxonConstants { public final static String REFNAME_FIELD_NAME = "refName"; public static final String WORKFLOW_STATE_SCHEMA_NAME = CORE_SCHEMA_NAME; - public static final String WORKFLOW_STATE_FIELD_NAME = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE; //"workflowState"; + public static final String WORKFLOW_STATE_FIELD_NAME = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE; //"workflowState"; + + public static final String TAXON_NAME = "taxon"; + public static final String TAXON_HYBRID_PARENT_GROUP_LIST = "taxonomicIdentHybridParentGroupList"; + public static final String TAXON_HYBRID_PARENT_GROUP = "taxonomicIdentHybridParentGroup"; + public static final String TAXON_HYBRID_PARENT_QUALIF = "taxonomicIdentHybridParentQualifier"; + public static final String TAXON_HYBRID_PARENT = "taxonomicIdentHybridParent"; + public static final String TAXON_HYBRID_NAME = "taxonomicIdentHybridName"; + public static final String HYBRID_FLAG = "hybridFlag"; + public static final String AFF_TAXON = "affinityTaxon"; } diff --git a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonBotGardenConstants.java b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonNaturalHistoryConstants.java similarity index 95% rename from services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonBotGardenConstants.java rename to services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonNaturalHistoryConstants.java index 62554cbd3..5299ddc1c 100644 --- a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonBotGardenConstants.java +++ b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonNaturalHistoryConstants.java @@ -3,7 +3,7 @@ package org.collectionspace.services.taxonomy.nuxeo; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.TaxonomyAuthorityClient; -public class TaxonBotGardenConstants { +public class TaxonNaturalHistoryConstants { public static final String NATURALHISTORY_SCHEMA_NAME = TaxonomyAuthorityClient.SERVICE_ITEM_NAME + CollectionSpaceClient.PART_LABEL_SEPARATOR + CollectionSpaceClient.NATURALHISTORY_EXTENSION_NAME; public final static String CONSERVATION_CATEGORY_SCHEMA_NAME = NATURALHISTORY_SCHEMA_NAME; diff --git a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonomyAuthorityConstants.java b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonomyAuthorityConstants.java index 15f8b9108..8a194aa7b 100644 --- a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonomyAuthorityConstants.java +++ b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonomyAuthorityConstants.java @@ -28,7 +28,7 @@ package org.collectionspace.services.taxonomy.nuxeo; */ public class TaxonomyAuthorityConstants { - public final static String NUXEO_DOCTYPE = "TaxonomyAuthority"; + public final static String NUXEO_DOCTYPE = "Taxonomyauthority"; public final static String NUXEO_SCHEMA_NAME = "taxonomyauthority"; public final static String NUXEO_DC_TITLE = "CollectionSpace-TaxonomyAuthority"; } -- 2.47.3