...
Steps to create a new report in Jaspersoft Studio:
- Create a new datasource to access the data in your repository. The easiest way is to select Window->Welcome to iReport, and then use the Quick Start wizard to create a new database connection.
- Click the Step 1 - Create a new database connection link.
- Select Database JDBC connection
- Type in a name you choose to refer to this connection (E.g., "Our Museum on CollectionSpace")
- In the JDBC URL Wizard section, type in the name (or IP address) of the server that runs your database, and enter "nuxeo" in the Database field, and then click on the Wizard button to generate the JDBC URL.
- Enter "reader" for the Username, and your local password.
- Click on the Test button to ensure your entries are correct.
- Create a new report. The easiest way is to use the Quick Start wizard on the Welcome window:
- Click the Step 2 - Create a new report link.
- Select a template you like, and click the Launch Report Wizard button.
- Set a name and location, and click Next.
- Choose the datasource your defined in Step 4 above.
- Click Design Query, select a table (e.g., collectionobjects_common), choose fields, and complete the wizard according to the tutorials.
You can explore the report authoring tool from this basic report. You will likely want to rename the labels, as the default labels based upon the data-model are not very user-friendly. In addition, certain fields will benefit from some expressions to simplify the value. For example, field values that refer to authority terms (Person, Org, etc.) can be easily converted to a display value using the following expression, replacing "field" with the field name you are accessing:
...
In order to make the report available to CollectionSpace, you must follow 2 steps:
- Copy the compiled .jasper jrxml file to the reports folder: . Transfer the report file to the cspace/reports directory within the Tomcat server folder (whose path should be in your the
CSPACE_JEESERVER_HOME
environment variable). Note the name of the file, e.g., "acq_basic.jasperjrxml".Tip Beginning with CollectionSpace version 3.2.1, you can instead copy your original .jrxml file (rather than your compiled .jasper file) to the reports folder. Doing so will make it easier to keep your compiled reports to date when JasperReports is updated.
See http://wiki.collectionspace.org/display/collectionspace/Release+3.2.1#Release3.2.1-AutomaticupdatingofreportsusingnewJasperReportsversions%28CSPACE4876 for details.
- Create a report record within Prepare a report record to register the report with CollectionSpace. This requires you to run a simple a curl command in v5.x. Here is an example XML payload to use with curl. It declares that a report based upon the file to send the record to the server's REST API. The following example declares that the report "acq_basic.jasperjrxml" should be created and should be shown to users when they are editing Acquisition records. In the v5.x release, the supportsDocList and supportsGroup elements should always have the values "false" (future versions of CollectionSpace will let users run reports on lists of records, and on groups of records). You can set the default outputMIME type as you wish, so long as it is one of the supported jasper output types, and so long as your browser knows how to handle these files (or pass them to a program that does)Set the
outputMIME
value to the desired default output type for the report. This can be any output type supported by JasperReports.
Code Block |
---|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <document name="report"> <ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report"> <name>Sample Acquisition Report</name> <notes>This is a sample Acquisition report.</notes> <forDocTypes> <forDocType>Acquisition</forDocType> </forDocTypes> <supportsSingleDoc>true</supportsSingleDoc> <supportsDocList>false</supportsDocList> <supportsGroup>false</supportsGroup> <supportsNoContext>true</supportsNoContext> <filename>acq_basic.jasper<jrxml</filename> <outputMIME>application/pdf</outputMIME> </ns2:reports_common> </document> |
Then You (or your admin) can use the following command to create the report record in CollectionSpace. Replace "{yourtenant}" with the name of your tenant, and replace "{password}" with your admin password. This assumes you have saved the XML file above as "report1report.xml"
Code Block |
---|
curl -X POST http://localhost:8180/cspace-services/reports -i -u admin@{yourtenant}.collectionspace.org:{password} -H "Content-Type: application/xml" -T report1report.xml |
Documents and "forDocType" values
...