From 54e6e9dda9daf4ea065b832d336a86df128878ba Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 28 Apr 2020 15:46:15 -0700 Subject: [PATCH] DRYD-841, DRYD-855: Merging in UCB contributions to post-v6.0 master branch. --- .../common/vocabulary/AuthorityResource.java | 8 + services/batch/service/pom.xml | 12 ++ .../services/batch/BatchInvocable.java | 2 + .../batch/nuxeo/AbstractBatchJob.java | 90 +++++---- .../nuxeo/BatchDocumentModelHandler.java | 2 +- .../ClearLocationLabelRequestBatchJob.java | 50 ++--- .../ClearPotTagLabelRequestBatchJob.java | 4 +- .../ClearVoucherLabelRequestBatchJob.java | 4 +- .../nuxeo/CreateAndLinkLoanOutBatchJob.java | 6 + .../batch/nuxeo/CreateVoucherBatchJob.java | 14 +- .../nuxeo/FormatVoucherNameBatchJob.java | 4 +- .../nuxeo/MergeAuthorityItemsBatchJob.java | 8 +- .../batch/nuxeo/ReindexFullTextBatchJob.java | 85 ++++++++- .../services/batch/nuxeo/TestBatchJob.java | 7 +- .../batch/nuxeo/UpdateDeadFlagBatchJob.java | 2 +- .../nuxeo/UpdateObjectLocationBatchJob.java | 27 ++- .../batch/nuxeo/UpdateRareFlagBatchJob.java | 31 ++-- .../services/common/api/RefNameUtils.java | 31 +++- ...tMultiPartCollectionSpaceResourceImpl.java | 10 + .../services/common/NuxeoBasedResource.java | 3 +- .../common/security/SecurityContextImpl.java | 2 +- .../vocabulary/LazyAuthorityRefDocList.java | 8 +- .../vocabulary/RefNameServiceUtils.java | 172 +++++++++++++----- .../services/nuxeo/util/NuxeoUtils.java | 3 +- .../src/main/resources/log4j2-surefire.xml | 34 ++++ .../src/main/resources/log4j2-surefire.xml | 34 ++++ .../nuxeo/ReportDocumentModelHandler.java | 19 +- .../vocabulary/nuxeo/VocabularyConstants.java | 8 + 28 files changed, 514 insertions(+), 166 deletions(-) create mode 100644 services/loanout/client/src/main/resources/log4j2-surefire.xml create mode 100644 services/person/client/src/main/resources/log4j2-surefire.xml diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index b29414e99..d3c47014b 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -1335,6 +1335,14 @@ public abstract class AuthorityResource return authRefDocList; } + public AuthorityRefDocList getReferencingObjects( + ServiceContext existingContext, + String parentspecifier, + String itemspecifier, + UriInfo uriInfo) throws Exception { + return getReferencingObjects(existingContext, parentspecifier, itemspecifier, uriInfo, PAGE_NUM_FROM_QUERYPARAMS, PAGE_SIZE_FROM_QUERYPARAMS, true, true); + } + public AuthorityRefDocList getReferencingObjects( ServiceContext existingContext, String parentspecifier, diff --git a/services/batch/service/pom.xml b/services/batch/service/pom.xml index 4330feab8..b5aa244ab 100644 --- a/services/batch/service/pom.xml +++ b/services/batch/service/pom.xml @@ -139,7 +139,19 @@ org.collectionspace.services.taxonomy.service ${project.version} + + org.collectionspace.services + org.collectionspace.services.vocabulary.service + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.group.service + ${project.version} + + + junit junit diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java index d608b39f5..2942a85c0 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java @@ -15,4 +15,6 @@ public interface BatchInvocable extends Invocable { public CoreSessionInterface getRepoSession(); public String getTenantId(); + + public void run(BatchCommon batchCommon); } diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/AbstractBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/AbstractBatchJob.java index 3762dfa47..497de9e07 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/AbstractBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/AbstractBatchJob.java @@ -7,6 +7,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import javax.ws.rs.core.PathSegment; import javax.ws.rs.core.Response; @@ -15,6 +17,7 @@ import javax.ws.rs.core.UriInfo; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.BatchCommon; import org.collectionspace.services.batch.AbstractBatchInvocable; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.CollectionSpaceClient; @@ -59,6 +62,19 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { private Map authorityServiceNamesByDocType; + @SuppressWarnings("unchecked") + protected static Set convertListToSet(List list) + { + // create a set from the List + return (Set) list.stream().collect(Collectors.toSet()); + } + + @Override + public void run(BatchCommon batchCommon) { + String errMsg = String.format("%s class does not support run(BatchCommon batchCommon) method.", getClass().getName()); + throw new java.lang.UnsupportedOperationException(errMsg); + } + protected String getFieldXml(Map fields, String fieldName) { return getFieldXml(fieldName, fields.get(fieldName)); } @@ -95,7 +111,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(RelationClient.SERVICE_NAME); - Response response = resource.create(getResourceMap(), null, createRelationPayload); + Response response = resource.create(getServiceContext(), getResourceMap(), null, createRelationPayload); if (response.getStatus() == CREATED_STATUS) { relationCsid = CollectionSpaceClientUtils.extractId(response); @@ -121,7 +137,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { */ protected List findRelated(String subjectCsid, String subjectDocType, String predicate, String objectCsid, String objectDocType) throws URISyntaxException { RelationResource relationResource = (RelationResource) getResourceMap().get(RelationClient.SERVICE_NAME); - RelationsCommonList relationList = relationResource.getList(createRelationSearchUriInfo(subjectCsid, subjectDocType, predicate, objectCsid, objectDocType)); + RelationsCommonList relationList = relationResource.getList(getServiceContext(), createRelationSearchUriInfo(subjectCsid, subjectDocType, predicate, objectCsid, objectDocType)); return relationList.getRelationListItem(); } @@ -213,7 +229,11 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { String csid = uriParts[4]; if (items.equals("items")) { - payload = findAuthorityItemByCsid(serviceName, vocabularyCsid, csid); + try { + payload = findAuthorityItemByCsid(serviceName, vocabularyCsid, csid); + } catch (Exception e) { + payload = null; + } } } @@ -222,10 +242,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { protected PoxPayloadOut findByCsid(String serviceName, String csid) throws URISyntaxException, DocumentException { NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(serviceName); - byte[] outputBytes = (byte[]) resource.get(null, null, createUriInfo(), csid).getEntity(); - - PoxPayloadOut payload = new PoxPayloadOut(outputBytes); - + PoxPayloadOut payload = resource.getWithParentCtx(getServiceContext(), csid); return payload; } @@ -244,11 +261,11 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { protected List findAll(String serviceName, int pageSize, int pageNum, String sortBy) throws URISyntaxException, DocumentException { NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(serviceName); - return findAll(resource, pageSize, pageNum, null); + return findAll(resource, pageSize, pageNum, sortBy); } protected List findAll(NuxeoBasedResource resource, int pageSize, int pageNum, String sortBy) throws URISyntaxException, DocumentException { - AbstractCommonList list = resource.getList(createPagedListUriInfo(resource.getServiceName(), pageNum, pageSize, sortBy)); + AbstractCommonList list = resource.getList(getServiceContext(), createPagedListUriInfo(resource.getServiceName(), pageNum, pageSize, sortBy)); List csids = new ArrayList(); if (list instanceof RelationsCommonList) { @@ -282,7 +299,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { } protected List getVocabularyCsids(AuthorityResource resource) throws URISyntaxException { - AbstractCommonList vocabularyList = resource.getAuthorityList(createDeleteFilterUriInfo()); + AbstractCommonList vocabularyList = resource.getAuthorityList(getServiceContext(), createDeleteFilterUriInfo()); List csids = new ArrayList(); for (AbstractCommonList.ListItem item : vocabularyList.getListItem()) { @@ -297,18 +314,18 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { return csids; } - protected List findAllAuthorityItems(String serviceName, String vocabularyCsid, int pageSize, int pageNum) throws URISyntaxException, DocumentException { + protected List findAllAuthorityItems(String serviceName, String vocabularyCsid, int pageSize, int pageNum) throws Exception { return findAllAuthorityItems(serviceName, vocabularyCsid, pageSize, pageNum, null); } - protected List findAllAuthorityItems(String serviceName, String vocabularyCsid, int pageSize, int pageNum, String sortBy) throws URISyntaxException, DocumentException { + protected List findAllAuthorityItems(String serviceName, String vocabularyCsid, int pageSize, int pageNum, String sortBy) throws Exception { AuthorityResource resource = (AuthorityResource) getResourceMap().get(serviceName); return findAllAuthorityItems(resource, vocabularyCsid, pageSize, pageNum, sortBy); } - protected List findAllAuthorityItems(AuthorityResource resource, String vocabularyCsid, int pageSize, int pageNum, String sortBy) throws URISyntaxException, DocumentException { - AbstractCommonList list = resource.getAuthorityItemList(vocabularyCsid, createPagedListUriInfo(resource.getServiceName(), pageNum, pageSize, sortBy)); + protected List findAllAuthorityItems(AuthorityResource resource, String vocabularyCsid, int pageSize, int pageNum, String sortBy) throws Exception { + AbstractCommonList list = resource.getAuthorityItemList(getServiceContext(), vocabularyCsid, createPagedListUriInfo(resource.getServiceName(), pageNum, pageSize, sortBy)); List csids = new ArrayList(); for (AbstractCommonList.ListItem item : list.getListItem()) { @@ -333,7 +350,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { try { itemPayload = findAuthorityItemByCsid(serviceName, vocabularyCsid, csid); - } catch (CSWebApplicationException e) { + } catch (Exception e) { itemPayload = null; } @@ -345,11 +362,9 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { return itemPayload; } - protected PoxPayloadOut findAuthorityItemByCsid(String serviceName, String vocabularyCsid, String csid) throws URISyntaxException, DocumentException { + protected PoxPayloadOut findAuthorityItemByCsid(String serviceName, String vocabularyCsid, String csid) throws URISyntaxException, DocumentException, Exception { AuthorityResource resource = (AuthorityResource) getResourceMap().get(serviceName); - byte[] response = resource.getAuthorityItem(null, createDeleteFilterUriInfo(), getResourceMap(), vocabularyCsid, csid); - - PoxPayloadOut payload = new PoxPayloadOut(response); + PoxPayloadOut payload = resource.getAuthorityItemWithExistingContext(getServiceContext(), createDeleteFilterUriInfo(), getResourceMap(), vocabularyCsid, csid); return payload; } @@ -373,37 +388,42 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { return authorityServiceNamesByDocType.get(authorityDocType); } + protected PoxPayloadOut findTaxonByCsid(String csid, String vocabularyCsid) throws URISyntaxException, DocumentException, Exception { + return findAuthorityItemByCsid(TaxonomyAuthorityClient.SERVICE_NAME, vocabularyCsid, csid); + } + protected PoxPayloadOut findTaxonByCsid(String csid) throws URISyntaxException, DocumentException { return findAuthorityItemByCsid(TaxonomyAuthorityClient.SERVICE_NAME, csid); } - - protected PoxPayloadOut findAuthorityItemByShortId(String serviceName, String vocabularyShortId, String itemShortId) throws URISyntaxException, DocumentException { + + protected PoxPayloadOut findAuthorityItemByShortId(String serviceName, String vocabularyShortId, String itemShortId) throws URISyntaxException, DocumentException, Exception { AuthorityResource resource = (AuthorityResource) getResourceMap().get(serviceName); - byte[] response = resource.getAuthorityItem(null, createDeleteFilterUriInfo(), getResourceMap(), "urn:cspace:name(" + vocabularyShortId + ")", "urn:cspace:name(" + itemShortId + ")"); - - PoxPayloadOut payload = new PoxPayloadOut(response); + PoxPayloadOut payload = resource.getAuthorityItemWithExistingContext(getServiceContext(), createDeleteFilterUriInfo(), getResourceMap(), + "urn:cspace:name(" + vocabularyShortId + ")", "urn:cspace:name(" + itemShortId + ")"); return payload; } - protected PoxPayloadOut findAuthorityItemByRefName(String serviceName, String refName) throws URISyntaxException, DocumentException { + protected PoxPayloadOut findAuthorityItemByRefName(String serviceName, String refName) throws URISyntaxException, DocumentException, Exception { RefName.AuthorityItem item = RefName.AuthorityItem.parse(refName); - + if (item == null) { + return null; + } String vocabularyShortId = item.getParentShortIdentifier(); String itemShortId = item.getShortIdentifier(); return findAuthorityItemByShortId(serviceName, vocabularyShortId, itemShortId); } - protected PoxPayloadOut findPlaceByRefName(String refName) throws URISyntaxException, DocumentException { + protected PoxPayloadOut findPlaceByRefName(String refName) throws URISyntaxException, DocumentException, Exception { return findAuthorityItemByRefName(PlaceAuthorityClient.SERVICE_NAME, refName); } - protected PoxPayloadOut findTaxonByRefName(String refName) throws URISyntaxException, DocumentException { + protected PoxPayloadOut findTaxonByRefName(String refName) throws URISyntaxException, DocumentException, Exception { return findAuthorityItemByRefName(TaxonomyAuthorityClient.SERVICE_NAME, refName); } - protected List findReferencingFields(String serviceName, String parentCsid, String csid, String type, int pageNum, int pageSize) throws URISyntaxException { + protected List findReferencingFields(String serviceName, String parentCsid, String csid, String type, int pageNum, int pageSize) throws Exception { AuthorityResource resource = (AuthorityResource) getResourceMap().get(serviceName); // The pageNum and pageSize params don't work right for the refobj request. @@ -411,7 +431,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { // contain repeats of items already returned on the previous page. Any // code that uses this function should be aware of this. - AuthorityRefDocList refDocList = resource.getReferencingObjects(parentCsid, csid, createRefSearchFilterUriInfo(type, pageNum, pageSize)); + AuthorityRefDocList refDocList = resource.getReferencingObjects(getServiceContext(), parentCsid, csid, createRefSearchFilterUriInfo(type, pageNum, pageSize)); return refDocList.getAuthorityRefDocItem(); } @@ -433,9 +453,9 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { * Only records that reference the given item in the specified field are returned. * If null, returns records that reference the item in any field. * @return A List containing the csids of referencing records. - * @throws URISyntaxException + * @throws Exception */ - protected List findReferencingObjects(String serviceName, String parentCsid, String csid, String type, String sourceField) throws URISyntaxException { + protected List findReferencingObjects(String serviceName, String parentCsid, String csid, String type, String sourceField) throws Exception { logger.debug("findReferencingObjects serviceName=" + serviceName + " parentCsid=" + parentCsid + " csid=" + csid + " type=" + type + " sourceField=" + sourceField); List items = findReferencingFields(serviceName, parentCsid, csid, type, 0, 0); @@ -456,7 +476,7 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { return csids; } - protected List findReferencingObjects(String serviceName, String csid, String type, String sourceField) throws URISyntaxException, DocumentException { + protected List findReferencingObjects(String serviceName, String csid, String type, String sourceField) throws Exception { logger.debug("findReferencingObjects serviceName=" + serviceName + " csid=" + csid + " type=" + type + " sourceField=" + sourceField); List vocabularyCsids = getVocabularyCsids(serviceName); @@ -479,11 +499,11 @@ public abstract class AbstractBatchJob extends AbstractBatchInvocable { return findReferencingObjects(serviceName, parentCsid, csid, type, sourceField); } - protected List findReferencingCollectionObjects(String serviceName, String csid, String sourceField) throws URISyntaxException, DocumentException { + protected List findReferencingCollectionObjects(String serviceName, String csid, String sourceField) throws Exception { return findReferencingObjects(serviceName, csid, ServiceBindingUtils.SERVICE_TYPE_OBJECT, sourceField); } - protected List findReferencingCollectionObjects(String serviceName, String vocabularyShortId, String csid, String sourceField) throws URISyntaxException, DocumentException { + protected List findReferencingCollectionObjects(String serviceName, String vocabularyShortId, String csid, String sourceField) throws Exception { return findReferencingObjects(serviceName, "urn:cspace:name(" + vocabularyShortId + ")", csid, ServiceBindingUtils.SERVICE_TYPE_OBJECT, sourceField); } diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java index d02241f6f..096e4033b 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java @@ -296,7 +296,7 @@ public class BatchDocumentModelHandler extends NuxeoDocumentModelHandler movementCsids = findLabelRequests(); InvocationResults results = null; - + if (movementCsids.size() > 0) { results = clearLabelRequests(movementCsids); } @@ -53,37 +56,40 @@ public class ClearLocationLabelRequestBatchJob extends AbstractBatchJob { results = new InvocationResults(); results.setUserNote("No label requests found"); } - + return results; } - - public InvocationResults clearLabelRequests(String movementCsid) throws URISyntaxException { + + public InvocationResults clearLabelRequests(String movementCsid) throws Exception { return clearLabelRequests(Arrays.asList(movementCsid)); } - - public InvocationResults clearLabelRequests(List movementCsids) throws URISyntaxException { + + public InvocationResults clearLabelRequests(List movementCsids) throws Exception { InvocationResults results = new InvocationResults(); long numAffected = 0; - + for (String movementCsid : movementCsids) { clearLabelRequest(movementCsid); numAffected = numAffected + 1; } - + results.setNumAffected(numAffected); results.setUserNote("Removed " + numAffected + " label " + (numAffected == 1 ? "request" : "requests")); return results; } - - private void clearLabelRequest(String movementCsid) throws URISyntaxException { + + private void clearLabelRequest(String movementCsid) throws Exception { logger.debug("clear label request: movementCsid=" + movementCsid); + + PoxPayloadOut payloadout = findAuthorityItemByRefName(VocabularyClient.SERVICE_NAME, MovementBotGardenConstants.OTHER_ACTION_CODE); + String termDisplayName = getFieldValue(payloadout, VocabularyConstants.DISPLAY_NAME_SCHEMA_NAME, VocabularyConstants.DISPLAY_NAME_FIELD_NAME); - final String updatePayload = + final String updatePayload = "" + "" + "" + - getFieldXml("reasonForMove", MovementBotGardenConstants.OTHER_ACTION_CODE) + + getFieldXml("reasonForMove", MovementBotGardenConstants.OTHER_ACTION_CODE + String.format("'%s'", termDisplayName)) + "" + "" + getFieldXml("labelRequested", MovementBotGardenConstants.LABEL_REQUESTED_NO_VALUE) + @@ -92,15 +98,15 @@ public class ClearLocationLabelRequestBatchJob extends AbstractBatchJob { getFieldXml("labelCount", "") + "" + ""; - + NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(MovementClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), movementCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), movementCsid, updatePayload); } - + private List findLabelRequests() throws URISyntaxException { List csids = new ArrayList(); MovementResource movementResource = (MovementResource) getResourceMap().get(MovementClient.SERVICE_NAME); - AbstractCommonList movementList = movementResource.getList(createLabelRequestSearchUriInfo()); + AbstractCommonList movementList = movementResource.getList(getServiceContext(), createLabelRequestSearchUriInfo()); for (AbstractCommonList.ListItem item : movementList.getListItem()) { for (org.w3c.dom.Element element : item.getAny()) { @@ -116,6 +122,6 @@ public class ClearLocationLabelRequestBatchJob extends AbstractBatchJob { private UriInfo createLabelRequestSearchUriInfo() throws URISyntaxException { return createKeywordSearchUriInfo(MovementBotGardenConstants.LABEL_REQUESTED_SCHEMA_NAME, MovementBotGardenConstants.LABEL_REQUESTED_FIELD_NAME, - MovementBotGardenConstants.LABEL_REQUESTED_YES_VALUE); + MovementBotGardenConstants.LABEL_REQUESTED_YES_VALUE); } -} \ No newline at end of file +} 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/ClearPotTagLabelRequestBatchJob.java index 3da909574..9448844d3 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/ClearPotTagLabelRequestBatchJob.java @@ -87,13 +87,13 @@ public class ClearPotTagLabelRequestBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(PottagClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), potTagCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), potTagCsid, updatePayload); } private List findLabelRequests() throws URISyntaxException { List csids = new ArrayList(); PottagResource potTagResource = (PottagResource) getResourceMap().get(PottagClient.SERVICE_NAME); - AbstractCommonList potTagList = potTagResource.getList(createLabelRequestSearchUriInfo()); + AbstractCommonList potTagList = potTagResource.getList(getServiceContext(), createLabelRequestSearchUriInfo()); for (AbstractCommonList.ListItem item : potTagList.getListItem()) { for (org.w3c.dom.Element element : item.getAny()) { 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/ClearVoucherLabelRequestBatchJob.java index c48c5d338..71b8119db 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/ClearVoucherLabelRequestBatchJob.java @@ -87,13 +87,13 @@ public class ClearVoucherLabelRequestBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(LoanoutClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), loanoutCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), loanoutCsid, updatePayload); } private List findLabelRequests() throws URISyntaxException { List csids = new ArrayList(); LoanoutResource loanoutResource = (LoanoutResource) getResourceMap().get(LoanoutClient.SERVICE_NAME); - AbstractCommonList loanoutList = loanoutResource.getList(createLabelRequestSearchUriInfo()); + AbstractCommonList loanoutList = loanoutResource.getList(getServiceContext(), createLabelRequestSearchUriInfo()); for (AbstractCommonList.ListItem item : loanoutList.getListItem()) { for (org.w3c.dom.Element element : item.getAny()) { diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java index 0b94859e0..bcec0088a 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java @@ -6,6 +6,7 @@ import java.util.List; import javax.ws.rs.core.Response; import org.collectionspace.services.batch.AbstractBatchInvocable; +import org.collectionspace.services.batch.BatchCommon; import org.collectionspace.services.client.CollectionSpaceClientUtils; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils; @@ -23,6 +24,11 @@ public class CreateAndLinkLoanOutBatchJob extends AbstractBatchInvocable { setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST)); } + @Override + public void run(BatchCommon batchCommon) { + run(); // Ignore batchCommon since it's not needed + } + /** * The main work logic of the batch job. Will be called after setContext. */ 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/CreateVoucherBatchJob.java index 6a23c190c..17606f1a5 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/CreateVoucherBatchJob.java @@ -72,11 +72,11 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { } } - public InvocationResults createVoucherFromCataloging(String collectionObjectCsid) throws ResourceException, URISyntaxException, DocumentException { + public InvocationResults createVoucherFromCataloging(String collectionObjectCsid) throws Exception { return createVoucherFromCataloging(collectionObjectCsid, null); } - public InvocationResults createVoucherFromCataloging(String collectionObjectCsid, String movementCsid) throws ResourceException, URISyntaxException, DocumentException { + public InvocationResults createVoucherFromCataloging(String collectionObjectCsid, String movementCsid) throws Exception { InvocationResults results = new InvocationResults(); PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid); @@ -119,14 +119,14 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { logger.debug("relations created: forwardRelationCsid=" + forwardRelationCsid + " backwardRelationCsid=" + backwardRelationCsid); results.setNumAffected(1); - results.setPrimaryURICreated("loanout.html?csid=" + voucherCsid); + results.setPrimaryURICreated("/loansout/" + voucherCsid); results.setUserNote("Voucher created"); } return results; } - private String getFieldCollectionNote(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException { + private String getFieldCollectionNote(PoxPayloadOut collectionObjectPayload) throws Exception { String placeNote = ""; String reverseFieldCollectionPlace = getReverseFieldCollectionPlace(collectionObjectPayload); @@ -159,7 +159,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { return collectionNote; } - private String getReverseFieldCollectionPlace(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException { + private String getReverseFieldCollectionPlace(PoxPayloadOut collectionObjectPayload) throws Exception { String reverseDisplayName = null; String fieldCollectionPlaceRefName = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_SCHEMA_NAME, CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_FIELD_NAME); @@ -230,7 +230,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { return annotation; } - public InvocationResults createVoucherFromCurrentLocation(String movementCsid) throws ResourceException, URISyntaxException, DocumentException { + public InvocationResults createVoucherFromCurrentLocation(String movementCsid) throws Exception { long numAffected = 0; String primaryUriCreated = null; @@ -275,7 +275,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(LoanoutClient.SERVICE_NAME); - Response response = resource.create(getResourceMap(), null, createVoucherPayload); + Response response = resource.create(getServiceContext(), getResourceMap(), null, createVoucherPayload); if (response.getStatus() == CREATED_STATUS) { voucherCsid = CollectionSpaceClientUtils.extractId(response); 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/FormatVoucherNameBatchJob.java index eb7be0a42..cbe43949f 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/FormatVoucherNameBatchJob.java @@ -104,7 +104,7 @@ public class FormatVoucherNameBatchJob extends AbstractBatchJob { private List findLabelRequests() throws URISyntaxException { List csids = new ArrayList(); LoanoutResource loanoutResource = (LoanoutResource) getResourceMap().get(LoanoutClient.SERVICE_NAME); - AbstractCommonList loanoutList = loanoutResource.getList(createLabelRequestSearchUriInfo()); + AbstractCommonList loanoutList = loanoutResource.getList(getServiceContext(), createLabelRequestSearchUriInfo()); for (AbstractCommonList.ListItem item : loanoutList.getListItem()) { for (org.w3c.dom.Element element : item.getAny()) { @@ -197,7 +197,7 @@ public class FormatVoucherNameBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(LoanoutClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), loanoutCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), loanoutCsid, updatePayload); } private UriInfo createLabelRequestSearchUriInfo() throws URISyntaxException { diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java index b0c01bbde..8faf41a10 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java @@ -129,11 +129,11 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob { } } - public InvocationResults merge(String docType, String target, String sourceCsid) throws URISyntaxException, DocumentException { + public InvocationResults merge(String docType, String target, String sourceCsid) throws Exception { return merge(docType, target, new LinkedHashSet(Arrays.asList(sourceCsid))); } - public InvocationResults merge(String docType, String target, Set sourceCsids) throws URISyntaxException, DocumentException { + public InvocationResults merge(String docType, String target, Set sourceCsids) throws Exception { logger.debug("Merging docType=" + docType + " target=" + target + " sourceCsids=" + StringUtils.join(sourceCsids, ",")); String serviceName = getAuthorityServiceNameForDocType(docType); @@ -159,7 +159,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob { return merge(docType, targetItemPayload, sourceItemPayloads); } - private InvocationResults merge(String docType, PoxPayloadOut targetItemPayload, List sourceItemPayloads) throws URISyntaxException, DocumentException { + private InvocationResults merge(String docType, PoxPayloadOut targetItemPayload, List sourceItemPayloads) throws Exception { int numAffected = 0; List userNotes = new ArrayList(); @@ -228,7 +228,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob { return results; } - private InvocationResults updateReferences(String serviceName, String inAuthority, String sourceCsid, String sourceRefName, String targetRefName) throws URISyntaxException, DocumentException { + private InvocationResults updateReferences(String serviceName, String inAuthority, String sourceCsid, String sourceRefName, String targetRefName) throws Exception { logger.debug("Updating references: serviceName=" + serviceName + " inAuthority=" + inAuthority + " sourceCsid=" + sourceCsid + " sourceRefName=" + sourceRefName + " targetRefName=" + targetRefName); String sourceDisplayName = RefNameUtils.getDisplayName(sourceRefName); diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java index 1d662e629..c130170c2 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java @@ -8,7 +8,8 @@ package org.collectionspace.services.batch.nuxeo; import java.io.File; import java.io.Serializable; import java.lang.reflect.Field; -import java.security.Principal; +import java.net.URISyntaxException; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -20,6 +21,7 @@ import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; +import org.collectionspace.services.batch.BatchCommon; import org.collectionspace.services.common.CollectionSpaceResource; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.StoredValuesUriTemplate; @@ -29,11 +31,12 @@ import org.collectionspace.services.common.invocable.InvocationContext.ListCSIDs import org.collectionspace.services.common.invocable.InvocationContext.Params.Param; import org.collectionspace.services.common.invocable.InvocationResults; import org.collectionspace.services.common.vocabulary.AuthorityResource; + +import org.dom4j.DocumentException; import org.nuxeo.ecm.core.api.AbstractSession; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.IterableQueryResult; import org.nuxeo.ecm.core.api.NuxeoException; -import org.nuxeo.ecm.core.api.NuxeoPrincipal; import org.nuxeo.ecm.core.event.EventService; import org.nuxeo.ecm.core.query.QueryFilter; import org.nuxeo.ecm.core.query.sql.NXQL; @@ -84,9 +87,77 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob { log.debug("stop file directory is " + stopFileDirectory); } + + // + // Since the ReindexFullTextBatchJob class deals with transactions differently than other batch jobs, we need to + // override this method to ensure there is an active transaction. + // + @Override + protected List getVocabularyCsids(AuthorityResource resource) throws URISyntaxException { + boolean tx = false; + if (TransactionHelper.isTransactionActive() == false) { + tx = TransactionHelper.startTransaction(); + } + + try { + return super.getVocabularyCsids(resource); + } finally { + if (tx) { + TransactionHelper.commitOrRollbackTransaction(); + } + } + } + + // + // Since the ReindexFullTextBatchJob class deals with transactions differently than other batch jobs, we need to + // override this method to ensure there is an active transaction. + // + @Override + protected List findAll(NuxeoBasedResource resource, int pageSize, int pageNum, String sortBy) + throws URISyntaxException, DocumentException { + boolean tx = false; + if (TransactionHelper.isTransactionActive() == false) { + tx = TransactionHelper.startTransaction(); + } + + try { + return super.findAll(resource, pageSize, pageNum, sortBy); + } finally { + if (tx) { + TransactionHelper.commitOrRollbackTransaction(); + } + } + } + + // + // Since the ReindexFullTextBatchJob class deals with transactions differently than other batch jobs, we need to + // override this method to ensure there is an active transaction. + // + @Override + protected List findAllAuthorityItems(AuthorityResource resource, String vocabularyCsid, int pageSize, int pageNum, String sortBy) + throws URISyntaxException, Exception { + boolean tx = false; + if (TransactionHelper.isTransactionActive() == false) { + tx = TransactionHelper.startTransaction(); + } + + try { + return super.findAllAuthorityItems(resource, vocabularyCsid, pageSize, pageNum, sortBy); + } finally { + if (tx) { + TransactionHelper.commitOrRollbackTransaction(); + } + } + } + @Override public void run() { + run(null); + } + + @Override + public void run(BatchCommon batchCommon) { setCompletionStatus(STATUS_MIN_PROGRESS); numAffected = 0; @@ -175,6 +246,16 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob { } } + // + // If docTypes is empty, we should use the list from the resource/payload + // + if (docTypes.isEmpty() == true && batchCommon != null) { + List payloadDocTypes = batchCommon.getForDocTypes().getForDocType(); + if (payloadDocTypes != null && !payloadDocTypes.isEmpty()) { + docTypes = convertListToSet(payloadDocTypes); + } + } + initResourceMap(); reindexDocuments(docTypes); } diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/TestBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/TestBatchJob.java index 0358cf9f1..58e75f036 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/TestBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/TestBatchJob.java @@ -3,6 +3,7 @@ package org.collectionspace.services.batch.nuxeo; import java.util.Arrays; import org.collectionspace.services.batch.AbstractBatchInvocable; +import org.collectionspace.services.batch.BatchCommon; public class TestBatchJob extends AbstractBatchInvocable { @@ -16,5 +17,9 @@ public class TestBatchJob extends AbstractBatchInvocable { public void run() { // An empty batch job used just for testing. } - + + @Override + public void run(BatchCommon batchCommon) { + // An empty batch job used just for testing. + } } 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/UpdateDeadFlagBatchJob.java index c1b2f3849..34c8e434d 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/UpdateDeadFlagBatchJob.java @@ -229,6 +229,6 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(CollectionObjectClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), collectionObjectCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), collectionObjectCsid, updatePayload); } } diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java index ee1d2011d..e5b97d128 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java @@ -14,6 +14,7 @@ import javax.ws.rs.core.PathSegment; import javax.ws.rs.core.UriInfo; import org.collectionspace.services.batch.AbstractBatchInvocable; +import org.collectionspace.services.batch.BatchCommon; import org.collectionspace.services.client.AbstractCommonListUtils; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.IClientQueryParams; @@ -74,6 +75,12 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { INVOCATION_MODE_GROUP, INVOCATION_MODE_NO_CONTEXT)); } + @Override + public void run(BatchCommon batchCommon) { + String errMsg = String.format("%s class does not support run(BatchCommon batchCommon) method.", getClass().getName()); + throw new java.lang.UnsupportedOperationException(errMsg); + } + /** * The main work logic of the batch job. Will be called after setContext. */ @@ -395,19 +402,23 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { logger.trace("Update payload: " + "\n" + collectionObjectUpdatePayload); } + // + // Update the record and save the response for debugging message + // UriInfo uriInfo = this.setupQueryParamForUpdateRecords(); // Determines if we'll updated the updateAt and updatedBy core values + byte[] responseBytes = collectionObjectResource.update(getServiceContext(), resourcemap, uriInfo, collectionObjectCsid, + collectionObjectUpdatePayload); + numUpdated++; + if (logger.isDebugEnabled()) { - byte[] responseBytes = collectionObjectResource.update(resourcemap, uriInfo, collectionObjectCsid, - collectionObjectUpdatePayload); logger.debug(String.format("Batch resource: Resonse from collectionobject (cataloging record) update: %s", new String(responseBytes))); } - numUpdated++; if (logger.isTraceEnabled()) { logger.trace("Computed current location value for CollectionObject " + collectionObjectCsid + " was set to " + computedCurrentLocation); - } + return numUpdated; } @@ -434,7 +445,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { PoxPayloadOut result = null; try { - result = resource.getResourceFromCsid(null, createUriInfo(), csid); + result = resource.getWithParentCtx(getServiceContext(), csid); } catch (Exception e) { String msg = String.format("UpdateObjectLocation batch job could find/get resource CSID='%s' of type '%s'", csid, resource.getServiceName()); @@ -521,7 +532,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { throws URISyntaxException, DocumentException { boolean isDeleted = false; - byte[] workflowResponse = resource.getWorkflow(createUriInfo(), collectionObjectCsid); + byte[] workflowResponse = resource.getWorkflowWithExistingContext(getServiceContext(), createUriInfo(), collectionObjectCsid); if (workflowResponse != null) { PoxPayloadOut payloadOut = new PoxPayloadOut(workflowResponse); String workflowState = @@ -562,7 +573,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { } // The 'resource' type used here identifies the record type of the // related records to be retrieved - AbstractCommonList relatedRecords = resource.getList(uriInfo); + AbstractCommonList relatedRecords = resource.getList(getServiceContext(), uriInfo); if (logger.isTraceEnabled()) { logger.trace("Identified " + relatedRecords.getTotalItems() + " record(s) related to the object record via direction " + relationshipDirection + " with CSID " + csid); @@ -665,7 +676,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable { while (morePages == true) { uriInfo = addFilterForPageSize(uriInfo, currentPage, pageSize); - AbstractCommonList collectionObjects = collectionObjectResource.getList(uriInfo); + AbstractCommonList collectionObjects = collectionObjectResource.getList(getServiceContext(), uriInfo); appendItemsToCsidsList(noContextCsids, collectionObjects); if (collectionObjects.getItemsInPage() == pageSize) { // We know we're at the last page when the number of items returned in the last request is less than the page size. 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/UpdateRareFlagBatchJob.java index 85c4ca5eb..2aba0f020 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/UpdateRareFlagBatchJob.java @@ -107,11 +107,12 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { * * @param taxonCsid The csid of the taxon record * @return - * @throws URISyntaxException - * @throws DocumentException + * @throws Exception */ - public InvocationResults updateReferencingRareFlags(String taxonCsid, String vocabularyCsid) throws URISyntaxException, DocumentException { - PoxPayloadOut taxonPayload = findTaxonByCsid(taxonCsid); + public InvocationResults updateReferencingRareFlags(String taxonCsid, String vocabularyCsid) throws Exception { + PoxPayloadOut taxonPayload = vocabularyCsid == null + ? findTaxonByCsid(taxonCsid) + : findTaxonByCsid(taxonCsid, vocabularyCsid); String taxonRefName = getFieldValue(taxonPayload, TaxonConstants.REFNAME_SCHEMA_NAME, TaxonConstants.REFNAME_FIELD_NAME); RefName.AuthorityItem item = RefName.AuthorityItem.parse(taxonRefName); @@ -153,10 +154,9 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { * * @param collectionObjectCsid The csid of the collectionobject * @return - * @throws URISyntaxException - * @throws DocumentException + * @throws Exception */ - public InvocationResults updateRareFlag(String collectionObjectCsid) throws URISyntaxException, DocumentException { + public InvocationResults updateRareFlag(String collectionObjectCsid) throws Exception { PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid); return updateRareFlag(collectionObjectPayload); @@ -170,10 +170,9 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { * * @param collectionObjectPayload The payload representing the collectionobject * @return - * @throws URISyntaxException - * @throws DocumentException + * @throws Exception */ - public InvocationResults updateRareFlag(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException { + public InvocationResults updateRareFlag(PoxPayloadOut collectionObjectPayload) throws Exception { InvocationResults results = new InvocationResults(); String uri = this.getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.URI_SCHEMA_NAME, @@ -271,10 +270,9 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { * * @param collectionObjectCsids The csids of the collectionobjects * @return - * @throws URISyntaxException - * @throws DocumentException + * @throws Exception */ - public InvocationResults updateRareFlags(List collectionObjectCsids) throws URISyntaxException, DocumentException { + public InvocationResults updateRareFlags(List collectionObjectCsids) throws Exception { int numSubmitted = collectionObjectCsids.size(); long numAffected = 0; @@ -296,10 +294,9 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { * Updates the rare flags of all collectionobjects. * * @return - * @throws URISyntaxException - * @throws DocumentException + * @throws Exception */ - public InvocationResults updateAllRareFlags() throws URISyntaxException, DocumentException { + public InvocationResults updateAllRareFlags() throws Exception { long numFound = 0; long numAffected = 0; @@ -346,6 +343,6 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob { ""; NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(CollectionObjectClient.SERVICE_NAME); - resource.update(getResourceMap(), createUriInfo(), collectionObjectCsid, updatePayload); + resource.update(getServiceContext(), getResourceMap(), createUriInfo(), collectionObjectCsid, updatePayload); } } diff --git a/services/common-api/src/main/java/org/collectionspace/services/common/api/RefNameUtils.java b/services/common-api/src/main/java/org/collectionspace/services/common/api/RefNameUtils.java index 13802afe5..7d5909d2b 100644 --- a/services/common-api/src/main/java/org/collectionspace/services/common/api/RefNameUtils.java +++ b/services/common-api/src/main/java/org/collectionspace/services/common/api/RefNameUtils.java @@ -41,10 +41,13 @@ public class RefNameUtils { private final Logger logger = LoggerFactory.getLogger(RefNameUtils.class); - public static final String URN_PREFIX = "urn:cspace:"; - public static final int URN_PREFIX_LEN = 11; + public static final String SEPARATOR = ":"; + public static final String URN_PREFIX = "urn"; + public static final String URN_CSPACE = "cspace"; + public static final String URN_CSPACE_PREFIX = URN_PREFIX + SEPARATOR + URN_CSPACE + SEPARATOR; // "urn:cspace:" + public static final int URN_PREFIX_LEN = URN_CSPACE_PREFIX.length(); public static final String URN_NAME_PREFIX = "urn:cspace:name("; - public static final int URN_NAME_PREFIX_LEN = 16; + public static final int URN_NAME_PREFIX_LEN = URN_NAME_PREFIX.length(); public static final String NAME_SPECIFIER = "name"; public static final String ID_SPECIFIER = "id"; @@ -64,9 +67,19 @@ public class RefNameUtils { private static final int INSTANCE_DISPLAYNAME_TOKEN = 2;// optional displayName suffix private static final int INSTANCE_TOKENS_MIN = 2; private static final int INSTANCE_TOKENS_MAX = 3; - public static final String SEPARATOR = ":"; - public static class AuthorityInfo { + public static String domainToPhrase(String domain) { + String result = ""; + + String[] split = domain.split("\\.", 0); + for (String token : split) { + result = result + token + ' '; + } + + return result.trim(); + } + + public static class AuthorityInfo { private final Logger logger = LoggerFactory.getLogger(AuthorityInfo.class); private static int MIN_TOKENS = 3; public String domain; @@ -197,14 +210,14 @@ public class RefNameUtils { public static AuthorityInfo parseAuthorityInfo(String refName) throws IllegalArgumentException { - if(refName==null || !refName.startsWith(URN_PREFIX)) + if(refName==null || !refName.startsWith(URN_CSPACE_PREFIX)) throw new IllegalArgumentException( "Null or invalid refName syntax"); String[] refNameTokens = refName.substring(URN_PREFIX_LEN).split(SEPARATOR, AUTH_REFNAME_TOKENS); return new AuthorityInfo(refNameTokens); } public static AuthorityTermInfo parseAuthorityTermInfo(String refName) throws IllegalArgumentException { - if (refName == null || !refName.startsWith(URN_PREFIX)) { + if (refName == null || !refName.startsWith(URN_CSPACE_PREFIX)) { throw new IllegalArgumentException("Null or invalid refName syntax"); } String[] refNameTokens = refName.substring(URN_PREFIX_LEN).split(SEPARATOR, AUTH_ITEM_REFNAME_TOKENS); @@ -213,12 +226,12 @@ public class RefNameUtils { public static String stripAuthorityTermDisplayName(String refName) throws IllegalArgumentException { - if(refName==null || !refName.startsWith(URN_PREFIX)) + if(refName==null || !refName.startsWith(URN_CSPACE_PREFIX)) throw new IllegalArgumentException( "Null or invalid refName syntax"); String[] refNameTokens = refName.substring(URN_PREFIX_LEN).split(SEPARATOR, AUTH_ITEM_REFNAME_TOKENS); int rightParen = refNameTokens[ITEM_INSTANCE_TOKEN].indexOf(')'); refNameTokens[ITEM_INSTANCE_TOKEN] = refNameTokens[ITEM_INSTANCE_TOKEN].substring(0, rightParen+1); - return URN_PREFIX + implodeStringArray(refNameTokens, SEPARATOR); + return URN_CSPACE_PREFIX + implodeStringArray(refNameTokens, SEPARATOR); } public static String implodeStringArray(String tokens[], String separator) { diff --git a/services/common/src/main/java/org/collectionspace/services/common/AbstractMultiPartCollectionSpaceResourceImpl.java b/services/common/src/main/java/org/collectionspace/services/common/AbstractMultiPartCollectionSpaceResourceImpl.java index 74e3bc8fb..57948fcad 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/AbstractMultiPartCollectionSpaceResourceImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/AbstractMultiPartCollectionSpaceResourceImpl.java @@ -176,6 +176,13 @@ public abstract class AbstractMultiPartCollectionSpaceResourceImpl extends Abstr public byte[] getWorkflow( @Context UriInfo uriInfo, @PathParam("csid") String csid) { + return getWorkflowWithExistingContext(null, uriInfo, csid); + } + + public byte[] getWorkflowWithExistingContext( + ServiceContext existingContext, + UriInfo uriInfo, + String csid) { PoxPayloadOut result = null; try { @@ -183,6 +190,9 @@ public abstract class AbstractMultiPartCollectionSpaceResourceImpl extends Abstr String parentWorkspaceName = parentCtx.getRepositoryWorkspaceName(); MultipartServiceContext ctx = (MultipartServiceContext) createServiceContext(WorkflowClient.SERVICE_NAME, uriInfo); + if (existingContext != null && existingContext.getCurrentRepositorySession() != null) { + ctx.setCurrentRepositorySession(existingContext.getCurrentRepositorySession()); // Reuse the current repo session if one exists + } WorkflowDocumentModelHandler handler = createWorkflowDocumentHandler(ctx); ctx.setRespositoryWorkspaceName(parentWorkspaceName); //find the document in the parent's workspace getRepositoryClient(ctx).get(ctx, csid, handler); diff --git a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java index 7fe0f5dde..ec8de6f6f 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java @@ -474,7 +474,8 @@ public abstract class NuxeoBasedResource ServiceContext ctx = createServiceContext(uriInfo); if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) { ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists - } DocumentHandler handler = createDocumentHandler(ctx); + } + DocumentHandler handler = createDocumentHandler(ctx); getRepositoryClient(ctx).getFiltered(ctx, handler); AbstractCommonList list = (AbstractCommonList) handler.getCommonPartList(); return list; diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityContextImpl.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityContextImpl.java index e3f2fd6a9..42de8cf37 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityContextImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityContextImpl.java @@ -54,7 +54,7 @@ public class SecurityContextImpl implements SecurityContext { // If anonymous access is being attempted, then a tenant ID needs to be set as a query param // if (uriInfo == null) { - String errMsg = "Anonymous access attempted with null UriInfo."; + String errMsg = "Anonymous access attempted with missing or invalid tenant ID query or path paramter. A null 'UriInfo' instance was passed into the service context constructor."; logger.warn(errMsg); throw new UnauthorizedException(errMsg); } diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/LazyAuthorityRefDocList.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/LazyAuthorityRefDocList.java index a67fa584d..84548e3f6 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/LazyAuthorityRefDocList.java +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/LazyAuthorityRefDocList.java @@ -6,6 +6,7 @@ import java.util.Map; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.common.context.AbstractServiceContextImpl; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentNotFoundException; @@ -18,6 +19,9 @@ import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.google.common.collect.AbstractIterator; /** @@ -32,6 +36,7 @@ import com.google.common.collect.AbstractIterator; * */ public class LazyAuthorityRefDocList extends DocumentModelListImpl { + private static final Logger logger = LoggerFactory.getLogger(LazyAuthorityRefDocList.class); private static final long serialVersionUID = 1L; private ServiceContext ctx; @@ -197,8 +202,9 @@ public class LazyAuthorityRefDocList extends DocumentModelListImpl { try { nextPageDocList = fetchPage(nextPageNum, false, true); + } catch(DocumentException e) { + logger.error(e.getMessage()); } - catch(DocumentException e) {} if (nextPageDocList == null || nextPageDocList.size() == 0) { // There are no more pages. diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java index 3d07d672a..c23781154 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.UUID; import javax.ws.rs.core.Response; @@ -44,8 +45,10 @@ import org.collectionspace.services.client.IQueryManager; import org.collectionspace.services.client.IRelationsManager; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.Profiler; import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.ServiceMain; +import org.collectionspace.services.common.ServletTools; import org.collectionspace.services.common.StoredValuesUriTemplate; import org.collectionspace.services.common.UriTemplateFactory; import org.collectionspace.services.common.UriTemplateRegistry; @@ -429,7 +432,8 @@ public class RefNameServiceUtils { authRefFieldsByService, filter.getWhereClause(), null, // orderByClause - 2*pageSize, + 2, // pageScale + pageSize, useDefaultOrderByClause, computeTotal); @@ -454,7 +458,7 @@ public class RefNameServiceUtils { String strippedRefName = RefNameUtils.stripAuthorityTermDisplayName(refName); // *** Need to pass in pagination info here. - int nRefsFound = processRefObjsDocListForList(docList, ctx.getTenantId(), strippedRefName, + long nRefsFound = processRefObjsDocListForList(docList, ctx.getTenantId(), strippedRefName, queriedServiceBindings, authRefFieldsByService, // the actual list size needs to be updated to the size of "list" list, pageSize, pageNum); @@ -554,7 +558,7 @@ public class RefNameServiceUtils { // Only match complete refNames - unless and until we decide how to resolve changes // to NPTs we will defer that and only change PTs or refNames as passed in. - int nRefsFoundThisPage = processRefObjsDocListForUpdate(ctx, docList, ctx.getTenantId(), oldRefName, + long nRefsFoundThisPage = processRefObjsDocListForUpdate(ctx, docList, ctx.getTenantId(), oldRefName, queriedServiceBindings, authRefFieldsByService, // Perform the refName updates on the list of document models newRefName); if (nRefsFoundThisPage > 0) { @@ -589,6 +593,7 @@ public class RefNameServiceUtils { Map> authRefFieldsByService, String whereClauseAdditions, String orderByClause, + int pageScale, int pageSize, boolean useDefaultOrderByClause, boolean computeTotal) throws DocumentException, DocumentNotFoundException { @@ -603,7 +608,7 @@ public class RefNameServiceUtils { authRefFieldsByService, whereClauseAdditions, orderByClause, - pageSize, + pageSize*pageScale, useDefaultOrderByClause, computeTotal); } @@ -642,24 +647,88 @@ public class RefNameServiceUtils { if (query == null) { // found no authRef fields - nothing to query return null; } + // Additional qualifications, like workflow state if (Tools.notBlank(whereClauseAdditions)) { query += " AND " + whereClauseAdditions; } + // Now we have to issue the search - NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient; - DocumentWrapper docListWrapper = nuxeoRepoClient.findDocs( + DocumentModelList docList = findDocs( + repoClient, ctx, repoSession, docTypes, query, - orderByClause, - pageNum, - pageSize, + orderByClause, + pageNum, + pageSize, useDefaultOrderByClause, computeTotal); - // Now we gather the info for each document into the list and return - DocumentModelList docList = docListWrapper.getWrappedObject(); + + return docList; + } + + private static final DocumentModelList findDocs( + RepositoryClient repoClient, + ServiceContext ctx, + CoreSessionInterface repoSession, + List docTypes, + String query, + String orderByClause, + int pageNum, + int pageSize, + boolean useDefaultOrderByClause, + boolean computeTotal) + throws DocumentNotFoundException, DocumentException { + Profiler profiler = new Profiler(query, 0); + + // Start timing. + profiler.start(); + UUID uuid = UUID.randomUUID(); + + // Write a CSV-delimited message to the performance log, + // in a format intended to be interoperable with those + // generated by other system layers. + String csvMsg = + profiler.getStartTime() + + "," + uuid.toString() + + "," + query + + "," + pageNum + + "," + pageSize + + "," + Thread.currentThread().getName(); + final boolean FORMAT_LOG_MESSAGE = false; + profiler.log(csvMsg, FORMAT_LOG_MESSAGE); + + // Now we have to issue the search + NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient; + DocumentWrapper docListWrapper = nuxeoRepoClient.findDocs( + ctx, + repoSession, + docTypes, + query, + orderByClause, + pageNum, + pageSize, + useDefaultOrderByClause, + computeTotal); + // Now we gather the info for each document into the list and return + DocumentModelList docList = docListWrapper.getWrappedObject(); + + // Stop timing and log performance-related metrics. + profiler.stop(); + + csvMsg = + profiler.getStopTime() + + "," + uuid.toString() + + "," + query + + "," + pageNum + + "," + pageSize + + "," + Thread.currentThread().getName(); + profiler.log(csvMsg, FORMAT_LOG_MESSAGE); + + profiler.reset(); + return docList; } @@ -699,22 +768,26 @@ public class RefNameServiceUtils { if (fFirst) { // found no authRef fields - nothing to query return null; } - // We used to build a complete matches query, but that was too complex. - // Just build a keyword query based upon some key pieces - the urn syntax elements and the shortID - // Note that this will also match the Item itself, but that will get filtered out when + + // Note that this will also match the term item itself, but that will get filtered out when // we compute actual matches. AuthorityTermInfo authTermInfo = RefNameUtils.parseAuthorityTermInfo(refName); + + // Example refname: urn:cspace:pahma.cspace.berkeley.edu:personauthorities:name(person):item:name(ReneRichie1586477168934) + // Corresponding phrase: "urn cspace pahma cspace berkeley edu personauthorities name person item name ReneRichie1586477168934 + + String refnamePhrase = String.format("urn cspace %s %s name %s item name %s", + RefNameUtils.domainToPhrase(authTermInfo.inAuthority.domain), + authTermInfo.inAuthority.resource, + authTermInfo.inAuthority.name, + authTermInfo.name + ); + refnamePhrase = String.format("\"%s\"", refnamePhrase); // surround the phase in double quotes to indicate this is a NXQL phrase search - String keywords = RefNameUtils.URN_PREFIX - + " AND " + (authTermInfo.inAuthority.name != null - ? authTermInfo.inAuthority.name : authTermInfo.inAuthority.csid) - + " AND " + (authTermInfo.name != null - ? authTermInfo.name : authTermInfo.csid); // REM - This seems likely to cause trouble? We should consider searching for the full refname -excluding the display name suffix? - - String whereClauseStr = QueryManager.createWhereClauseFromKeywords(keywords); + String whereClauseStr = QueryManager.createWhereClauseFromKeywords(refnamePhrase); if (logger.isTraceEnabled()) { - logger.trace("The 'where' clause to find refObjs is: ", whereClauseStr); + logger.trace("The 'where' clause to find refObjs is: ", refnamePhrase); } return whereClauseStr; @@ -727,7 +800,7 @@ public class RefNameServiceUtils { return result; } - private static int processRefObjsDocListForUpdate( + private static long processRefObjsDocListForUpdate( ServiceContext ctx, DocumentModelList docList, String tenantId, @@ -746,7 +819,7 @@ public class RefNameServiceUtils { authRefFieldsByService, null, 0, 0, newAuthorityRefName); } - private static int processRefObjsDocListForList( + private static long processRefObjsDocListForList( DocumentModelList docList, String tenantId, String refName, @@ -767,7 +840,7 @@ public class RefNameServiceUtils { * an open session, and caller must release Session after calling this. * */ - private static int processRefObjsDocList( + private static long processRefObjsDocList( DocumentModelList docList, String tenantId, String refName, @@ -779,16 +852,24 @@ public class RefNameServiceUtils { String newAuthorityRefName) { UriTemplateRegistry registry = ServiceMain.getInstance().getUriTemplateRegistry(); Iterator iter = docList.iterator(); - int nRefsFoundTotal = 0; + long nRefsFoundTotal = 0; + long nRefsFalsePositives = 0; boolean foundSelf = false; + boolean warningLogged = false; // When paginating results, we have to guess at the total. First guess is the number of docs returned // by the query. However, this returns some false positives, so may be high. // In addition, we can match multiple fields per doc, so this may be low. Fun, eh? - int nDocsReturnedInQuery = (int)docList.totalSize(); - int nDocsProcessed = 0; - int firstItemInPage = pageNum*pageSize; + long nDocsReturnedInQuery = (int)docList.totalSize(); + long nDocsProcessed = 0; + long firstItemInPage = pageNum*pageSize; while (iter.hasNext()) { + if (!warningLogged && (float)nRefsFalsePositives / nDocsReturnedInQuery > 0.5) { + warningLogged = true; + String msg = String.format("When searching for documents referencing the term '%s', more than 1/2 of the results were false-positives.", + refName); + logger.warn(msg); + } DocumentModel docModel = iter.next(); AuthorityRefDocList.AuthorityRefDocItem ilistItem; @@ -811,9 +892,10 @@ public class RefNameServiceUtils { if (newAuthorityRefName != null) { throw new InternalError("processRefObjsDocList() called with both an itemList and a new RefName!"); } - if(firstItemInPage > 100) { - logger.warn("Processing a large offset (size:{}, num:{}) for refObjs - will be expensive!!!", - pageSize, pageNum); + if (firstItemInPage > 100) { + String msg = String.format("Processing a large offset for records referencing (term:%s, size:%d, num:%d) - will be expensive!!!", + refName, pageSize, pageNum); + logger.warn(msg); } // Note that we have to go through check all the fields to determine the actual page start ilistItem = new AuthorityRefDocList.AuthorityRefDocItem(); @@ -877,9 +959,6 @@ public class RefNameServiceUtils { throw new RuntimeException( "getAuthorityRefDocs: internal logic error: can't fetch authRefFields for DocType."); } - //String authRefAncestorField = ""; - //String authRefDescendantField = ""; - //String sourceField = ""; ArrayList foundProps = new ArrayList(); try { @@ -911,12 +990,13 @@ public class RefNameServiceUtils { :refName.equals(docRefName)) { // We found the self for an item foundSelf = true; - logger.debug("getAuthorityRefDocs: Result: " + logger.trace("getAuthorityRefDocs: Result: " + docType + " [" + NuxeoUtils.getCsid(docModel) + "] appears to be self for: [" + refName + "]"); } else { - logger.debug("getAuthorityRefDocs: Result: " + nRefsFalsePositives++; + logger.trace("getAuthorityRefDocs: Result: " + docType + " [" + NuxeoUtils.getCsid(docModel) + "] does not reference [" + refName + "]"); @@ -926,24 +1006,34 @@ public class RefNameServiceUtils { throw new RuntimeException( "getAuthorityRefDocs: Problem fetching values from repo: " + ce.getLocalizedMessage()); } + nDocsProcessed++; + // Done processing that doc. Are we done with the whole page? // Note pageSize <=0 means do them all - if((pageSize > 0) && ((nRefsFoundTotal-firstItemInPage)>=pageSize)) { + if ((pageSize > 0) && ((nRefsFoundTotal - firstItemInPage) >= pageSize)) { // Quitting early, so we need to estimate the total. Assume one per doc // for the rest of the docs we matched in the query - int unprocessedDocs = nDocsReturnedInQuery - nDocsProcessed; - if(unprocessedDocs>0) { + long unprocessedDocs = nDocsReturnedInQuery - nDocsProcessed; + if (unprocessedDocs > 0) { // We generally match ourselves in the keyword search. If we already saw ourselves // then do not try to correct for this. Otherwise, decrement the total. // Yes, this is fairly goofy, but the whole estimation mechanism is goofy. - if(!foundSelf) + if (!foundSelf) unprocessedDocs--; nRefsFoundTotal += unprocessedDocs; } break; } } // close while(iterator) + + // Log a final warning if we find too many false-positives. + if ((float)nRefsFalsePositives / nDocsReturnedInQuery > 0.33) { + String msg = String.format("Found %d false-positives and %d only true references the refname:%s", + nRefsFalsePositives, nRefsFoundTotal, refName); + logger.warn(msg); + } + return nRefsFoundTotal; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java index cfaec64c4..e036d7f41 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java @@ -1053,7 +1053,8 @@ public class NuxeoUtils { try { result = docModel.getPropertyValue(propertyName); } catch (NullPointerException npe) { - result = null; + logger.warn(String.format("Could not get a value for the property '%s' in Nuxeo document with CSID '%s'.", + propertyName, docModel != null ? docModel.getName() : "")); } return result; diff --git a/services/loanout/client/src/main/resources/log4j2-surefire.xml b/services/loanout/client/src/main/resources/log4j2-surefire.xml new file mode 100644 index 000000000..bf74484d1 --- /dev/null +++ b/services/loanout/client/src/main/resources/log4j2-surefire.xml @@ -0,0 +1,34 @@ + + + + + %d %-5p [%t] [%c:%L] %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/person/client/src/main/resources/log4j2-surefire.xml b/services/person/client/src/main/resources/log4j2-surefire.xml new file mode 100644 index 000000000..bf74484d1 --- /dev/null +++ b/services/person/client/src/main/resources/log4j2-surefire.xml @@ -0,0 +1,34 @@ + + + + + %d %-5p [%t] [%c:%L] %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java b/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java index 0a179a078..277eb74a2 100644 --- a/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java +++ b/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java @@ -255,14 +255,17 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler