← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10453: Replaced constructor injection with setter injection in patient service

 

------------------------------------------------------------
revno: 10453
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-04-02 17:14:17 +0200
message:
  Replaced constructor injection with setter injection in patient service
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregateSchedule.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java
  dhis-2/dhis-services/dhis-service-patient/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-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregateSchedule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregateSchedule.java	2013-04-01 08:41:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregateSchedule.java	2013-04-02 15:14:17 +0000
@@ -29,8 +29,6 @@
 
 /**
  * @author Chau Thu Tran
- * 
- * @version CaseAggregateSchedule.java Apr 1, 2013 11:03:02 AM $
  */
 public class CaseAggregateSchedule
 {
@@ -41,8 +39,7 @@
     private String periodTypeName;
 
     public CaseAggregateSchedule()
-    {
-        
+    {        
     }
 
     public CaseAggregateSchedule( Integer dataSetId, String dataSetName, String periodTypeName )
@@ -81,5 +78,4 @@
     {
         this.periodTypeName = periodTypeName;
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java	2012-06-04 04:06:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java	2013-04-02 15:14:17 +0000
@@ -37,9 +37,6 @@
 
 /**
  * @author Chau Thu Tran
- * @version $ CaseAggregationConditionDeletionHandler.java Jun 24, 2011 1:52:01
- *          PM $
- * 
  */
 public class CaseAggregationConditionDeletionHandler
     extends DeletionHandler
@@ -128,7 +125,6 @@
         return null;
     }
     
-
     @Override
     public String allowDeletePatientAttribute( PatientAttribute patientAttribute )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2013-04-01 05:56:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2013-04-02 15:14:17 +0000
@@ -75,10 +75,7 @@
 
 /**
  * @author Chau Thu Tran
- * @version DefaultPatientAggregationExpressionService.java Nov 17, 2010
- *          11:16:37 AM
  */
-
 @Transactional
 public class DefaultCaseAggregationConditionService
     implements CaseAggregationConditionService

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java	2013-04-01 05:56:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java	2013-04-02 15:14:17 +0000
@@ -53,13 +53,33 @@
     implements Runnable
 {
     private CaseAggregationConditionService aggregationConditionService;
-    
+
+    public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+    {
+        this.aggregationConditionService = aggregationConditionService;
+    }
+
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
     private JdbcTemplate jdbcTemplate;
-    
-    private SystemSettingManager systemSettingManager;
-    
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     private Notifier notifier;
 
+    public void setNotifier( Notifier notifier )
+    {
+        this.notifier = notifier;
+    }
+
     private TaskId taskId;
 
     public void setTaskId( TaskId taskId )
@@ -68,19 +88,6 @@
     }
 
     // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public CaseAggregateConditionTask( CaseAggregationConditionService aggregationConditionService,
-        JdbcTemplate jdbcTemplate, SystemSettingManager systemSettingManager, Notifier notifier )
-    {
-        this.aggregationConditionService = aggregationConditionService;
-        this.jdbcTemplate = jdbcTemplate;
-        this.systemSettingManager = systemSettingManager;
-        this.notifier = notifier;
-    }
-
-    // -------------------------------------------------------------------------
     // Runnable implementation
     // -------------------------------------------------------------------------
 
@@ -117,6 +124,5 @@
         clock.logTime( "Improrted aggregate data completed " );
 
         notifier.notify( taskId, INFO, "Improrted aggregate data completed", true );
-    }
-    
+    }    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java	2012-10-01 04:09:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/SendScheduledMessageTask.java	2013-04-02 15:14:17 +0000
@@ -55,6 +55,13 @@
         this.programStageInstanceService = programStageInstanceService;
     }
 
+    private OutboundSmsService outboundSmsService;
+
+    public void setOutboundSmsService( OutboundSmsService outboundSmsService )
+    {
+        this.outboundSmsService = outboundSmsService;
+    }
+
     private JdbcTemplate jdbcTemplate;
 
     public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
@@ -62,25 +69,6 @@
         this.jdbcTemplate = jdbcTemplate;
     }
 
-    private OutboundSmsService outboundSmsService;
-
-    public void setOutboundSmsService( OutboundSmsService outboundSmsService )
-    {
-        this.outboundSmsService = outboundSmsService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public SendScheduledMessageTask( ProgramStageInstanceService programStageInstanceService,
-        JdbcTemplate jdbcTemplate, OutboundSmsService outboundSmsService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-        this.jdbcTemplate = jdbcTemplate;
-        this.outboundSmsService = outboundSmsService;
-    }
-
     // -------------------------------------------------------------------------
     // Params
     // -------------------------------------------------------------------------

=== 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	2013-04-02 08:24:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-04-02 15:14:17 +0000
@@ -4,12 +4,11 @@
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd";>
 
-  <!-- Store definitions -->
+    <!-- Store definitions -->
 
 	<bean id="org.hisp.dhis.caseaggregation.CaseAggregationConditionStore"
 		class="org.hisp.dhis.caseaggregation.jdbc.JdbcCaseAggregationConditionStore">
-		<property name="clazz"
-			value="org.hisp.dhis.caseaggregation.CaseAggregationCondition" />
+		<property name="clazz" value="org.hisp.dhis.caseaggregation.CaseAggregationCondition" />
 		<property name="sessionFactory" ref="sessionFactory" />
 		<property name="jdbcTemplate" ref="jdbcTemplate" />
 		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
@@ -39,8 +38,7 @@
 		<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-		<property name="programInstanceService"
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.program.ProgramInstanceStore"
@@ -108,8 +106,7 @@
 
 	<bean id="org.hisp.dhis.patientattributevalue.PatientAttributeValueStore"
 		class="org.hisp.dhis.patientattributevalue.hibernate.HibernatePatientAttributeValueStore">
-		<property name="clazz"
-			value="org.hisp.dhis.patientattributevalue.PatientAttributeValue" />
+		<property name="clazz" value="org.hisp.dhis.patientattributevalue.PatientAttributeValue" />
 		<property name="sessionFactory" ref="sessionFactory" />
 		<property name="jdbcTemplate" ref="jdbcTemplate" />
 	</bean>
@@ -122,8 +119,7 @@
 
 	<bean id="org.hisp.dhis.patientdatavalue.PatientDataValueStore"
 		class="org.hisp.dhis.patientdatavalue.hibernate.HibernatePatientDataValueStore">
-		<property name="clazz"
-			value="org.hisp.dhis.patientdatavalue.PatientDataValue" />
+		<property name="clazz" value="org.hisp.dhis.patientdatavalue.PatientDataValue" />
 		<property name="sessionFactory" ref="sessionFactory" />
 	</bean>
 
@@ -163,17 +159,10 @@
 
 	<bean id="org.hisp.dhis.program.ProgramDataEntryService" class="org.hisp.dhis.program.DefaultProgramDataEntryService">
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="programStageInstanceService">
-			<ref bean="org.hisp.dhis.program.ProgramStageInstanceService" />
-		</property>
-		<property name="programStageService">
-			<ref bean="org.hisp.dhis.program.ProgramStageService" />
-		</property>
-		<property name="patientDataValueService">
-			<ref bean="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-		</property>
-		<property name="programStageDataElementService"
-			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+		<property name="programStageDataElementService"	ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseaggregation.CaseAggregationConditionService"
@@ -451,10 +440,10 @@
 
 	<bean id="abstractScheduledMessageTask"
 		class="org.hisp.dhis.patient.scheduling.SendScheduledMessageTask">
-		<constructor-arg ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-		<constructor-arg ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
-		<constructor-arg ref="jdbcTemplate" />
-	</bean>
+		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+        <property name="outboundSmsService" ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
+        <property name="jdbcTemplate" ref="jdbcTemplate" />
+    </bean>
 
 	<bean id="sendMessageScheduled"
 		class="org.hisp.dhis.patient.scheduling.SendScheduledMessageTask"
@@ -482,10 +471,10 @@
 
 	<bean id="abstractRunCaseAggregateConditionTask"
 		class="org.hisp.dhis.patient.scheduling.CaseAggregateConditionTask">
-		<constructor-arg ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
-		<constructor-arg ref="jdbcTemplate" />
-		<constructor-arg ref="org.hisp.dhis.setting.SystemSettingManager" />
-		<constructor-arg ref="notifier" />
+		<property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+        <property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
+        <property name="jdbcTemplate" ref="jdbcTemplate" />
+        <property name="notifier" ref="notifier" />
 	</bean>
 
 	<bean id="aggregateQueryBuilder" class="org.hisp.dhis.patient.scheduling.CaseAggregateConditionTask"
@@ -525,12 +514,10 @@
 		<property name="dataElementService"
 			ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="dataEntryFormService"
-			ref="org.hisp.dhis.dataentryform.DataEntryFormService" />
-		
+			ref="org.hisp.dhis.dataentryform.DataEntryFormService" />		
 	</bean>
 
-	<bean
-		class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
 		<property name="targetObject"
 			ref="org.hisp.dhis.system.startup.StartupRoutineExecutor" />
 		<property name="targetMethod" value="addStartupRoutines" />
@@ -545,22 +532,18 @@
 
 	<!-- DeletionManager -->
 
-	<bean
-		class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
 		<property name="targetObject" ref="deletionManager" />
 		<property name="targetMethod" value="addDeletionHandlers" />
 		<property name="arguments">
 			<list>
 				<list>
 					<ref local="org.hisp.dhis.patient.PatientDeletionHandler" />
-					<ref
-						local="org.hisp.dhis.patientattributevalue.PatientAttributeValueDeletionHandler" />
+					<ref local="org.hisp.dhis.patientattributevalue.PatientAttributeValueDeletionHandler" />
 					<ref local="org.hisp.dhis.patient.PatientIdentifierDeletionHandler" />
 					<ref local="org.hisp.dhis.relationship.RelationshipDeletionHandler" />
 					<ref local="org.hisp.dhis.patient.PatientAuditDeletionHandler" />
-					<ref
-						local="org.hisp.dhis.patientdatavalue.PatientDataValueDeletionHandler" />
-					
+					<ref local="org.hisp.dhis.patientdatavalue.PatientDataValueDeletionHandler" />					
 					<ref local="org.hisp.dhis.program.ProgramDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramStageSectionDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramInstanceDeletionHandler" />
@@ -568,9 +551,7 @@
 					<ref local="org.hisp.dhis.program.ProgramStageDataElementDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramValidationDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramDataEntryFormDeletionHandler" />
-
-					<ref
-						local="org.hisp.dhis.caseaggregation.CaseAggregationConditionDeletionHandler" />
+					<ref local="org.hisp.dhis.caseaggregation.CaseAggregationConditionDeletionHandler" />
 				</list>
 			</list>
 		</property>
@@ -606,7 +587,6 @@
 			<aop:before
 				pointcut="execution( * org.hisp.dhis.patient.PatientAuditService.delete*(..) )"
 				method="intercept" />
-
 			<aop:before
 				pointcut="execution( * org.hisp.dhis.program.ProgramService.delete*(..) )"
 				method="intercept" />
@@ -637,7 +617,6 @@
 			<aop:before
 				pointcut="execution( * org.hisp.dhis.validation.ValidationCriteriaService.delete*(..) )"
 				method="intercept" />
-
 			<aop:before
 				pointcut="execution( * org.hisp.dhis.caseaggregation.CaseAggregationConditionService.delete*(..) )"
 				method="intercept" />