From: Patrick Schmitz Date: Tue, 19 Jul 2011 23:23:45 +0000 (+0000) Subject: CSPACE-4205 Made the supported docType be a list for reports and batch jobs. Updated... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b7fb81173436a9b2b371af07d23cf8f4c27c36c9;p=tmp%2Fjakarta-migration.git CSPACE-4205 Made the supported docType be a list for reports and batch jobs. Updated the search support and tests to reflect this as well. --- diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch.xml index 0cc39a587..91c22683c 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch.xml @@ -5,12 +5,12 @@ YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= - + POST /cspace-services/batch/ batch/batch1.xml - + POST /cspace-services/batch/ batch/batch1.xml @@ -22,7 +22,7 @@ POST - /cspace-services/batch/${createCollObj1.CSID} + /cspace-services/batch/${createBatch1.CSID} batch/batchInvContextSingle.xml ${createBatch.CSID} @@ -30,7 +30,7 @@ POST - /cspace-services/batch/${createCollObj1.CSID} + /cspace-services/batch/${createBatch1.CSID} batch/batchInvContextList.xml ${createBatch.CSID} @@ -39,7 +39,7 @@ POST 400 - /cspace-services/batch/${createCollObj1.CSID} + /cspace-services/batch/${createBatch1.CSID} batch/batchBadInvContext.xml ${createBatch.CSID} @@ -48,7 +48,7 @@ POST 400 - /cspace-services/batch/${createCollObj1.CSID} + /cspace-services/batch/${createBatch1.CSID} batch/batchBadInvContextList.xml ${createBatch.CSID} @@ -67,7 +67,7 @@ DELETE - /cspace-services/batch/${createCollObj1.CSID} + /cspace-services/batch/${createBatch1.CSID} DELETE diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch1.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch1.xml index 7e6f5ef8d..6c66e7717 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch1.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch1.xml @@ -5,7 +5,9 @@ xmlns:ns3="http://collectionspace.org/services/jaxb"> TestCreateAndLinkLoanOutBatchJob This should be interesting - CollectionObject + + CollectionObject + true true true diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/report/report1.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/report/report1.xml index 0ceba0fde..1f1d813ef 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/report/report1.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/report/report1.xml @@ -4,7 +4,9 @@ xmlns:ns2="http://collectionspace.org/services/report"> Acquisition Summary Just a few fields about a single acquisition - Acquisition + + Acquisition + true false false diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd index abed71e9b..2b0b5e44d 100644 --- a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd @@ -24,7 +24,13 @@ - + + + + + + + diff --git a/services/batch/jaxb/src/main/resources/batch_common.xsd b/services/batch/jaxb/src/main/resources/batch_common.xsd index c8f03741d..74baecf95 100644 --- a/services/batch/jaxb/src/main/resources/batch_common.xsd +++ b/services/batch/jaxb/src/main/resources/batch_common.xsd @@ -17,22 +17,29 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + @@ -42,7 +49,7 @@ - + diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java index a573357c7..cad1a58b7 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java @@ -152,7 +152,7 @@ public class BatchResource extends ResourceBase { throw new RuntimeException("No docType specified."); } String ptClause = COMMON_SCHEMA + ":" - + BatchJAXBSchema.FOR_DOC_TYPE + + BatchJAXBSchema.FOR_DOC_TYPES + "='" + trimmed + "'"; return ptClause; } @@ -230,9 +230,10 @@ public class BatchResource extends ResourceBase { +invocationMode); } if(checkDocType) { - String forDocType = - (String)docModel.getPropertyValue(BatchJAXBSchema.FOR_DOC_TYPE); - if(!forDocType.equalsIgnoreCase(invContext.getDocType())) { + List forDocTypeList = + (List)docModel.getPropertyValue(BatchJAXBSchema.FOR_DOC_TYPES); + if(forDocTypeList==null + || !forDocTypeList.contains(invContext.getDocType())) { throw new BadRequestException( "BatchResource: Invoked with unsupported document type: " +invContext.getDocType()); diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml index c596d3748..545dd01ad 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml @@ -555,7 +555,7 @@ batch batch - name|forDocType|uri|csid + name|uri|csid org.collectionspace.services.batch.BatchCommonList org.collectionspace.services.batch.BatchCommonList$BatchListItem getBatchListItem @@ -565,11 +565,6 @@ name setName - - forDocType - forDocType - setForDocType - @@ -836,6 +831,25 @@ --> default-domain org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler + org.collectionspace.services.report.nuxeo.ReportValidatorHandler org.collectionspace.services.report.nuxeo.ReportPostInitHandler diff --git a/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java b/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java index 5117e8d90..3c396ab7e 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java @@ -204,7 +204,7 @@ public class QueryManagerNuxeoImpl implements IQueryManager { if (schema==null || schema.isEmpty()) { throw new RuntimeException("No match schema specified."); } - String wClause = schema+":"+InvocableJAXBSchema.FOR_DOC_TYPE + " = '" + trimmed + "'"; + String wClause = schema+":"+InvocableJAXBSchema.FOR_DOC_TYPES + " = '" + trimmed + "'"; return wClause; } diff --git a/services/jaxb/src/main/java/org/collectionspace/services/jaxb/InvocableJAXBSchema.java b/services/jaxb/src/main/java/org/collectionspace/services/jaxb/InvocableJAXBSchema.java index 0bf74425a..0a71f85c9 100644 --- a/services/jaxb/src/main/java/org/collectionspace/services/jaxb/InvocableJAXBSchema.java +++ b/services/jaxb/src/main/java/org/collectionspace/services/jaxb/InvocableJAXBSchema.java @@ -4,7 +4,7 @@ package org.collectionspace.services.jaxb; public interface InvocableJAXBSchema { - final static String FOR_DOC_TYPE = "forDocType"; + final static String FOR_DOC_TYPES = "forDocTypes"; final static String SUPPORTS_SINGLE_DOC = "supportsSingleDoc"; final static String SUPPORTS_DOC_LIST = "supportsDocList"; final static String SUPPORTS_GROUP = "supportsGroup"; diff --git a/services/report/3rdparty/nuxeo-platform-cs-report/src/main/resources/schemas/reports_common.xsd b/services/report/3rdparty/nuxeo-platform-cs-report/src/main/resources/schemas/reports_common.xsd index 2baa52006..3c2b75960 100644 --- a/services/report/3rdparty/nuxeo-platform-cs-report/src/main/resources/schemas/reports_common.xsd +++ b/services/report/3rdparty/nuxeo-platform-cs-report/src/main/resources/schemas/reports_common.xsd @@ -22,7 +22,13 @@ - + + + + + + + diff --git a/services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java b/services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java index 7f22bd1cd..78c6ef25c 100644 --- a/services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java +++ b/services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java @@ -22,6 +22,7 @@ */ package org.collectionspace.services.client.test; +import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -662,9 +663,11 @@ public class ReportServiceTest extends AbstractServiceTestImpl { * @return the multipart output */ private PoxPayloadOut createReportInstance(String identifier) { + List docTypes = new ArrayList(); + docTypes.add(testDocType); return createReportInstance( "Acquisition Summary", - testDocType, true, false, false, true, + docTypes, true, false, false, true, "acq_basic.jasper", "application/pdf"); } @@ -678,14 +681,17 @@ public class ReportServiceTest extends AbstractServiceTestImpl { * @return the multipart output */ private PoxPayloadOut createReportInstance(String name, - String forDocType, + List forDocTypeList, boolean supportsSingle, boolean supportsList, boolean supportsGroup, boolean supportsNoContext, String filename, String outputMIME) { ReportsCommon reportCommon = new ReportsCommon(); reportCommon.setName(name); - reportCommon.setForDocType(forDocType); + ReportsCommon.ForDocTypes forDocTypes = new ReportsCommon.ForDocTypes(); + List docTypeList = forDocTypes.getForDocType(); + docTypeList.addAll(forDocTypeList); + reportCommon.setForDocTypes(forDocTypes); reportCommon.setSupportsSingleDoc(supportsSingle); reportCommon.setSupportsDocList(supportsList); reportCommon.setSupportsGroup(supportsGroup); diff --git a/services/report/jaxb/src/main/resources/reports-common.xsd b/services/report/jaxb/src/main/resources/reports-common.xsd index e477850eb..b5637a625 100644 --- a/services/report/jaxb/src/main/resources/reports-common.xsd +++ b/services/report/jaxb/src/main/resources/reports-common.xsd @@ -28,23 +28,30 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java b/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java index f65005d99..a6adec409 100644 --- a/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java +++ b/services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java @@ -231,9 +231,10 @@ public class ReportResource extends ResourceBase { +invocationMode); } if(checkDocType) { - String forDocType = - (String)docModel.getPropertyValue(InvocableJAXBSchema.FOR_DOC_TYPE); - if(!forDocType.equalsIgnoreCase(invContext.getDocType())) { + List forDocTypeList = + (List)docModel.getPropertyValue(InvocableJAXBSchema.FOR_DOC_TYPES); + if(forDocTypeList==null + || !forDocTypeList.contains(invContext.getDocType())) { throw new BadRequestException( "ReportResource: Invoked with unsupported document type: " +invContext.getDocType()); 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 db40ddf92..36ec574e1 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 @@ -121,7 +121,7 @@ public class ReportDocumentModelHandler public ReportsCommonList extractCommonPartList(DocumentWrapper wrapDoc) throws Exception { ReportsCommonList coList = this.extractPagingInfo(new ReportsCommonList(), wrapDoc); AbstractCommonList commonList = (AbstractCommonList) coList; - commonList.setFieldsReturned("name|outputMIME|forDocType|forSingleDoc|uri|csid"); + commonList.setFieldsReturned("name|uri|csid"); List list = coList.getReportListItem(); Iterator iter = wrapDoc.getWrappedObject().iterator(); String label = getServiceContext().getCommonPartLabel(); @@ -130,16 +130,6 @@ public class ReportDocumentModelHandler ReportListItem ilistItem = new ReportListItem(); ilistItem.setName((String) docModel.getProperty(label, ReportJAXBSchema.NAME)); - ilistItem.setOutputMIME((String) docModel.getProperty(label, - ReportJAXBSchema.OUTPUT_MIME)); - ilistItem.setForDocType((String) docModel.getProperty(label, - ReportJAXBSchema.FOR_DOC_TYPE)); - ilistItem.setSupportsSingleDoc((Boolean) docModel.getProperty(label, - ReportJAXBSchema.SUPPORTS_SINGLE_DOC)); - ilistItem.setSupportsDocList((Boolean) docModel.getProperty(label, - ReportJAXBSchema.SUPPORTS_DOC_LIST)); - ilistItem.setSupportsGroup((Boolean) docModel.getProperty(label, - ReportJAXBSchema.SUPPORTS_GROUP)); String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString()); ilistItem.setUri(getServiceContextPath() + id); ilistItem.setCsid(id);