← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20552: minor fixes to program/programStage

 

------------------------------------------------------------
revno: 20552
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-07 11:35:59 +0700
message:
  minor fixes to program/programStage
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageSectionDeletionHandler.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-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java	2015-10-07 02:50:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java	2015-10-07 04:35:59 +0000
@@ -50,7 +50,7 @@
     {
         Schema schema = new Schema( ProgramStageSection.class, SINGULAR, PLURAL );
         schema.setRelativeApiEndpoint( API_ENDPOINT );
-        schema.setOrder( 1509 );
+        schema.setOrder( 1515 );
 
         return schema;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java	2015-10-07 02:50:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java	2015-10-07 04:35:59 +0000
@@ -31,6 +31,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementDomain;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Iterator;
 
@@ -44,13 +45,9 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    @Autowired
     private ProgramStageDataElementService programStageDataElementService;
 
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDEService )
-    {
-        this.programStageDataElementService = programStageDEService;
-    }
-
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -64,12 +61,12 @@
     @Override
     public void deleteProgramStage( ProgramStage programStage )
     {
-        Iterator<ProgramStageDataElement> iterator = programStage.getProgramStageDataElements().iterator();
+        Iterator<ProgramStageDataElement> programStageDataElementIterator = programStage.getProgramStageDataElements().iterator();
 
-        while ( iterator.hasNext() )
+        while ( programStageDataElementIterator.hasNext() )
         {
-            ProgramStageDataElement de = iterator.next();
-            programStageDataElementService.deleteProgramStageDataElement( de );
+            ProgramStageDataElement programStageDataElement = programStageDataElementIterator.next();
+            programStageDataElementService.deleteProgramStageDataElement( programStageDataElement );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDeletionHandler.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageDeletionHandler.java	2015-10-07 04:35:59 +0000
@@ -28,10 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.system.deletion.DeletionHandler;
+
 import java.util.Iterator;
 
-import org.hisp.dhis.system.deletion.DeletionHandler;
-
 /**
  * @author Lars Helge Overland
  */

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageSectionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageSectionDeletionHandler.java	2015-09-27 18:35:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramStageSectionDeletionHandler.java	2015-10-07 04:35:59 +0000
@@ -28,12 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 /**
  * @author Chau Thu Tran
  */
@@ -42,7 +43,10 @@
 {
     @Autowired
     private IdentifiableObjectManager idObjectManager;
-    
+
+    @Autowired
+    private ProgramStageSectionService programStageSectionService;
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -57,7 +61,7 @@
     public void deleteProgramIndicator( ProgramIndicator programIndicator )
     {
         Collection<ProgramStageSection> sections = idObjectManager.getAllNoAcl( ProgramStageSection.class );
-        
+
         for ( ProgramStageSection section : sections )
         {
             if ( section.getProgramIndicators().remove( programIndicator ) )
@@ -66,4 +70,16 @@
             }
         }
     }
+
+    @Override
+    public void deleteProgramStage( ProgramStage programStage )
+    {
+        Iterator<ProgramStageSection> programStageSectionIterator = programStage.getProgramStageSections().iterator();
+
+        while ( programStageSectionIterator.hasNext() )
+        {
+            ProgramStageSection programStageSection = programStageSectionIterator.next();
+            programStageSectionService.deleteProgramStageSection( programStageSection );
+        }
+    }
 }

=== 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-10-07 02:50:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-10-07 04:35:59 +0000
@@ -1634,7 +1634,6 @@
 
   <bean id="org.hisp.dhis.program.ProgramStageDataElementDeletionHandler"
     class="org.hisp.dhis.program.ProgramStageDataElementDeletionHandler">
-    <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
   </bean>
 
   <bean id="org.hisp.dhis.program.ProgramStageDeletionHandler"