← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13905: Config resource, minor fix

 

------------------------------------------------------------
revno: 13905
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-01-31 14:41:52 +0200
message:
  Config resource, minor fix
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConfigurationController.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/api/controller/ConfigurationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConfigurationController.java	2014-01-31 07:50:07 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConfigurationController.java	2014-01-31 12:41:52 +0000
@@ -50,55 +50,49 @@
     @RequestMapping( value = "/systemId", method = RequestMethod.GET )
     private String getSystemId( Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getSystemId() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getSystemId() );
     }
 
     @RequestMapping( value = "/feedbackRecipients", method = RequestMethod.GET )
     private String getFeedbackRecipients(  Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getFeedbackRecipients() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getFeedbackRecipients() );
     }
     
     @RequestMapping( value = "/offlineOrganisationUnitLevel", method = RequestMethod.GET )
     private String getOfflineOrganisationUnitLevel(  Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getOfflineOrganisationUnitLevel() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getOfflineOrganisationUnitLevel() );
     }
 
     @RequestMapping( value = "/infrastructuralDataElements", method = RequestMethod.GET )
     private String getInfrastructuralDataElements( Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getInfrastructuralDataElements() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getInfrastructuralDataElements() );
     }
 
     @RequestMapping( value = "/infrastructuralPeriodType", method = RequestMethod.GET )
     private String getInfrastructuralPeriodType( Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getInfrastructuralPeriodType() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getInfrastructuralPeriodTypeDefaultIfNull().getName() );
     }
 
     @RequestMapping( value = "/selfRegistrationRole", method = RequestMethod.GET )
     private String getSelfRegistrationRole( Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getSelfRegistrationRole() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getSelfRegistrationRole() );
     }
 
     @RequestMapping( value = "/selfRegistrationOrgUnit", method = RequestMethod.GET )
     private String getSelfRegistrationOrgUnit( Model model, HttpServletRequest request )
     {
-        setModel( model, configurationService.getConfiguration().getSelfRegistrationOrgUnit() );
-        return "config";
+        return setModel( model, configurationService.getConfiguration().getSelfRegistrationOrgUnit() );
     }
 
-    private void setModel( Model model, Object entity )
+    private String setModel( Model model, Object entity )
     {
         model.addAttribute( "model", entity );
         model.addAttribute( "viewClass", "detailed" );
+        return "config";
     }
 }