← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4278: update orgunitversion for every update to a orgunit

 

------------------------------------------------------------
revno: 4278
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-08-11 16:01:50 +0200
message:
  update orgunitversion for every update to a orgunit
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-08-11 11:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-08-11 14:01:50 +0000
@@ -111,6 +111,8 @@
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_ADD,
             OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
 
+        updateVersion();
+
         return id;
     }
 
@@ -122,6 +124,8 @@
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_EDIT,
             OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
+
+        updateVersion();
     }
 
     public void updateOrganisationUnit( OrganisationUnit organisationUnit, boolean updateHierarchy )
@@ -150,6 +154,8 @@
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
             OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
+        
+        updateVersion();
     }
 
     public OrganisationUnit getOrganisationUnit( int id )
@@ -644,6 +650,8 @@
     public void updateOrganisationUnits( Collection<OrganisationUnit> units )
     {
         organisationUnitStore.update( units );
+        
+        updateVersion();
     }
 
     @Override
@@ -661,10 +669,14 @@
         {
             orgUnitVersion = new Version();
             orgUnitVersion.setKey( VersionService.ORGANISATIONUNIT_VERSION );
-        }
-
-        orgUnitVersion.setValue( uuid );
-
-        versionService.updateVersion( orgUnitVersion );
+            orgUnitVersion.setValue( uuid );
+
+            versionService.addVersion( orgUnitVersion );
+        }
+        else
+        {
+            orgUnitVersion.setValue( uuid );
+            versionService.updateVersion( orgUnitVersion );
+        }
     }
 }