← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22189: ProgramInstanceService, using store instead of service to break circular dep

 

------------------------------------------------------------
revno: 22189
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-08 14:58:56 +0100
message:
  ProgramInstanceService, using store instead of service to break circular dep
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java


--
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/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2016-01-04 14:27:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2016-03-08 13:58:56 +0000
@@ -80,6 +80,9 @@
 
     @Autowired
     private ProgramInstanceStore programInstanceStore;
+    
+    @Autowired
+    private ProgramStageInstanceStore programStageInstanceStore;
 
     @Autowired
     private ProgramService programService;
@@ -97,9 +100,6 @@
     private MessageService messageService;
 
     @Autowired
-    private ProgramStageInstanceService programStageInstanceService;
-
-    @Autowired
     private TrackedEntityInstanceService trackedEntityInstanceService;
 
     @Autowired
@@ -598,21 +598,18 @@
         {
             if ( programStageInstance.getExecutionDate() == null )
             {
-                // ---------------------------------------------------------------------
-                // Set status as skipped for overdue events
-                // ---------------------------------------------------------------------
+                // -------------------------------------------------------------
+                // Set status as skipped for overdue events, or delete
+                // -------------------------------------------------------------
+                
                 if ( programStageInstance.getDueDate().before( currentDate ) )
                 {
                     programStageInstance.setStatus( EventStatus.SKIPPED );
-                    programStageInstanceService.updateProgramStageInstance( programStageInstance );
+                    programStageInstanceStore.update( programStageInstance );
                 }
-
-                // ---------------------------------------------------------------------
-                // Remove scheduled events
-                // ---------------------------------------------------------------------
                 else
                 {
-                    programStageInstanceService.deleteProgramStageInstance( programStageInstance );
+                    programStageInstanceStore.delete( programStageInstance );
                 }
             }
         }