← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20218: AbstractCrudController. Made getEntity( String uid ) private so that it cannot be overriden, erro...

 

------------------------------------------------------------
revno: 20218
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 17:49:41 +0200
message:
  AbstractCrudController. Made getEntity( String uid ) private so that it cannot be overriden, error prone since not all methods in AbstractCrudController actually calls this method but rather getEntity( String uid, WebOptions options )
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.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/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2015-09-14 17:57:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2015-09-17 15:49:41 +0000
@@ -109,6 +109,8 @@
  */
 public abstract class AbstractCrudController<T extends IdentifiableObject>
 {
+    protected static final WebOptions NO_WEB_OPTIONS = new WebOptions( new HashMap<>() );
+    
     //--------------------------------------------------------------------------
     // Dependencies
     //--------------------------------------------------------------------------
@@ -912,10 +914,7 @@
         return entityList;
     }
 
-    /**
-     * Should not be overridden, instead override {@link getEntity(String, WebOptions}.
-     */
-    protected final List<T> getEntity( String uid )
+    private final List<T> getEntity( String uid )
     {
         return getEntity( uid, new WebOptions( new HashMap<>() ) );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java	2015-09-15 10:15:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java	2015-09-17 15:49:41 +0000
@@ -127,7 +127,7 @@
     public void deleteObject( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response )
         throws Exception
     {
-        List<Dashboard> objects = getEntity( uid );
+        List<Dashboard> objects = getEntity( uid, NO_WEB_OPTIONS );
 
         if ( objects.isEmpty() )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java	2015-09-15 11:43:48 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java	2015-09-17 15:49:41 +0000
@@ -152,7 +152,7 @@
         @RequestParam( value = "comment", defaultValue = "true", required = false ) boolean comment,
         HttpServletResponse response ) throws IOException, WebMessageException
     {
-        List<DataSet> dataSets = getEntity( uid );
+        List<DataSet> dataSets = getEntity( uid, NO_WEB_OPTIONS );
 
         if ( dataSets.isEmpty() )
         {
@@ -170,7 +170,7 @@
         @RequestParam( value = "pe", required = false ) String period,
         @RequestParam( required = false ) boolean metaData, HttpServletResponse response ) throws IOException, WebMessageException
     {
-        List<DataSet> dataSets = getEntity( uid );
+        List<DataSet> dataSets = getEntity( uid, NO_WEB_OPTIONS );
 
         if ( dataSets.isEmpty() )
         {
@@ -198,7 +198,7 @@
         @RequestParam( value = "pe", required = false ) String period,
         @RequestParam( required = false ) boolean metaData, HttpServletResponse response ) throws IOException, WebMessageException
     {
-        List<DataSet> dataSets = getEntity( uid );
+        List<DataSet> dataSets = getEntity( uid, NO_WEB_OPTIONS );
 
         if ( dataSets.isEmpty() )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java	2015-07-13 09:52:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java	2015-09-17 15:49:41 +0000
@@ -75,7 +75,7 @@
         Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
-        List<DataElementGroup> dataElementGroups = getEntity( uid );
+        List<DataElementGroup> dataElementGroups = getEntity( uid, NO_WEB_OPTIONS );
         translate( dataElementGroups, translateParams );
 
         if ( dataElementGroups.isEmpty() )
@@ -121,7 +121,7 @@
         HttpServletResponse response ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
-        List<DataElementGroup> dataElementGroups = getEntity( uid );
+        List<DataElementGroup> dataElementGroups = getEntity( uid, NO_WEB_OPTIONS );
         translate( dataElementGroups, translateParams );
 
         if ( dataElementGroups.isEmpty() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2015-09-14 17:57:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2015-09-17 15:49:41 +0000
@@ -362,7 +362,7 @@
     @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" } )
     public void putXmlObject( ImportOptions importOptions, @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
-        List<User> users = getEntity( pvUid );
+        List<User> users = getEntity( pvUid, NO_WEB_OPTIONS );
 
         if ( users.isEmpty() )
         {
@@ -399,7 +399,7 @@
     @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
     public void putJsonObject( ImportOptions importOptions, @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
-        List<User> users = getEntity( pvUid );
+        List<User> users = getEntity( pvUid, NO_WEB_OPTIONS );
 
         if ( users.isEmpty() )
         {