← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11174: Chart web api, check for existence of chart

 

------------------------------------------------------------
revno: 11174
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-06-08 18:53:04 +0200
message:
  Chart web api, check for existence of chart
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/resources/html-report-template.html
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/html-report-template.html'
--- dhis-2/dhis-support/dhis-support-system/src/main/resources/html-report-template.html	2013-05-15 13:39:24 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/resources/html-report-template.html	2013-06-08 16:53:04 +0000
@@ -19,7 +19,7 @@
 
 </div>
 
-<!-- Remove content after this line after reading it -->
+<!-- Remove all content after this line after reading it -->
 
 <h3>This is a template for HTML/javascript based reports</h3>
 
@@ -35,7 +35,7 @@
 You can utilize the DHIS 2 Web API to render meta-data and data in your report. 
 The Web API can be accessed from ../api. For instance, to retrieve the first page
 of data elements in JSON format you can link to ../api/dataElements.json. To 
-get access to aggregate data you can utilize the analytics controller at
+get access to aggregate data you can utilize the analytics resource at
 ../api/analytics.</p>
 
 <p>

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2013-06-05 12:45:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2013-06-08 16:53:04 +0000
@@ -166,6 +166,12 @@
     {
         Chart chart = chartService.getChartNoAcl( uid );
 
+        if ( chart == null )
+        {
+            ContextUtils.notFoundResponse( response, "Chart does not exist: " + uid );
+            return;
+        }
+        
         OrganisationUnit unit = ou != null ? organisationUnitService.getOrganisationUnit( ou ) : null;
         
         JFreeChart jFreeChart = chartService.getJFreeChart( chart, date, unit, i18nManager.getI18nFormat() );