← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22102: Minor fix, make sure to use updated entity for post hooks in AbstractCrudController

 

------------------------------------------------------------
revno: 22102
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-03-02 12:27:16 +0700
message:
  Minor fix, make sure to use updated entity for post hooks in AbstractCrudController
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/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/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2016-02-12 04:35:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2016-03-02 05:27:16 +0000
@@ -491,12 +491,13 @@
 
         if ( ImportStatus.SUCCESS.equals( importTypeSummary.getStatus() ) )
         {
-            postCreateEntity( parsed );
-
             if ( importTypeSummary.getImportCount().getImported() == 1 && importTypeSummary.getLastImported() != null )
             {
                 response.setHeader( "Location", contextService.getApiPath() + getSchema().getRelativeApiEndpoint()
                     + "/" + importTypeSummary.getLastImported() );
+
+                T entity = manager.get( importTypeSummary.getLastImported() );
+                postCreateEntity( entity );
             }
         }
 
@@ -521,12 +522,13 @@
 
         if ( ImportStatus.SUCCESS.equals( importTypeSummary.getStatus() ) )
         {
-            postCreateEntity( parsed );
-
             if ( importTypeSummary.getImportCount().getImported() == 1 && importTypeSummary.getLastImported() != null )
             {
                 response.setHeader( "Location", contextService.getApiPath() + getSchema().getRelativeApiEndpoint()
                     + "/" + importTypeSummary.getLastImported() );
+
+                T entity = manager.get( importTypeSummary.getLastImported() );
+                postCreateEntity( entity );
             }
         }
 
@@ -562,7 +564,8 @@
 
         if ( ImportStatus.SUCCESS.equals( importTypeSummary.getStatus() ) )
         {
-            postUpdateEntity( parsed );
+            T entity = manager.get( pvUid );
+            postUpdateEntity( entity );
         }
 
         webMessageService.send( WebMessageUtils.importTypeSummary( importTypeSummary ), response, request );
@@ -593,7 +596,8 @@
 
         if ( ImportStatus.SUCCESS.equals( importTypeSummary.getStatus() ) )
         {
-            postUpdateEntity( parsed );
+            T entity = manager.get( pvUid );
+            postUpdateEntity( entity );
         }
 
         webMessageService.send( WebMessageUtils.importTypeSummary( importTypeSummary ), response, request );