Working with Dashboards

This section describes functionality that can be restricted by the software license for JasperReports Server. If you don’t see some of the options described in this section, your license may prohibit you from using them. To find out what you're licensed to use, or to upgrade your license, contact Jaspersoft.

The resource service also gives access to dashboard resources in commercial editions of JasperReports Server. Dashboards are managed as normal resources whose descriptors can be created, viewed, modified, or deleted with the resource service. However, dashboards can be viewed only through the web interface of JasperReports Server because they do not have any output format that can be generated or transmitted through the REST API.

Therefore, an application using the REST API can only manipulate the definition of the dashboard, that is the selection of reports to display and their layout. In order to work with a dashboard, your application must parse its resource descriptor, make changes, and generate a new, valid descriptor to send back to the server.

The general structure of a dashboard descriptor contains:

Typical descriptor properties such as label, description, and PROP_PARENT_FOLDER.
The dashboardState descriptor containing:
     The ADHOC_FRAMES property that lists the reports, labels, and buttons, and gives their coordinates in the dashboard.
     The ADHOC_PROPERTIES property that gives the overall dashboard layout properties.
reference descriptors for each of the reports included in the ADHOC_FRAMES property. These references ensure that the reports can’t be deleted from the repository as long as they are used in this dashboard.

The following example shows the contents of a dashboard’s resource descriptor:

<resourceDescriptor name="SampleDashboard"
  wsType="dashboard" uriString="/Dashboards/SampleDashboard" isNew="false">
  <label>Sample Dashboard</label>
  <description>Created in Dashboard Designer, viewed through REST.</description>
  <creationDate>1318380317305</creationDate>
  <resourceProperty name="PROP_RESOURCE_TYPE">
    <value>com.jaspersoft.ji.adhoc.DashboardResource</value></resourceProperty>
  <resourceProperty name="PROP_PARENT_FOLDER"><value>/Dashboards</value>
  </resourceProperty>
  <resourceProperty name="PROP_VERSION"><value>0</value></resourceProperty>
  <resourceProperty name="PROP_HAS_DATA"><value>false</value></resourceProperty>
  <resourceDescriptor name="" wsType="dashboardState" uriString="" isNew="false">
    <label>null</label>
    <creationDate>1318380317305</creationDate>
    <resourceProperty name="PROP_RESOURCE_TYPE"><value>dashboardState</value>
    </resourceProperty>
    <resourceProperty name="PROP_PARENT_FOLDER">
      <value>/Dashboards/SampleDashboard</value></resourceProperty>
    <resourceProperty name="ADHOC_PAPER_SIZE"><value>content</value>
    </resourceProperty>
    <resourceProperty name="ADHOC_FRAMES">
      <value>frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameLeft=0;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameTop=0;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameWidth=246;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameHeight=405;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceType=
  com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceName=
  Top Fives Report;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameSource=%2Fflow.html
  %3F_flowId%3DviewReportFlow%26viewAsDashboardFrame%3Dtrue%26reportUnit%3D;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashResourceIndex=0;
frame_1,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameScrollBars=false;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameLeft=254;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameTop=0;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameWidth=450;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameHeight=418;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceType=
  com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceName=
  Sales By Month Report;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameSource=%2Fflow.html
  %3F_flowId%3DviewReportFlow%26viewAsDashboardFrame%3Dtrue%26reportUnit%3D;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashResourceIndex=1;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameScrollBars=false;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceType=
  com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceName=
  Sales By Month Report;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameSource=%2Fflow.html
  %3F_flowId%3DviewReportFlow%26viewAsDashboardFrame%3Dtrue%26reportUnit%3D;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashResourceIndex=1;
frame_2,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameScrollBars=false;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameLeft=712;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameTop=0;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameWidth=200;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameHeight=350;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceType=
  com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameResourceName=
  Sales Gauges Report;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameSource=%2Fflow.html
  %3F_flowId%3DviewReportFlow%26viewAsDashboardFrame%3Dtrue%26reportUnit%3D;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashResourceIndex=2;
frame_3,com.jaspersoft.ji.adhoc.DashboardContentFrame,dashFrameScrollBars=false;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameLeft=736;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameTop=352;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameWidth=66;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameHeight=16;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashTextFrameLabel=Start Month;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,fontResizes=false;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashTextFrameFontSize=11;
text_2,com.jaspersoft.ji.adhoc.DashboardTextFrame,maxFontSize=11;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameLeft=816;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameTop=352;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameWidth=85;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameHeight=16;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameParamName=
  startMonth;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameParamValue=
  1;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameDefaultParam
  Value=1;
control_2,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameDataType=
  String;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameLeft=744;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameTop=376;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameWidth=59;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashFrameHeight=16;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashTextFrameLabel=End Month;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,fontResizes=false;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,dashTextFrameFontSize=11;
text_3,com.jaspersoft.ji.adhoc.DashboardTextFrame,maxFontSize=11;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameLeft=816;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameTop=376;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameWidth=85;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashFrameHeight=16;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameParamName=
  endMonth;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameParamValue=
  12;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameDefaultParam
  Value=12;
control_3,com.jaspersoft.ji.adhoc.DashboardControlFrame,dashControlFrameDataType=
  String;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameLeft=832;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameTop=400;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameWidth=72;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameHeight=24;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashClickableFrameID=
  submit;
button_1,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashClickableFrameType=
  button;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameLeft=744;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameTop=400;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameWidth=72;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashFrameHeight=24;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashClickableFrameID=reset;
button_2,com.jaspersoft.ji.adhoc.DashboardClickableFrame,dashClickableFrameType=
  button;
      </value>
    </resourceProperty>
    <resourceProperty name="ADHOC_PROPERTIES">
      <value>layoutSize=1024x768;
        useAbsoluteSizing=true;
        paperSize=content;
        LayoutLeft=286;
        paramValuesChanged=true;
        LayoutTop=176;
        localDatePattern=MM-dd-yyyy;
      </value>
    </resourceProperty>
  </resourceDescriptor>
  <resourceDescriptor name="" wsType="reference" uriString="" isNew="false">
    <label>null</label>
    <resourceProperty name="PROP_REFERENCE_URI">
      <value>/supermart/details/TopFivesReport</value></resourceProperty>
  </resourceDescriptor>
  <resourceDescriptor name="" wsType="reference" uriString="" isNew="false">
    <label>null</label>
    <resourceProperty name="PROP_REFERENCE_URI">
      <value>/supermart/salesByMonth/SalesByMonthReport</value></resourceProperty>
  </resourceDescriptor>
  <resourceDescriptor name="" wsType="reference" uriString="" isNew="false">
    <label>null</label>
    <resourceProperty name="PROP_REFERENCE_URI">
      <value>/supermart/revenueAndProfit/SalesGaugesReport</value>
    </resourceProperty>
  </resourceDescriptor>
</resourceDescriptor>
Version: 
Feedback
randomness