← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19526: Fixed bug - Exception thrown when deleting a tracked entity instance from caseentry module

 

------------------------------------------------------------
revno: 19526
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-07-01 12:49:17 +0700
message:
  Fixed bug - Exception thrown when deleting a tracked entity instance from caseentry module
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageInstanceDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/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-core/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2015-07-01 05:49:17 +0000
@@ -35,8 +35,6 @@
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentitycomment.TrackedEntityComment;
 import org.hisp.dhis.trackedentitycomment.TrackedEntityCommentService;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
 
 /**
  * @author Quang Nguyen
@@ -55,13 +53,6 @@
         this.programInstanceService = programInstanceService;
     }
 
-    private TrackedEntityDataValueService dataValueService;
-
-    public void setDataValueService( TrackedEntityDataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
     private TrackedEntityCommentService commentService;
 
     public void setCommentService( TrackedEntityCommentService commentService )
@@ -76,13 +67,6 @@
         this.programStageDEService = programStageDEService;
     }
 
-    private ProgramStageInstanceService programStageInstanceService;
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -98,17 +82,6 @@
     {
         for ( ProgramInstance programInstance : entityInstance.getProgramInstances() )
         {
-            for ( ProgramStageInstance programStageInstance : programInstance.getProgramStageInstances() )
-            {
-                for ( TrackedEntityDataValue entityInstanceDataValue : dataValueService
-                    .getTrackedEntityDataValues( programStageInstance ) )
-                {
-                    dataValueService.deleteTrackedEntityDataValue( entityInstanceDataValue );
-                }
-
-                programStageInstanceService.deleteProgramStageInstance( programStageInstance );
-            }
-
             for( TrackedEntityComment comment : programInstance.getComments())
             {
                 commentService.deleteTrackedEntityComment( comment );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageInstanceDeletionHandler.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageInstanceDeletionHandler.java	2015-07-01 05:49:17 +0000
@@ -69,15 +69,7 @@
 
         return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
     }
-    
-    @Override
-    public String allowDeleteProgramInstance( ProgramInstance programInstance )
-    {
-        String sql = "SELECT COUNT(*) FROM programstageinstance WHERE programinstanceid=" + programInstance.getId() + " and executionDate is not null ";
-
-        return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
-    }
-    
+        
     @Override
     public void deleteProgramInstance( ProgramInstance programInstance )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-06-25 04:16:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-07-01 05:49:17 +0000
@@ -1606,9 +1606,7 @@
   <bean id="org.hisp.dhis.program.ProgramInstanceDeletionHandler"
     class="org.hisp.dhis.program.ProgramInstanceDeletionHandler">
     <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-    <property name="dataValueService" ref="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService" />
     <property name="commentService" ref="org.hisp.dhis.trackedentitycomment.TrackedEntityCommentService" />
-    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
   </bean>
 
   <bean id="org.hisp.dhis.relationship.RelationshipDeletionHandler"