dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24579
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12079: Fixed issue with UserSettingDeletionHandler
------------------------------------------------------------
revno: 12079
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-13 14:12:02 +0200
message:
Fixed issue with UserSettingDeletionHandler
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java
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/UserSettingDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/pom.xml
--
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-api/src/main/java/org/hisp/dhis/user/UserService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-09-13 12:12:02 +0000
@@ -353,6 +353,8 @@
* @return a Collection of UserSettings.
*/
Collection<UserSetting> getAllUserSettings( User user );
+
+ Collection<UserSetting> getUserSettings( String name );
/**
* Deletes a UserSetting.
=== 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 2013-09-13 11:31:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2013-09-13 12:12:02 +0000
@@ -498,6 +498,11 @@
{
return userCredentialsStore.getAllUserSettings( user );
}
+
+ public Collection<UserSetting> getUserSettings( String name )
+ {
+ return userCredentialsStore.getUserSettings( name );
+ }
public UserSetting getUserSetting( User user, String name )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.java 2013-09-13 11:31:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.java 2013-09-13 12:12:02 +0000
@@ -30,6 +30,7 @@
import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -44,12 +45,8 @@
// Dependencies
// -------------------------------------------------------------------------
- private UserSettingService userSettingService;
-
- public void setUserSettingService( UserSettingService userSettingService )
- {
- this.userSettingService = userSettingService;
- }
+ @Autowired
+ private UserService userService;
// -------------------------------------------------------------------------
// DeletionHandler implementation
@@ -64,14 +61,11 @@
@Override
public void deleteDataDictionary( DataDictionary dataDictionary )
{
- for ( UserSetting setting : userSettingService.getAllUserSettings() )
+ for ( UserSetting setting : userService.getUserSettings( SETTING_NAME_DATADICTIONARY ) )
{
- if ( setting.getName().equals( SETTING_NAME_DATADICTIONARY ) )
+ if ( setting.getValue() != null && (Integer) setting.getValue() == dataDictionary.getId() )
{
- if ( setting.getValue() != null && (Integer) setting.getValue() == dataDictionary.getId() )
- {
- userSettingService.deleteUserSetting( SETTING_NAME_DATADICTIONARY );
- }
+ userService.deleteUserSetting( setting );
}
}
}
@@ -79,12 +73,10 @@
@Override
public void deleteUser( User user )
{
- for ( UserSetting setting : userSettingService.getAllUserSettings() )
+ System.out.println("yes");
+ for ( UserSetting setting : userService.getAllUserSettings( user ) )
{
- if ( setting.getUser() != null && setting.getUser().equals( user ) )
- {
- userSettingService.deleteUserSetting( setting.getName() );
- }
+ userService.deleteUserSetting( setting );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 11:31:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 12:12:02 +0000
@@ -1025,9 +1025,7 @@
<property name="userService" ref="org.hisp.dhis.user.UserService" />
</bean>
- <bean id="org.hisp.dhis.user.UserSettingDeletionHandler" class="org.hisp.dhis.user.UserSettingDeletionHandler">
- <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
- </bean>
+ <bean id="org.hisp.dhis.user.UserSettingDeletionHandler" class="org.hisp.dhis.user.UserSettingDeletionHandler"/>
<bean id="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler"
class="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/pom.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/pom.xml 2013-05-31 08:27:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/pom.xml 2013-09-13 12:12:02 +0000
@@ -27,6 +27,11 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-service-reporting</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-core</artifactId>
</dependency>
<dependency>