← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3889: Changed from using UserStore to UserService in service layer

 

------------------------------------------------------------
revno: 3889
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-06-13 16:03:06 +0200
message:
  Changed from using UserStore to UserService in service layer
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultCurrentUserService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserSettingService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.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-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultCurrentUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultCurrentUserService.java	2010-04-21 19:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultCurrentUserService.java	2011-06-13 14:03:06 +0000
@@ -28,11 +28,13 @@
  */
 
 import org.hisp.dhis.security.spring.AbstractSpringSecurityCurrentUserService;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: DefaultCurrentUserService.java 5708 2008-09-16 14:28:32Z larshelg $
  */
+@Transactional
 public class DefaultCurrentUserService
     extends AbstractSpringSecurityCurrentUserService
 {
@@ -42,13 +44,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    public UserStore userStore;
+    private UserService userService;
 
-    public void setUserStore( UserStore userStore )
+    public void setUserService( UserService userService )
     {
-        this.userStore = userStore;
+        this.userService = userService;
     }
-
+    
     // -------------------------------------------------------------------------
     // CurrentUserService implementation
     // -------------------------------------------------------------------------
@@ -62,7 +64,7 @@
             return null;
         }
 
-        UserCredentials userCredentials = userStore.getUserCredentialsByUsername( username );
+        UserCredentials userCredentials = userService.getUserCredentialsByUsername( username );
 
         if ( userCredentials == null )
         {
@@ -81,7 +83,7 @@
             return false;
         }
 
-        UserCredentials userCredentials = userStore.getUserCredentialsByUsername( username );
+        UserCredentials userCredentials = userService.getUserCredentialsByUsername( username );
 
         if ( userCredentials == null )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserSettingService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserSettingService.java	2011-06-13 13:40:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserSettingService.java	2011-06-13 14:03:06 +0000
@@ -51,13 +51,13 @@
         this.currentUserService = currentUserService;
     }
 
-    private UserStore userStore;
+    private UserService userService;
 
-    public void setUserStore( UserStore userStore )
+    public void setUserService( UserService userService )
     {
-        this.userStore = userStore;
+        this.userService = userService;
     }
-
+    
     // -------------------------------------------------------------------------
     // UserSettingService implementation
     // -------------------------------------------------------------------------
@@ -72,7 +72,7 @@
             throw new NoCurrentUserException( "No current user. User setting not saved: " + name );
         }
 
-        UserSetting userSetting = userStore.getUserSetting( currentUser, name );
+        UserSetting userSetting = userService.getUserSetting( currentUser, name );
 
         if ( userSetting == null )
         {
@@ -81,13 +81,13 @@
             userSetting.setName( name );
             userSetting.setValue( value );
 
-            userStore.addUserSetting( userSetting );
+            userService.addUserSetting( userSetting );
         }
         else
         {
             userSetting.setValue( value );
 
-            userStore.updateUserSetting( userSetting );
+            userService.updateUserSetting( userSetting );
         }
     }
 
@@ -101,7 +101,7 @@
             throw new NoCurrentUserException( "No current user. User setting not returned: " + name );
         }
 
-        UserSetting userSetting = userStore.getUserSetting( currentUser, name );
+        UserSetting userSetting = userService.getUserSetting( currentUser, name );
 
         if ( userSetting != null )
         {
@@ -120,7 +120,7 @@
             return defaultValue;
         }
 
-        UserSetting userSetting = userStore.getUserSetting( currentUser, name );
+        UserSetting userSetting = userService.getUserSetting( currentUser, name );
 
         if ( userSetting != null )
         {
@@ -140,7 +140,7 @@
             throw new NoCurrentUserException( "No current user. User settings not returned" );
         }
 
-        return userStore.getAllUserSettings( currentUser );
+        return userService.getAllUserSettings( currentUser );
     }
 
     public void deleteUserSetting( String name )
@@ -153,6 +153,6 @@
             throw new NoCurrentUserException( "No current user. User setting not deleted: " + name );
         }
 
-        userStore.deleteUserSetting( userStore.getUserSetting( currentUser, name ) );
+        userService.deleteUserSetting( userService.getUserSetting( currentUser, name ) );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java	2010-04-21 19:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java	2011-06-13 14:03:06 +0000
@@ -41,13 +41,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserStore userStore;
+    private UserService userService;
 
-    public void setUserStore( UserStore userStore )
+    public void setUserService( UserService userService )
     {
-        this.userStore = userStore;
+        this.userService = userService;
     }
-
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -61,11 +61,11 @@
     @Override
     public void deleteDataSet( DataSet dataSet )
     {
-        for ( UserAuthorityGroup group : userStore.getAllUserAuthorityGroups() )
+        for ( UserAuthorityGroup group : userService.getAllUserAuthorityGroups() )
         {
             if ( group.getDataSets().remove( dataSet ) )
             {
-                userStore.updateUserAuthorityGroup( group );
+                userService.updateUserAuthorityGroup( group );
             }
         }
     }
@@ -73,11 +73,11 @@
     @Override
     public void deleteUserCredentials( UserCredentials credentials )
     {
-        for ( UserAuthorityGroup group : userStore.getAllUserAuthorityGroups() )
+        for ( UserAuthorityGroup group : userService.getAllUserAuthorityGroups() )
         {
             if ( group.getMembers().remove( credentials ) )
             {
-                userStore.updateUserAuthorityGroup( group );
+                userService.updateUserAuthorityGroup( group );
             }
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java	2010-04-21 19:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java	2011-06-13 14:03:06 +0000
@@ -40,13 +40,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserStore userStore;
+    private UserService userService;
 
-    public void setUserStore( UserStore userStore )
+    public void setUserService( UserService userService )
     {
-        this.userStore = userStore;
+        this.userService = userService;
     }
-
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -59,11 +59,11 @@
     @Override
     public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
     {
-        for ( UserCredentials credentials : userStore.getAllUserCredentials() )
+        for ( UserCredentials credentials : userService.getAllUserCredentials() )
         {
             if ( credentials.getUserAuthorityGroups().remove( authorityGroup ) )
             {
-                userStore.updateUserCredentials( credentials );
+                userService.updateUserCredentials( credentials );
             }
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2011-06-13 14:03:06 +0000
@@ -43,11 +43,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserStore userStore;
+    private UserService userService;
 
-    public void setUserStore( UserStore userStore )
+    public void setUserService( UserService userService )
     {
-        this.userStore = userStore;
+        this.userService = userService;
     }
     
     // -------------------------------------------------------------------------
@@ -63,11 +63,11 @@
     @Override
     public void deleteOrganisationUnit( OrganisationUnit unit )
     {
-        for ( User user : userStore.getAllUsers() )
+        for ( User user : userService.getAllUsers() )
         {
             if ( user.getOrganisationUnits().remove( unit ) )
             {
-                userStore.updateUser( user );
+                userService.updateUser( user );
             }
         }
     }
@@ -75,7 +75,8 @@
     @Override
     public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
     {
-        Collection<UserCredentials> userCredentials = userStore.getAllUserCredentials();
+        Collection<UserCredentials> userCredentials = userService.getAllUserCredentials();
+        
         for( UserCredentials uc : userCredentials )
         {
             if( uc != null && uc.getUserAuthorityGroups() != null )

=== 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	2011-06-08 22:04:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-06-13 14:03:06 +0000
@@ -426,12 +426,12 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.user.CurrentUserService" class="org.hisp.dhis.user.DefaultCurrentUserService">
-		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserSettingService" class="org.hisp.dhis.user.DefaultUserSettingService">
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserService" class="org.hisp.dhis.user.DefaultUserService">
@@ -1172,17 +1172,17 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler">
-		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler"
 		class="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler">
-		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserCredentialsDeletionHandler"
 		class="org.hisp.dhis.user.UserCredentialsDeletionHandler">
-		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.user.UserSettingDeletionHandler" 
@@ -1194,8 +1194,6 @@
 		class="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler">
 		<property name="categoryService" 
 			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<!--property name="conceptService"
-			ref="org.hisp.dhis.concept.ConceptService" /-->
 	</bean>
 	
 	<bean id="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler"