dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19280
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8334: DeletionHandler for person-attribute.
------------------------------------------------------------
revno: 8334
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-02 13:23:53 +0700
message:
DeletionHandler for person-attribute.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.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/java/org/hisp/dhis/patient/PatientDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.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/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2012-09-27 10:11:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2012-10-02 06:23:53 +0000
@@ -216,5 +216,5 @@
Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, I18n i18n );
Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max );
-
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2012-09-27 10:11:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2012-10-02 06:23:53 +0000
@@ -81,5 +81,5 @@
Grid getPatientEventReport( Grid grid, List<String> searchKeys, OrganisationUnit orgunit );
Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max);
-
+
}
=== 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 2012-09-27 10:11:02 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2012-10-02 06:23:53 +0000
@@ -555,9 +555,9 @@
return patientStore.getByPhoneNumber( phoneNumber, min, max );
}
+ @Override
public Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, I18n i18n )
{
-
String startDate = "";
String endDate = "";
for ( String searchKey : searchKeys )
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2012-10-02 06:23:53 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.jdbc.core.JdbcTemplate;
public class PatientDeletionHandler
extends DeletionHandler
@@ -47,6 +48,13 @@
this.patientService = patientService;
}
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
// -------------------------------------------------------------------------
// DeletionHandler implementation
// -------------------------------------------------------------------------
@@ -60,8 +68,8 @@
@Override
public void deletePatient( Patient patient )
{
- Collection<Patient> representatives = patientService.getRepresentatives(patient);
-
+ Collection<Patient> representatives = patientService.getRepresentatives( patient );
+
for ( Patient representative : representatives )
{
representative.setRepresentative( null );
@@ -69,13 +77,19 @@
patientService.updatePatient( representative );
}
}
-
+
+ @Override
+ public void deletePatientAttribute( PatientAttribute patientAttribute )
+ {
+ jdbcTemplate.execute( "delete from patient_attributes where patientattributeid=" + patientAttribute.getId() );
+ }
+
@Override
public String allowDeleteOrganisationUnit( OrganisationUnit unit )
{
return patientService.getPatients( unit, null, null ).size() == 0 ? null : ERROR;
}
-
+
@Override
public void deleteProgram( Program program )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-09-27 13:45:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-10-02 06:23:53 +0000
@@ -47,6 +47,7 @@
import org.hisp.dhis.jdbc.StatementBuilder;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientStore;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStageInstance;
@@ -342,7 +343,7 @@
return grid;
}
-
+
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
=== 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-10-01 09:28:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-10-02 06:23:53 +0000
@@ -325,6 +325,7 @@
<bean id="org.hisp.dhis.patient.PatientDeletionHandler" class="org.hisp.dhis.patient.PatientDeletionHandler">
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.hisp.dhis.program.ProgramStageDataElementDeletionHandler"