Component | Category | Description |
---|---|---|
PUZZLE Reporter Plugin 1.0.2 | Dependency | PUZZLE core version 49.2.0. |
Improvement | Initial version. |
This PUZZLE plugin allows a client to request PUZZLE to create a report for a solution of a job. A report is a document based on a template filled with values from a solution of a job.
PUZZLE creates reports for a solution on demand. When you request PUZZLE to create a report, PUZZLE performs the following steps:
PUZZLE interprets the template
attribute of the request body as a url
PUZZLE downloads the template file available at this url
PUZZLE processes the template
PUZZLE fills the values of the solution with solutionId
for the job with id jobId
into the template.
PUZZLE resolves any resource reference in the template, by looking in the resourcesUrl
attribute and the default resource directory.
PUZZLE creates the report in the format given in the attribute format
.
The default resource directory is the fallback directory for resolving resource reference. This section describe the resolving process in details.
PUZZLE supports file
and http
url types.
Important: Every URL must be reachable from the point of view of the host running the PUZZLE instance.
By default, a PUZZLE REST installation contains a set of templates in the directory static/templates
and the set of corresponding resources in the directory static/resources
.
The directory static/resources
is used as the default resources directory.
The following table lists all resource references of the default templates.
template | Resource reference | Description |
---|---|---|
en/puzzle_report_pallet_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
en/puzzle_report_box_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
en/puzzle_report_pack_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
en/puzzle_report_pack_plus_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
en/puzzle_report_ship_it_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
de/puzzle_report_pallet_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
de/puzzle_report_box_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
de/puzzle_report_pack_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
de/puzzle_report_pack_plus_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
de/puzzle_report_ship_it_template.jrxml | logo.png | The png image that is used as logo in the upper right corner of the report. |
First PUZZLE tries to resolve resource references with the resourcesUrl
attribute and uses the default resource directory if necessary.
The default resource directory is set by default to ./static/resources
and can be changed using the Reporter.defaultResourcesDirectory
parameter in the puzzle.parameter
file.
For example, the template static/templates/puzzle_pallet_template.jrxml
contains a reference to the resource logo.png
.
If you set resourcesUrl
in a request to http://mypuzzle.de/resources
,
PUZZLE will resolve the resource reference logo.png
with http://mypuzzle.de/resources/logo.png
.
If no file is available at this url, PUZZLE verify if the default resources directory contains a file named logo.png
.
If this file exists, PUZZLE uses this file to resolve the resource reference logo.png
, otherwise PUZZLE returns an error.
If you do not specify a resourcesUrl
, PUZZLE immediately searches for resource references in the default resource directory.
Precondition: the state of the job is DONE.
Create a report for a solution of a job. PUZZLE uses the template and the format specified in the request body.
jobId required | integer <int64> >= 1 Identifier of the job for which PUZZLE should create a report. |
solutionId required | integer >= 1 Identifier of the solution of the specified job for which PUZZLE should create a report. |
format required | string PUZZLE should create a report in this format. Currently supported values are:
|
template required | string A url that references the template to be used to create the report. |
resourcesUrl | string Url used by PUZZLE to resolve the resource reference specified in the |
The generated template in the specified format as a binary stream. The Content-Type depends on the requested format.
There does not exist a job with the given jobId
.
An error occurred.