← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1903: Bug Fixed: MultiDatasets Locking

 

------------------------------------------------------------
revno: 1903
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-08-06 12:24:49 +0530
message:
  Bug Fixed: MultiDatasets Locking
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/CollectiveDataLockingAction.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-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/CollectiveDataLockingAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/CollectiveDataLockingAction.java	2010-08-05 15:15:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/CollectiveDataLockingAction.java	2010-08-06 06:54:49 +0000
@@ -356,8 +356,12 @@
     {
         for ( DataSet dataSet : dataSets )
         {
-            Set<Source> dataSetOrganisationUnits = dataSet.getSources();
-            selectedOrganisationUnitsSource.retainAll( dataSetOrganisationUnits );
+            Set<Source> dataSetOrganisationUnits = dataSet.getSources();            
+            Set<Source> selOrgUnitSource = new HashSet<Source>();
+            
+            selOrgUnitSource.addAll( selectedOrganisationUnitsSource );
+            
+            selOrgUnitSource.retainAll( dataSetOrganisationUnits );
             
             for ( Period period : selectedPeriods )
             {
@@ -365,8 +369,8 @@
                 if ( dataSetLock != null )
                 {
                     Set<Source> lockedOrganisationUnitsSource = dataSetLock.getSources();
-                    selectedOrganisationUnitsSource.removeAll( lockedOrganisationUnitsSource );
-                    dataSetLock.getSources().addAll( selectedOrganisationUnitsSource );
+                    selOrgUnitSource.removeAll( lockedOrganisationUnitsSource );
+                    dataSetLock.getSources().addAll( selOrgUnitSource );
                     dataSetLock.setTimestamp( new Date() );
                     dataSetLock.setStoredBy( currentUserService.getCurrentUsername() );
                     dataSetLockService.updateDataSetLock( dataSetLock );
@@ -375,7 +379,7 @@
                 {
                     dataSetLock = new DataSetLock();
                     dataSetLock.setPeriod( period );
-                    dataSetLock.setSources( selectedOrganisationUnitsSource );
+                    dataSetLock.setSources( selOrgUnitSource );
                     dataSetLock.setDataSet( dataSet );
                     dataSetLock.setTimestamp( new Date() );
                     dataSetLock.setStoredBy( currentUserService.getCurrentUsername() );
@@ -390,7 +394,10 @@
         for ( DataSet dataSet : dataSets )
         {
             Set<Source> dataSetOrganisationUnits = dataSet.getSources();
-            selectedOrganisationUnitsSource.retainAll( dataSetOrganisationUnits );
+            Set<Source> selOrgUnitSource = new HashSet<Source>();
+            
+            selOrgUnitSource.addAll( selectedOrganisationUnitsSource );
+            selOrgUnitSource.retainAll( dataSetOrganisationUnits );
 
             for ( Period period : selectedPeriods )
             {
@@ -398,8 +405,8 @@
                 if ( dataSetLock != null )
                 {
                     Set<Source> lockedOrganisationUnitsSource = dataSetLock.getSources();
-                    selectedOrganisationUnitsSource.retainAll( lockedOrganisationUnitsSource );
-                    dataSetLock.getSources().removeAll( selectedOrganisationUnitsSource );
+                    selOrgUnitSource.retainAll( lockedOrganisationUnitsSource );
+                    dataSetLock.getSources().removeAll( selOrgUnitSource );
                     dataSetLock.setTimestamp( new Date() );
                     dataSetLock.setStoredBy( currentUserService.getCurrentUsername() );
                     dataSetLockService.updateDataSetLock( dataSetLock );
@@ -429,8 +436,6 @@
         return orgUnitTree;
     }
 
-    // getChildOrgUnitTree end
-
     public Set<Source> getCurrentUserOrgnaisationUnits()
     {
         Set<Source> selectedOrganisationUnitsSource = new HashSet<Source>();