dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33632
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17204: refresh item instance from session when owner.collection changes
------------------------------------------------------------
revno: 17204
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-22 14:36:17 +0700
message:
refresh item instance from session when owner.collection changes
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 2014-10-21 13:31:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-10-22 07:36:17 +0000
@@ -31,7 +31,10 @@
import com.google.common.base.Enums;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
+import org.hibernate.LockOptions;
+import org.hibernate.SessionFactory;
import org.hisp.dhis.acl.AclService;
+import org.hisp.dhis.cache.HibernateCacheManager;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
@@ -66,14 +69,12 @@
import org.hisp.dhis.webapi.webdomain.WebMetaData;
import org.hisp.dhis.webapi.webdomain.WebOptions;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ResponseStatus;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -126,6 +127,9 @@
@Autowired
protected ContextService contextService;
+ @Autowired
+ private SessionFactory sessionFactory;
+
//--------------------------------------------------------------------------
// GET
//--------------------------------------------------------------------------
@@ -579,6 +583,7 @@
throw new DeleteAccessDeniedException( "You don't have the proper permissions to delete this object." );
}
+ sessionFactory.getCurrentSession().refresh( candidate );
manager.update( objects.get( 0 ) );
}
@@ -647,6 +652,7 @@
throw new DeleteAccessDeniedException( "You don't have the proper permissions to delete this object." );
}
+ sessionFactory.getCurrentSession().refresh( candidate );
manager.update( objects.get( 0 ) );
}