Customizing Reports

Get Adobe Flash player

From the XNAT Workshop: A walkthrough on building a custom report for a PI. https://vimeo.com/47269947


The XNAT application uses Apache Turbine for its model-view-controller structure. This allows for easy creation of secured reports. Each report has two primary components:

  • A backing Java class that can be used to marshal and prepare data for display
  • A Velocity template, which formats the data display
For any report you create, you will need to create both of these components.

The xnat_builder setup and update scripts automatically generate report pages and backing Java classes for root-level data elements.

  • The default backing Java classes are located in the xnat_builder/projects/project/src/java/org/nrg/xdat/turbine/modules/screens folder
  • The default Velocity templates pages are located in the xnat_builder/projects/project/src/base-templates/screens directory

You can use these generated files as a starting point for your custom report pages:

  1. Locate the generated report VM file for your data type. It can be found in the xnat_builder/projects/project/src/base-templates/screens folder and be titled XDATScreen_report_ns_dataType.vm, where ns is the namespace for your data type and dataType is the full name of the data type.
  2. Copy the generated report VM into the src/main/templates folder of your module or into the customization xnat_builder/projects/project/src/templates/screens directory if you're deploying customizations directly.
  3. Edit the file to remove any fields which you don't want visible, restructure the page to present the data in a more viewable or usable format, reference graphics or charting function, etc.
  4. Save the file.
  5. Update your XNAT installation (re-deploy the application if necessary). VM files are loaded at each request so your application server does not need to be restarted to reflect changes that only affect your VM templates.

See Also

$label.name