...
The forDocType
element is repeatable, so the above report could easily be generalized to a “Related Objects” report runnable from any procedure record type listed in forDocTypes
.
Each forDocType
value should be the objectName
property assigned to the given record type in the UI layer, which corresponds to the NUXEO_DOCTYPE
constant value assigned in the Services layer.
UI objectName values can be found in the cspace-ui.js repository (or relevant profile or extension repositories) under:
src/plugins/recordTypes/{rectype}/serviceConfig.js
NUXEO_DOCTYPE can be found in the services repository under:
...
Where to find the correct docType values
Registered docType
values will be categorized into service groups, available via the /servicegroups
REST-ful API service for the given CollectionSpace instance.
Examples for the Anthro sandbox site:
https://anthro.collectionspace.org/cspace-services/servicegroups/procedure
https://anthro.collectionspace.org/cspace-services/servicegroups/authority
The docType
value for Objects is CollectionObject
(Check /servicegroups/object
for your instance to verify.)
supportsSingleDoc element
...
If true, the report will be available on single-record-type lists of the record types specified in forDocTypes
. The user must select one or more records in the list in order to run the report.
If false, the report is not available in such record lists.
The unique ids of the selected records are passed to the report in the csidlist
parameter.
...
supportsOutputMIMEList
allows you to constrain the output formats available to selection to the ones you specify. Multiple outputMime
elements can be nested inside this element.
The sametop-level, non-nested outputMIME
element selects sets CSV as the preferred default output format.
TODO: Test whether it is necessary to specify the selected outputMIME
if only one format is supported.
Preparing reports for running from within CollectionSpace
To make the report available to CollectionSpaceThe list of currently-supported report output MIME types can be found in the default reportMimeTypes option list configuration.
The above config looks redundant: why specify a preferred output format when there is only one output format? Indeed, the report can be run without specifying the default output format. However, the non-nested/top-level outputMIME
value is used to populate the Default output format in the Tools > Reports screen, so it is best to provide this information.
...
Preparing reports for running from within CollectionSpace
To make the report available to CollectionSpace:
Copy the .jrxml file to the reports directory on the server. Report files should be installed in the cspace/reports directory under the Tomcat directory (whose path should be in the
CSPACE_JEESERVER_HOME
environment variable). Note the name of the file, e.g., "acq_basic.jrxml".Create a report metadata XML record to register the report with CollectionSpace. This record contains information about the report, so that CollectionSpace knows how to run it. You will need to run a curl command to send the record to the server's REST API. The following example declares that the report "acq_basic.jrxml" should be shown to users when they are editing Acquisition records. Set theoutputMIME
value to the desired default output type for the report. This can be any output type supported by JasperReports.
...
.
CollectionSpace admins and any other users with Utility Resources > Reports > Write permission can use the following command to create the report record in CollectionSpace:
Replace
http://localhost:8180
with the base url of your CollectionSpace instance.Replace
{username}
with your CollectionSpace user name and{password}
with your password.This assumes you have saved the XML file discussed above as "
...
acq_basic.xml"
...
and are running the command from the directory containing the file.
Code Block |
---|
curl -X POST http://localhost:8180/cspace-services/reports -i -u admin@{yourtenantusername}.collectionspace.org:{password} -H "Content-Type: application/xml" -T reportacq_basic.xml |
Installing reports automatically
...