dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12584
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3907: Added OrganisationUnit handling to ProgramDeletionHandler
------------------------------------------------------------
revno: 3907
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-14 21:24:18 +0200
message:
Added OrganisationUnit handling to ProgramDeletionHandler
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java 2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java 2011-06-14 19:24:18 +0000
@@ -28,10 +28,8 @@
package org.hisp.dhis.program;
import java.util.Collection;
-import java.util.Set;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.system.deletion.DeletionHandler;
import org.hisp.dhis.validation.ValidationCriteria;
@@ -46,13 +44,6 @@
// Dependencies
// -------------------------------------------------------------------------
- private PatientService patientService;
-
- public void setPatientService( PatientService patientService )
- {
- this.patientService = patientService;
- }
-
private ProgramService programService;
public void setProgramService( ProgramService programService )
@@ -71,27 +62,28 @@
}
@Override
- public void deletePatient( Patient patient )
- {
- Set<Program> programs = patient.getPrograms();
-
- if ( programs != null )
- {
- patient.setPrograms( null );
-
- patientService.updatePatient( patient );
- }
- }
-
- @Override
public void deleteValidationCriteria( ValidationCriteria validationCriteria )
{
Collection<Program> programs = programService.getPrograms( validationCriteria );
-
- for(Program program : programs){
+
+ for ( Program program : programs )
+ {
program.getPatientValidationCriteria().remove( validationCriteria );
programService.updateProgram( program );
}
+ }
+
+ @Override
+ public void deleteOrganisationUnit( OrganisationUnit unit )
+ {
+ Collection<Program> programs = programService.getAllPrograms();
+ for ( Program program : programs )
+ {
+ if ( program.getOrganisationUnits().remove( unit ) )
+ {
+ programService.updateProgram( program );
+ }
+ }
}
}
=== 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 2011-05-27 04:02:40 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2011-06-14 19:24:18 +0000
@@ -352,7 +352,6 @@
<bean id="org.hisp.dhis.program.ProgramDeletionHandler"
class="org.hisp.dhis.program.ProgramDeletionHandler">
- <property name="patientService" ref="org.hisp.dhis.patient.PatientService"/>
<property name="programService" ref="org.hisp.dhis.program.ProgramService"/>
</bean>