← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22294: Code style

 

------------------------------------------------------------
revno: 22294
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-14 13:18:09 +0100
message:
  Code style
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetReportController.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/DataSetReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetReportController.java	2016-03-14 12:10:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetReportController.java	2016-03-14 12:18:09 +0000
@@ -36,11 +36,9 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.FormType;
 import org.hisp.dhis.datasetreport.DataSetReportService;
-import org.hisp.dhis.dxf2.webmessage.WebMessage;
 import org.hisp.dhis.dxf2.webmessage.WebMessageException;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
@@ -54,9 +52,7 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.io.Writer;
 import java.util.*;
 
@@ -67,7 +63,6 @@
 @RequestMapping( value = "/datasetreport" )
 public class DataSetReportController
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -79,9 +74,6 @@
     private DataSetService dataSetService;
 
     @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
     private PeriodService periodService;
 
     @Autowired
@@ -103,28 +95,29 @@
         @RequestParam String ou,
         @RequestParam( required = false ) Set<String> dimension,
         @RequestParam( required = false ) boolean selectedUnitOnly,
-        @RequestParam( required = false ) String type
-    )
+        @RequestParam( required = false ) String type )
         throws Exception
     {
         OrganisationUnit selectedOrgunit = idObjectManager.get(OrganisationUnit.class, ou);
         DataSet selectedDataSet = dataSetService.getDataSet( ds );
-        Period selectedPeriod = PeriodType.getPeriodFromIsoString( pe );
-        selectedPeriod = periodService.reloadPeriod( selectedPeriod );
+        Period selectedPeriod = PeriodType.getPeriodFromIsoString( pe );        
 
-        if(selectedOrgunit == null) {
+        if ( selectedOrgunit == null )
+        {
             throw new WebMessageException( WebMessageUtils.conflict( "Illegal organisation unit identifier: " + ou ) );
         }
 
-        if(selectedDataSet == null) {
+        if ( selectedDataSet == null )
+        {
             throw new WebMessageException( WebMessageUtils.conflict( "Illegal data set identifier: " + ds ) );
         }
 
-        if(selectedPeriod == null) {
+        if ( selectedPeriod == null )
+        {
             throw new WebMessageException( WebMessageUtils.conflict( "Illegal period identifier: " + pe ) );
         }
 
-
+        selectedPeriod = periodService.reloadPeriod( selectedPeriod );
 
         String customDataEntryFormCode = null;
         List<Grid> grids = new ArrayList<>();
@@ -135,9 +128,7 @@
         // Configure response
         // ---------------------------------------------------------------------
 
-        contextUtils
-            .configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, null,
-                false );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
 
         // ---------------------------------------------------------------------
         // Assemble report
@@ -147,28 +138,28 @@
         {
             if ( type != null )
             {
-                grids = dataSetReportService
-                    .getCustomDataSetReportAsGrid( selectedDataSet, selectedPeriod, selectedOrgunit, dimension,
-                        selectedUnitOnly, i18nManager.getI18nFormat() );
+                grids = dataSetReportService.getCustomDataSetReportAsGrid( 
+                    selectedDataSet, selectedPeriod, selectedOrgunit, dimension,
+                    selectedUnitOnly, i18nManager.getI18nFormat() );
             }
             else
             {
-                customDataEntryFormCode = dataSetReportService
-                    .getCustomDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension,
-                        selectedUnitOnly, i18nManager.getI18nFormat() );
+                customDataEntryFormCode = dataSetReportService.getCustomDataSetReport( 
+                    selectedDataSet, selectedPeriod, selectedOrgunit, dimension,
+                    selectedUnitOnly, i18nManager.getI18nFormat() );
             }
         }
         else if ( formType.isSection() )
         {
-            grids = dataSetReportService
-                .getSectionDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly,
-                    i18nManager.getI18nFormat(), i18nManager.getI18n() );
+            grids = dataSetReportService.getSectionDataSetReport( 
+                selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly,
+                i18nManager.getI18nFormat(), i18nManager.getI18n() );
         }
         else
         {
-            grids = dataSetReportService
-                .getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly,
-                    i18nManager.getI18nFormat(), i18nManager.getI18n() );
+            grids = dataSetReportService.getDefaultDataSetReport( 
+                selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly,
+                i18nManager.getI18nFormat(), i18nManager.getI18n() );
         }
 
         // ---------------------------------------------------------------------