dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18081
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7474: Fixed issue with deletion, not a good idea to log an object which has been deleted
------------------------------------------------------------
revno: 7474
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-07-01 20:55:20 +0200
message:
Fixed issue with deletion, not a good idea to log an object which has been deleted
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
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/user/DefaultUserService.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/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-05-15 15:28:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-07-01 18:55:20 +0000
@@ -119,10 +119,10 @@
public void deleteDataSet( DataSet dataSet )
{
+ log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
+ AuditLogUtil.ACTION_DELETE, DataSet.class.getSimpleName(), dataSet.getName() ) );
+
dataSetStore.delete( dataSet );
-
- log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
- AuditLogUtil.ACTION_DELETE, DataSet.class.getSimpleName(), dataSet.getName() ) );
}
public DataSet getDataSet( int id )
=== 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 2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-07-01 18:55:20 +0000
@@ -147,11 +147,11 @@
organisationUnitStore.update( parent );
}
+ log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
+ OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
+
organisationUnitStore.delete( organisationUnit );
- log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
- OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
-
updateVersion();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2012-07-01 18:55:20 +0000
@@ -166,14 +166,6 @@
return userStore.save( user );
}
- public void deleteUser( User user )
- {
- userStore.delete( user );
-
- log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
- User.class.getSimpleName(), user.getName() ) );
- }
-
public void updateUser( User user )
{
userStore.update( user );
@@ -182,6 +174,14 @@
User.class.getSimpleName(), user.getName() ) );
}
+ public void deleteUser( User user )
+ {
+ log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
+ User.class.getSimpleName(), user.getName() ) );
+
+ userStore.delete( user );
+ }
+
public Collection<User> getAllUsers()
{
return userStore.getAll();