← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9241: WEB-API: added hooks for post-processing entity lists to ABC CRUD

 

------------------------------------------------------------
revno: 9241
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-12-09 16:46:18 +0300
message:
  WEB-API: added hooks for post-processing entity lists to ABC CRUD
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.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/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2012-11-25 18:27:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2012-12-09 13:46:18 +0000
@@ -82,6 +82,9 @@
             WebUtils.generateLinks( metaData );
         }
 
+        postProcessEntities( entityList );
+        postProcessEntities( entityList, parameters );
+
         model.addAttribute( "model", metaData );
         model.addAttribute( "viewClass", options.getViewClass( "basic" ) );
 
@@ -102,6 +105,9 @@
             WebUtils.generateLinks( metaData );
         }
 
+        postProcessEntities( entityList );
+        postProcessEntities( entityList, parameters );
+
         model.addAttribute( "model", metaData );
         model.addAttribute( "viewClass", options.getViewClass( "basic" ) );
 
@@ -216,19 +222,38 @@
     // Hooks
     //--------------------------------------------------------------------------
 
-    /**
-     * Override to process a single entity after it has been retrieved from
-     * storage and before it is returned to the view. Entity is null-safe.
-     */
-    public void postProcessEntity( T entity ) throws Exception
-    {
-    }
-
-    /**
-     * Override to process a single entity after it has been retrieved from
-     * storage and before it is returned to the view. Entity is null-safe.
-     */
-    public void postProcessEntity( T entity, Map<String, String> parameters ) throws Exception
+
+    /**
+     * Override to process entities after it has been retrieved from
+     * storage and before it is returned to the view. Entities is null-safe.
+     */
+    protected void postProcessEntities( List<T> entityList, Map<String, String> parameters )
+    {
+
+    }
+
+    /**
+     * Override to process entities after it has been retrieved from
+     * storage and before it is returned to the view. Entities is null-safe.
+     */
+    protected void postProcessEntities( List<T> entityList )
+    {
+
+    }
+
+    /**
+     * Override to process a single entity after it has been retrieved from
+     * storage and before it is returned to the view. Entity is null-safe.
+     */
+    protected void postProcessEntity( T entity ) throws Exception
+    {
+    }
+
+    /**
+     * Override to process a single entity after it has been retrieved from
+     * storage and before it is returned to the view. Entity is null-safe.
+     */
+    protected void postProcessEntity( T entity, Map<String, String> parameters ) throws Exception
     {
     }