dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36789
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18810: SQL view controller, not found response
------------------------------------------------------------
revno: 18810
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-04-04 09:29:07 +0200
message:
SQL view controller, not found response
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java 2015-02-11 22:32:01 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java 2015-04-04 07:29:07 +0000
@@ -67,6 +67,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return null;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
model.addAttribute( "model", grid );
@@ -84,6 +90,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
@@ -98,6 +110,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "sqlview.csv", true );
@@ -112,6 +130,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "sqlview.xls", true );
@@ -126,6 +150,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
@@ -140,6 +170,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
@@ -154,6 +190,12 @@
{
SqlView sqlView = sqlViewService.getSqlViewByUid( uid );
+ if ( sqlView == null )
+ {
+ ContextUtils.notFoundResponse( response, "SQL view does not exist: " + uid );
+ return;
+ }
+
Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.RESPECT_SYSTEM_SETTING );