← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1910: Spring 3 deprecation fixes

 

------------------------------------------------------------
revno: 1910
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-27 10:42:06 +0200
message:
  Spring 3 deprecation fixes
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.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/security/hibernate/HibernateUserDetailsService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java	2010-05-18 15:42:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java	2010-05-27 08:42:06 +0000
@@ -27,6 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -76,17 +77,15 @@
     {
         UserCredentials credentials = loadUserCredentials( username );
 
-        GrantedAuthority[] authorities = getGrantedAuthorities( credentials );
-
         return new User( credentials.getUsername(), credentials.getPassword(), true,
-            true, true, true, authorities );
+            true, true, true, getGrantedAuthorities( credentials ) );
     }
 
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private GrantedAuthority[] getGrantedAuthorities( UserCredentials credentials )
+    private Collection<GrantedAuthority> getGrantedAuthorities( UserCredentials credentials )
     {
         Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
 
@@ -98,7 +97,7 @@
             }
         }
 
-        return authorities.toArray( new GrantedAuthority[authorities.size()] );
+        return authorities;
     }
 
     private UserCredentials loadUserCredentials( String username )

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-05-25 16:45:28 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-05-27 08:42:06 +0000
@@ -167,6 +167,7 @@
      * Returns a map for the given MapOrganisationUnitRelations where the key is
      * the OrganisationUnit identifier and the value is the feature identifier.
      */
+    /*
     private java.util.Map<Integer, String> getOrganisationUnitFeatureMap(
         Collection<MapOrganisationUnitRelation> relations )
     {
@@ -178,7 +179,7 @@
         }
 
         return map;
-    }
+    }*/
 
     // -------------------------------------------------------------------------
     // Map

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2010-05-03 13:44:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2010-05-27 08:42:06 +0000
@@ -43,7 +43,6 @@
 import org.hisp.dhis.relationship.RelationshipService;
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.relationship.RelationshipTypeService;
-import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.transaction.annotation.Transactional;
 
 
@@ -108,12 +107,6 @@
         this.relationshipTypeService = relationshipTypeService;
     }
 
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
     // -------------------------------------------------------------------------
     // PatientDataValue
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2010-05-18 19:22:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2010-05-27 08:42:06 +0000
@@ -165,8 +165,6 @@
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="relationshipService"
 			ref="org.hisp.dhis.relationship.RelationshipService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.PatientIdentifierService" class="org.hisp.dhis.patient.DefaultPatientIdentifierService">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	2010-05-18 15:18:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java	2010-05-27 08:42:06 +0000
@@ -38,11 +38,9 @@
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.customvalue.CustomValue;
 import org.hisp.dhis.dataelement.CalculatedDataElement;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.minmax.MinMaxDataElement;
@@ -94,13 +92,6 @@
         this.dataElementService = dataElementService;
     }
 
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
     private ProgramStageInstanceService programStageInstanceService;
 
     public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
@@ -1323,25 +1314,6 @@
     // -------------------------------------------------------------------------
 
     /**
-     * Tests whether the given Collection of CustomValues contains a CustomValue
-     * with the given data element identifier and category option combo id.
-     */
-    private boolean customValuesExists( Collection<CustomValue> customValues, int dataElementId,
-        int categoryOptionComboId )
-    {
-        for ( CustomValue customValue : customValues )
-        {
-            if ( dataElementId == customValue.getDataElement().getId()
-                && categoryOptionComboId == customValue.getOptionCombo().getId() )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
      * Returns the value of the PatientDataValue in the Collection of DataValues
      * with the given data element identifier and category option combo id.
      */

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2010-05-18 15:18:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2010-05-27 08:42:06 +0000
@@ -162,9 +162,7 @@
    <bean id="org.hisp.dhis.caseentry.screen.DataEntryScreenManager"
     class="org.hisp.dhis.caseentry.screen.DefaultDataEntryScreenManager" scope="prototype">    
     <property name="dataElementService"
-      ref="org.hisp.dhis.dataelement.DataElementService"/>    
-    <property name="categoryService"
-      ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+      ref="org.hisp.dhis.dataelement.DataElementService"/>
     <property name="programStageInstanceService">
       <ref bean="org.hisp.dhis.program.ProgramStageInstanceService"/>
     </property>     

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java	2010-05-03 13:44:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java	2010-05-27 08:42:06 +0000
@@ -28,6 +28,8 @@
  */
 
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.hisp.dhis.security.authority.SystemAuthoritiesProvider;
 import org.hisp.dhis.user.UserStore;
@@ -90,17 +92,15 @@
         return systemAuthoritiesProvider.getSystemAuthorities();
     }
 
-    protected GrantedAuthority[] getGrantedAuthorities()
+    protected Collection<GrantedAuthority> getGrantedAuthorities()
     {
         Collection<String> systemAuthorities = getAuthorities();
 
-        GrantedAuthority[] grantedAuthorities = new GrantedAuthority[systemAuthorities.size()];
-
-        int i = 0;
+        Set<GrantedAuthority> grantedAuthorities = new HashSet<GrantedAuthority>( systemAuthorities.size() );
 
         for ( String authority : systemAuthorities )
         {
-            grantedAuthorities[i++] = new GrantedAuthorityImpl( authority );
+            grantedAuthorities.add( new GrantedAuthorityImpl( authority ) );
         }
 
         return grantedAuthorities;

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java	2010-05-26 15:58:31 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java	2010-05-27 08:42:06 +0000
@@ -30,7 +30,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;