]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-670: Adding new InvocationContext field for specifying MIME type when generating...
authorRichard Millet <remillet@yahoo.com>
Fri, 21 Jun 2019 00:53:06 +0000 (17:53 -0700)
committerRichard Millet <remillet@yahoo.com>
Fri, 21 Jun 2019 01:00:03 +0000 (18:00 -0700)
services/jaxb/src/main/resources/invocationContext.xsd
services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java

index b4f2347222fb9110c82327628718b5e6205a4e58..2da78da2ed07e1c123aa3f2a2d6c1f5be1434b4e 100644 (file)
@@ -13,6 +13,7 @@
     <xs:element name="invocationContext">
         <xs:complexType>
             <xs:sequence>
+                <xs:element name="outputMIME" type="xs:string"></xs:element>
                 <xs:element name="mode" type="xs:string"></xs:element>
                 <xs:element name="updateCoreValues" type="xs:string"></xs:element>
                 <xs:element name="docType" type="xs:string"></xs:element>
index 0256887ebf24c791e005d63fdfc50448f41c6698..4e37787ae434ab3127c07cc2f07a872b52ed65d0 100644 (file)
@@ -124,10 +124,10 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
                        modeProperty = InvocableJAXBSchema.SUPPORTS_DOC_LIST;
                        List<String> csids = null;
                        InvocationContext.ListCSIDs listThing = invContext.getListCSIDs();
-                               if(listThing!=null) {
+                               if (listThing!=null) {
                                        csids = listThing.getCsid();
                                }
-                               if(csids==null||csids.isEmpty()){
+                               if (csids==null||csids.isEmpty()){
                                throw new BadRequestException(
                                                "ReportResource: Report invoked in list mode, with no csids in list." );
                                }
@@ -180,12 +180,21 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
                        }
                }
                reportFileNameProperty = (String) NuxeoUtils.getProperyValue(docModel, ReportJAXBSchema.FILENAME); //docModel.getPropertyValue(ReportJAXBSchema.FILENAME)); // Set the outgoing param with the report file name
-                       String reportOutputMime = (String) NuxeoUtils.getProperyValue(docModel, ReportJAXBSchema.OUTPUT_MIME); //docModel.getPropertyValue(ReportJAXBSchema.OUTPUT_MIME);
-                       if(!Tools.isEmpty(reportOutputMime)) {
-                               outMimeType.append(reportOutputMime);
-                       } else {
-                               outMimeType.append(ReportClient.DEFAULT_REPORT_OUTPUT_MIME);
-                       }
+                       //
+               // If the invocation context contains a MIME type then use it.  Otherwise, look in the report resource.  If no MIME type in the report resource,
+               // use the default MIME type.
+               //
+               if (!Tools.isEmpty(invContext.getOutputMIME())) {
+                       outMimeType.append(invContext.getOutputMIME());
+               }
+               if (outMimeType == null || Tools.isEmpty(outMimeType.toString())) {
+               String reportOutputMime = (String) NuxeoUtils.getProperyValue(docModel, ReportJAXBSchema.OUTPUT_MIME); //docModel.getPropertyValue(ReportJAXBSchema.OUTPUT_MIME);
+                       if (!Tools.isEmpty(reportOutputMime)) {
+                               outMimeType.append(reportOutputMime);
+                       } else {
+                               outMimeType.append(ReportClient.DEFAULT_REPORT_OUTPUT_MIME);
+                       }
+               }
                } catch (PropertyException pe) {
                        if (logger.isDebugEnabled()) {
                                logger.debug("Property exception getting batch values: ", pe);