← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8315: DeletionHandler for peron-attributes and person-identifiertype.

 

------------------------------------------------------------
revno: 8315
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-01 13:20:05 +0700
message:
  DeletionHandler for peron-attributes and person-identifiertype.
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
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.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	2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2012-10-01 06:20:05 +0000
@@ -30,6 +30,8 @@
 import java.util.Collection;
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.hisp.dhis.validation.ValidationCriteria;
 
@@ -74,6 +76,30 @@
     }
     
     @Override
+    public void deletePatientIdentifierType( PatientIdentifierType patientIdentifierType )
+    {
+        Collection<Program> programs = programService.getAllPrograms();
+
+        for ( Program program : programs )
+        {
+            program.getPatientIdentifierTypes().clear();
+            programService.updateProgram( program );
+        }
+    }
+    
+    @Override
+    public void deletePatientAttribute( PatientAttribute patientAttribute )
+    {
+        Collection<Program> programs = programService.getAllPrograms();
+
+        for ( Program program : programs )
+        {
+            program.getPatientAttributes().clear();
+            programService.updateProgram( program );
+        }
+    }
+    
+    @Override
     public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         //TODO improve performance

=== 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	2012-09-26 05:19:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2012-10-01 06:20:05 +0000
@@ -443,12 +443,10 @@
 			<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.patientdatavalue.PatientDataValueDeletionHandler" />
+					<ref local="org.hisp.dhis.patientdatavalue.PatientDataValueDeletionHandler" />
 
 					<ref local="org.hisp.dhis.program.ProgramDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramInstanceDeletionHandler" />
@@ -457,8 +455,7 @@
 					<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>

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-10-01 05:30:38 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-10-01 06:20:05 +0000
@@ -22,7 +22,7 @@
 
 	<property name="irregular" column="irregular" />
 
-    <set name="programStageDataElements" order-by="sort_order" cascade="all">
+    <set name="programStageDataElements" order-by="sort_order">
       <key column="programstageid" />
       <one-to-many class="org.hisp.dhis.program.ProgramStageDataElement" />
     </set>