]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4205 Made the supported docType be a list for reports and batch jobs. Updated...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 19 Jul 2011 23:23:45 +0000 (23:23 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 19 Jul 2011 23:23:45 +0000 (23:23 +0000)
14 files changed:
services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch1.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/report/report1.xml
services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd
services/batch/jaxb/src/main/resources/batch_common.xsd
services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java
services/jaxb/src/main/java/org/collectionspace/services/jaxb/InvocableJAXBSchema.java
services/report/3rdparty/nuxeo-platform-cs-report/src/main/resources/schemas/reports_common.xsd
services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java
services/report/jaxb/src/main/resources/reports-common.xsd
services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java
services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java

index 0cc39a587f24495e9c7cf6d7de3e9f453bbc6a32..91c22683c7955f0be8c468a7c75a059ffca73748 100644 (file)
@@ -5,12 +5,12 @@
                <auth ID="admin@core.collectionspace.org">YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=</auth>\r
        </auths>\r
        <testGroup ID="testSingle" autoDeletePOSTS="true">\r
-               <test ID="createCollObj1" auth="test">\r
+               <test ID="createBatch1" auth="test">\r
                        <method>POST</method>\r
                        <uri>/cspace-services/batch/</uri>\r
                        <filename>batch/batch1.xml</filename>\r
                </test>\r
-               <test ID="createCollObj2" auth="test">\r
+               <test ID="createBatch2" auth="test">\r
                        <method>POST</method>\r
                        <uri>/cspace-services/batch/</uri>\r
                        <filename>batch/batch1.xml</filename>\r
@@ -22,7 +22,7 @@
                </test>\r
                <test ID="testInvokeSingle" auth="test" autoDeletePOSTS="false">\r
                        <method>POST</method>\r
-                       <uri>/cspace-services/batch/${createCollObj1.CSID}</uri>\r
+                       <uri>/cspace-services/batch/${createBatch1.CSID}</uri>\r
                        <filename>batch/batchInvContextSingle.xml</filename>\r
                        <vars>\r
                                <var ID="CollObj1">${createBatch.CSID}</var>\r
@@ -30,7 +30,7 @@
                </test>\r
                <test ID="testInvokeList" auth="test" autoDeletePOSTS="false">\r
                        <method>POST</method>\r
-                       <uri>/cspace-services/batch/${createCollObj1.CSID}</uri>\r
+                       <uri>/cspace-services/batch/${createBatch1.CSID}</uri>\r
                        <filename>batch/batchInvContextList.xml</filename>\r
                        <vars>\r
                                <var ID="CollObj1">${createBatch.CSID}</var>\r
@@ -39,7 +39,7 @@
                <test ID="testBadInvoke" auth="test" autoDeletePOSTS="false">\r
                        <method>POST</method>\r
                        <expectedCodes>400</expectedCodes>\r
-                       <uri>/cspace-services/batch/${createCollObj1.CSID}</uri>\r
+                       <uri>/cspace-services/batch/${createBatch1.CSID}</uri>\r
                        <filename>batch/batchBadInvContext.xml</filename>\r
                        <vars>\r
                                <var ID="CollObj1">${createBatch.CSID}</var>\r
@@ -48,7 +48,7 @@
                <test ID="testInvokeEmptyList" auth="test" autoDeletePOSTS="false">\r
                        <method>POST</method>\r
                        <expectedCodes>400</expectedCodes>\r
-                       <uri>/cspace-services/batch/${createCollObj1.CSID}</uri>\r
+                       <uri>/cspace-services/batch/${createBatch1.CSID}</uri>\r
                        <filename>batch/batchBadInvContextList.xml</filename>\r
                        <vars>\r
                                <var ID="CollObj1">${createBatch.CSID}</var>\r
@@ -67,7 +67,7 @@
      <testGroup ID="cleanup" autoDeletePOSTS="true">\r
          <test ID="cl1"  auth="test">\r
              <method>DELETE</method>\r
-             <uri>/cspace-services/batch/${createCollObj1.CSID}</uri>\r
+             <uri>/cspace-services/batch/${createBatch1.CSID}</uri>\r
          </test>\r
          <test ID="cl2"  auth="test">\r
              <method>DELETE</method>\r
index 7e6f5ef8d0b2fa31ca50f65b80dddd6f1be94075..6c66e7717e3c77a85368a9c1c215b288c4516575 100644 (file)
@@ -5,7 +5,9 @@
        xmlns:ns3="http://collectionspace.org/services/jaxb">\r
                <name>TestCreateAndLinkLoanOutBatchJob</name>\r
                <notes>This should be interesting</notes>\r
-               <forDocType>CollectionObject</forDocType>\r
+               <forDocTypes>\r
+                 <forDocType>CollectionObject</forDocType>\r
+               </forDocTypes>\r
                <supportsSingleDoc>true</supportsSingleDoc>\r
                <supportsDocList>true</supportsDocList>\r
                <createsNewFocus>true</createsNewFocus>\r
index 0ceba0fdec038a609a3b2c9b37889fa77b35f7f8..1f1d813efaba42102239e26a19048744c096d3ef 100644 (file)
@@ -4,7 +4,9 @@
        xmlns:ns2="http://collectionspace.org/services/report">\r
                <name>Acquisition Summary</name>\r
                <notes>Just a few fields about a single acquisition</notes>\r
-               <forDocType>Acquisition</forDocType>\r
+    <forDocTypes>\r
+               <forDocType>Acquisition</forDocType>\r
+               </forDocTypes>\r
                <supportsSingleDoc>true</supportsSingleDoc>\r
                <supportsDocList>false</supportsDocList>\r
                <supportsGroup>false</supportsGroup>\r
index abed71e9bb06f35612bfd3b886b659e9cf6f2686..2b0b5e44de215fa75a84d9aa72212b36de5e8952 100644 (file)
     \r
     <xs:element name="name" type="xs:string"/>\r
     <xs:element name="notes" type="xs:string"/>\r
-    <xs:element name="forDocType" type="xs:string"/>\r
+    <xs:element name="forDocTypes">\r
+        <xs:complexType>\r
+            <xs:sequence>\r
+                <xs:element name="forDocType" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>\r
+            </xs:sequence>\r
+        </xs:complexType>\r
+    </xs:element>\r
     <xs:element name="supportsNoContext" type="xs:boolean"/>\r
     <xs:element name="supportsSingleDoc" type="xs:boolean"/>\r
     <xs:element name="supportsDocList" type="xs:boolean"/>\r
index c8f03741d34ab80b33be4bce7caf1a769144f94c..74baecf95c8cc13c03f56c236a4f5c230bec89b1 100644 (file)
 <!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->    
     
     <!-- batch -->
-    <xs:element name="batch_common">
-        <xs:complexType>
-            <xs:sequence>
-                <!--  Batch Information Group -->
-                <xs:element name="name" type="xs:string"/>
-                <xs:element name="notes" type="xs:string"/>
-                <xs:element name="forDocType" type="xs:string"/>
-                <xs:element name="supportsNoContext" type="xs:boolean"/>
-                <xs:element name="forSingleDoc" type="xs:boolean"/>
-                <xs:element name="createsNewFocus" type="xs:boolean"/>
-                <xs:element name="className" type="xs:string"/>
-            </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+       <xs:element name="batch_common">
+               <xs:complexType>
+                       <xs:sequence>
+                               <!-- Batch Information Group -->
+                               <xs:element name="name" type="xs:string" />
+                               <xs:element name="notes" type="xs:string" />
+                               <xs:element name="forDocTypes">
+                                       <xs:complexType>
+                                               <xs:sequence>
+                                                       <xs:element name="forDocType" type="xs:string"
+                                                               minOccurs="1" maxOccurs="unbounded" />
+                                               </xs:sequence>
+                                       </xs:complexType>
+                               </xs:element>
+                               <xs:element name="supportsNoContext" type="xs:boolean" />
+                               <xs:element name="forSingleDoc" type="xs:boolean" />
+                               <xs:element name="createsNewFocus" type="xs:boolean" />
+                               <xs:element name="className" type="xs:string" />
+                       </xs:sequence>
+               </xs:complexType>
+       </xs:element>
 
-    <!-- This is the base class for paginated lists -->
+       <!-- This is the base class for paginated lists -->
     <xs:complexType name="abstractCommonList">
         <xs:annotation>
             <xs:appinfo>
@@ -42,7 +49,7 @@
     </xs:complexType>
 
 
-    <!-- batch records, as in nuxeo repository -->
+               <!-- batch records, as in nuxeo repository -->
     <xs:element name="batch-common-list">
         <xs:complexType>
             <xs:complexContent>
index a573357c77b607e5af91886af8fd01683787559b..cad1a58b71358a9c3b6074aee1f704b19fd60b4c 100644 (file)
@@ -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<String> forDocTypeList = 
+                                       (List<String>)docModel.getPropertyValue(BatchJAXBSchema.FOR_DOC_TYPES);
+                               if(forDocTypeList==null
+                                       || !forDocTypeList.contains(invContext.getDocType())) {
                                throw new BadRequestException(
                                                "BatchResource: Invoked with unsupported document type: "
                                                +invContext.getDocType());
index c596d3748e36151f85d4eac934932caf44cf3488..545dd01adc46cbe7cf3cfe7b6d367c202728020f 100644 (file)
         <service:params>
           <service:SchemaName>batch</service:SchemaName>
           <service:DublinCoreTitle>batch</service:DublinCoreTitle>
-          <service:SummaryFields>name|forDocType|uri|csid</service:SummaryFields>
+          <service:SummaryFields>name|uri|csid</service:SummaryFields>
           <service:AbstractCommonListClassname>org.collectionspace.services.batch.BatchCommonList</service:AbstractCommonListClassname>
           <service:CommonListItemClassname>org.collectionspace.services.batch.BatchCommonList$BatchListItem</service:CommonListItemClassname>
           <service:ListResultsItemMethodName>getBatchListItem</service:ListResultsItemMethodName>
               <service:xpath>name</service:xpath>
               <service:setter>setName</service:setter>
             </service:ListResultField>
-            <service:ListResultField>
-              <service:element>forDocType</service:element>
-              <service:xpath>forDocType</service:xpath>
-              <service:setter>setForDocType</service:setter>
-            </service:ListResultField>
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
             </service:uriPath>-->
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler</service:documentHandler>
+                       <!--
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler</service:classname>
+        <service:params>
+          <service:SchemaName>reports</service:SchemaName>
+          <service:DublinCoreTitle>reports</service:DublinCoreTitle>
+          <service:SummaryFields>name|uri|csid</service:SummaryFields>
+          <service:AbstractCommonListClassname />
+          <service:CommonListItemClassname />
+          <service:ListResultsItemMethodName></service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>name</service:element>
+              <service:xpath>name</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+                       </service:DocHandlerParams>
+                       -->
       <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportValidatorHandler</service:validatorHandler>
       <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
         <service:classname>org.collectionspace.services.report.nuxeo.ReportPostInitHandler</service:classname>
index 5117e8d90547f3ca7665ce6ca86a463418edad6f..3c396ab7e9c28388ec4db923acfe730625bb9a5a 100644 (file)
@@ -204,7 +204,7 @@ public class QueryManagerNuxeoImpl implements IQueryManager {
                if (schema==null || schema.isEmpty()) {\r
                        throw new RuntimeException("No match schema specified.");\r
                }\r
-               String wClause = schema+":"+InvocableJAXBSchema.FOR_DOC_TYPE + " = '" + trimmed + "'";\r
+               String wClause = schema+":"+InvocableJAXBSchema.FOR_DOC_TYPES + " = '" + trimmed + "'";\r
                return wClause;\r
        }\r
        \r
index 0bf74425af2172c0708e23e7f9f3b8128f5fe4a2..0a71f85c990512a1f7a1c314675a98e35335316d 100644 (file)
@@ -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";
index 2baa520069514fd8cb9d7fcb4f667eab17475795..3c2b75960449f23c7f600cd12df263c92f2074da 100644 (file)
 \r
     <xs:element name="name" type="xs:string"/>\r
     <xs:element name="notes" type="xs:string"/>\r
-    <xs:element name="forDocType" type="xs:string"/>\r
+    <xs:element name="forDocTypes">\r
+        <xs:complexType>\r
+            <xs:sequence>\r
+                <xs:element name="forDocType" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>\r
+            </xs:sequence>\r
+        </xs:complexType>\r
+    </xs:element>\r
     <xs:element name="supportsNoContext" type="xs:boolean"/>\r
     <xs:element name="supportsSingleDoc" type="xs:boolean"/>\r
     <xs:element name="supportsDocList" type="xs:boolean"/>\r
index 7f22bd1cdfc9dd7ba4207c76f1e4e7b7aa32ed4c..78c6ef25ce88c426ed5a21ce1920b0511aa7a079 100644 (file)
@@ -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<String> docTypes = new ArrayList<String>();
+       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<String> 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<String> docTypeList = forDocTypes.getForDocType();
+        docTypeList.addAll(forDocTypeList);
+        reportCommon.setForDocTypes(forDocTypes);
         reportCommon.setSupportsSingleDoc(supportsSingle);
         reportCommon.setSupportsDocList(supportsList);
         reportCommon.setSupportsGroup(supportsGroup);
index e477850eb65ec7b9391f6df1bf4c28f1d4f3d2ab..b5637a625d2c4bdff89c549500cb1bfefe5f7eff 100644 (file)
 <!-- See http://wiki.collectionspace.org/display/collectionspace/Report+Schema -->    
     
     <!-- report  -->
-    <xs:element name="reports_common">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element name="csid" type="xs:string" />
-                <xs:element name="name" type="xs:string"/>
-                <xs:element name="notes" type="xs:string"/>
-                <xs:element name="forDocType" type="xs:string"/>
-                <xs:element name="supportsNoContext" type="xs:boolean"/>
-                <xs:element name="supportsSingleDoc" type="xs:boolean"/>
-                <xs:element name="supportsDocList" type="xs:boolean"/>
-                <xs:element name="supportsGroup" type="xs:boolean"/>
-                <!-- NYI <xs:element name="supportsQuery" type="xs:boolean"/>  -->
-                <xs:element name="filename" type="xs:string"/>
-                <xs:element name="outputMIME" type="xs:string"/>
-            </xs:sequence>
-        </xs:complexType>
-    </xs:element>
+       <xs:element name="reports_common">
+               <xs:complexType>
+                       <xs:sequence>
+                               <xs:element name="csid" type="xs:string" />
+                               <xs:element name="name" type="xs:string" />
+                               <xs:element name="notes" type="xs:string" />
+                               <xs:element name="forDocTypes">
+                                       <xs:complexType>
+                                               <xs:sequence>
+                                                       <xs:element name="forDocType" type="xs:string"
+                                                               minOccurs="1" maxOccurs="unbounded" />
+                                               </xs:sequence>
+                                       </xs:complexType>
+                               </xs:element>
+                               <xs:element name="supportsNoContext" type="xs:boolean" />
+                               <xs:element name="supportsSingleDoc" type="xs:boolean" />
+                               <xs:element name="supportsDocList" type="xs:boolean" />
+                               <xs:element name="supportsGroup" type="xs:boolean" />
+                               <!-- NYI <xs:element name="supportsQuery" type="xs:boolean"/> -->
+                               <xs:element name="filename" type="xs:string" />
+                               <xs:element name="outputMIME" type="xs:string" />
+                       </xs:sequence>
+               </xs:complexType>
+       </xs:element>
     
     <!-- This is the base class for paginated lists -->
     <xs:complexType name="abstractCommonList">
index f65005d998e3adf4d2760537ea95517a86864a96..a6adec409c857cd2b903e662a0a38143128d08e0 100644 (file)
@@ -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<String> forDocTypeList = 
+                               (List<String>)docModel.getPropertyValue(InvocableJAXBSchema.FOR_DOC_TYPES);
+                       if(forDocTypeList==null
+                                       || !forDocTypeList.contains(invContext.getDocType())) {
                        throw new BadRequestException(
                                        "ReportResource: Invoked with unsupported document type: "
                                        +invContext.getDocType());
index db40ddf927e0165631ec5bde119200a1c015da7d..36ec574e1c604013b9aa63a7e1ce5114592f3890 100644 (file)
@@ -121,7 +121,7 @@ public class ReportDocumentModelHandler
     public ReportsCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> 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<ReportsCommonList.ReportListItem> list = coList.getReportListItem();
         Iterator<DocumentModel> 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);