← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18739: Program stage, using model instead of service call to get data elements in program stage.

 

------------------------------------------------------------
revno: 18739
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-03-30 11:30:54 +0200
message:
  Program stage, using model instead of service call to get data elements in program stage.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramDataEntryServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementStoreTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetAggPSDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetTrackedEntityDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetSelectedDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SelectDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/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/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2015-03-27 16:20:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2015-03-30 09:30:54 +0000
@@ -177,10 +177,7 @@
 
         for ( ProgramStage stage : programStages )
         {
-            for ( ProgramStageDataElement element : stage.getProgramStageDataElements() )
-            {
-                elements.add( element.getDataElement() );
-            }
+            elements.addAll( stage.getAllDataElements() );
         }
 
         return elements;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2015-03-30 06:57:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2015-03-30 09:30:54 +0000
@@ -35,6 +35,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
 import org.hisp.dhis.attribute.AttributeValue;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
@@ -46,6 +47,7 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.schema.annotation.PropertyRange;
@@ -150,6 +152,43 @@
     }
 
     // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public Set<DataElement> getAllDataElements()
+    {
+        Set<DataElement> dataElements = new HashSet<>();
+        
+        for ( ProgramStageDataElement element : programStageDataElements )
+        {
+            if ( element.getDataElement() != null )
+            {
+                dataElements.add( element.getDataElement() );
+            }
+        }
+        
+        return dataElements;
+    }
+    
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public String getDataEntryType()
+    {
+        if ( dataEntryForm != null )
+        {
+            return TYPE_CUSTOM;
+        }
+
+        if ( programStageSections.size() > 0 )
+        {
+            return TYPE_SECTION;
+        }
+
+        return TYPE_DEFAULT;
+    }
+
+    // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
 
@@ -371,24 +410,6 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getDataEntryType()
-    {
-        if ( dataEntryForm != null )
-        {
-            return TYPE_CUSTOM;
-        }
-
-        if ( programStageSections.size() > 0 )
-        {
-            return TYPE_SECTION;
-        }
-
-        return TYPE_DEFAULT;
-    }
-
-    @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getDefaultTemplateMessage()
     {
         return "Dear {person-name}, please come to your appointment on {program-stage-name} at {due-date}";

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java	2015-03-30 09:30:54 +0000
@@ -34,7 +34,6 @@
 
 /**
  * @author Viet Nguyen
- * @version $Id$
  */
 public interface ProgramStageDataElementService
 {
@@ -78,13 +77,4 @@
      * collection if there are no ProgramStageDataElements.
      */
     Collection<ProgramStageDataElement> getAllProgramStageDataElements();
-
-    /**
-     * Retrieve Data element list on a program stage
-     *
-     * @param programStage ProgramStage
-     * @return ProgramStageDataElement list
-     */
-    Collection<DataElement> getListDataElement( ProgramStage programStage );
-
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java	2015-03-27 15:45:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java	2015-03-30 09:30:54 +0000
@@ -31,8 +31,6 @@
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.dataelement.DataElement;
 
-import java.util.Collection;
-
 /**
  * @author Viet Nguyen
  */
@@ -50,12 +48,4 @@
      * @return ProgramStageDataElement
      */
     ProgramStageDataElement get( ProgramStage programStage, DataElement dataElement );
-
-    /**
-     * Retrieve Data element list on a program stage
-     *
-     * @param programStage ProgramStage
-     * @return ProgramStageDataElement list
-     */
-    Collection<DataElement> getListDataElement( ProgramStage programStage );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2015-03-06 11:40:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2015-03-30 09:30:54 +0000
@@ -822,12 +822,13 @@
      */
     private Map<String, DataElement> getDataElementMap( ProgramStage programStage )
     {
-        Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
         if ( programStage == null )
         {
             return null;
         }
+        
+        Collection<DataElement> dataElements = programStage.getAllDataElements();
+
         Map<String, DataElement> map = new HashMap<>();
 
         for ( DataElement element : dataElements )

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java	2015-03-30 09:30:54 +0000
@@ -85,11 +85,4 @@
     {
         programStageDataElementStore.update( programStageDataElement );
     }
-
-    @Override
-    public Collection<DataElement> getListDataElement( ProgramStage programStage )
-    {
-        return programStageDataElementStore.getListDataElement( programStage );
-    }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java	2015-03-27 15:45:41 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java	2015-03-30 09:30:54 +0000
@@ -28,10 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-
 import org.hibernate.Criteria;
-import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.dataelement.DataElement;
@@ -55,15 +52,4 @@
 
         return (ProgramStageDataElement) criteria.uniqueResult();
     }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public Collection<DataElement> getListDataElement( ProgramStage programStage )
-    {
-        Criteria criteria = getCriteria();
-        criteria.add( Restrictions.eq( "programStage", programStage ) );
-        criteria.setProjection( Projections.property( "dataElement" ) );
-        
-        return criteria.list();
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramDataEntryServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramDataEntryServiceTest.java	2015-01-29 22:06:36 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramDataEntryServiceTest.java	2015-03-30 09:30:54 +0000
@@ -93,11 +93,13 @@
         programService.addProgram( program );
 
         stageA = new ProgramStage( "A", program );
+        program.getProgramStages().add( stageA );
         stageA.setUid( "StageA" );
         stageA.setSortOrder( 1 );
         programStageService.saveProgramStage( stageA );
 
         ProgramStage stageB = new ProgramStage( "B", program );
+        program.getProgramStages().add( stageB );
         stageB.setSortOrder( 2 );
         programStageService.saveProgramStage( stageB );
 
@@ -113,10 +115,14 @@
 
         dataElementService.addDataElement( dataElementA );
         dataElementService.addDataElement( dataElementB );
-        ProgramStageDataElement stageDataElement = new ProgramStageDataElement( stageA, dataElementA, false, 1 );
-        programStageDataElementService.addProgramStageDataElement( stageDataElement );
-        stageDataElement = new ProgramStageDataElement( stageA, dataElementB, false, 2 );
-        programStageDataElementService.addProgramStageDataElement( stageDataElement );
+        
+        ProgramStageDataElement programStageDataElementA = new ProgramStageDataElement( stageA, dataElementA, false, 1 );
+        stageA.getProgramStageDataElements().add( programStageDataElementA );
+        programStageDataElementService.addProgramStageDataElement( programStageDataElementA );
+        
+        ProgramStageDataElement programStageDataElementB = new ProgramStageDataElement( stageA, dataElementB, false, 2 );
+        stageA.getProgramStageDataElements().add( programStageDataElementB );
+        programStageDataElementService.addProgramStageDataElement( programStageDataElementB );
 
         htmlCode = "<input id=\"StageA-DeA-val\" style=\"width:4em;text-align:center\" value=\"\" title=\"\" />";
     }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementServiceTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementServiceTest.java	2015-03-30 09:30:54 +0000
@@ -33,7 +33,6 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -82,10 +81,6 @@
 
     private ProgramStageDataElement stageDataElementB;
 
-    private ProgramStageDataElement stageDataElementC;
-
-    private ProgramStageDataElement stageDataElementD;
-
     @Override
     public void setUpTest()
     {
@@ -119,10 +114,6 @@
         stageDataElementA = new ProgramStageDataElement( stageA, dataElementA, false, 1 );
 
         stageDataElementB = new ProgramStageDataElement( stageA, dataElementB, false, 2 );
-
-        stageDataElementC = new ProgramStageDataElement( stageB, dataElementA, false, 1 );
-
-        stageDataElementD = new ProgramStageDataElement( stageB, dataElementB, false, 2 );
     }
 
     @Test
@@ -187,19 +178,4 @@
         assertTrue( equals( programStageDataElementService.getAllProgramStageDataElements(), stageDataElementA,
             stageDataElementB ) );
     }
-
-    @Test
-    public void testGetListDataElementByStage()
-    {
-        programStageDataElementService.addProgramStageDataElement( stageDataElementA );
-        programStageDataElementService.addProgramStageDataElement( stageDataElementB );
-        programStageDataElementService.addProgramStageDataElement( stageDataElementC );
-        programStageDataElementService.addProgramStageDataElement( stageDataElementD );
-
-        Collection<DataElement> stageDataElements = programStageDataElementService.getListDataElement( stageA );
-        assertTrue( equals( stageDataElements, dataElementA, dataElementB ) );
-
-        stageDataElements = programStageDataElementService.getListDataElement( stageB );
-        assertTrue( equals( stageDataElements, dataElementA, dataElementB ) );
-    }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementStoreTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageDataElementStoreTest.java	2015-03-30 09:30:54 +0000
@@ -33,7 +33,6 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -82,10 +81,6 @@
 
     private ProgramStageDataElement stageDataElementB;
 
-    private ProgramStageDataElement stageDataElementC;
-
-    private ProgramStageDataElement stageDataElementD;
-
     @Override
     public void setUpTest()
     {
@@ -118,8 +113,6 @@
 
         stageDataElementA = new ProgramStageDataElement( stageA, dataElementA, false, 1 );
         stageDataElementB = new ProgramStageDataElement( stageA, dataElementB, false, 2 );
-        stageDataElementC = new ProgramStageDataElement( stageB, dataElementA, false, 1 );
-        stageDataElementD = new ProgramStageDataElement( stageB, dataElementB, false, 2 );
     }
 
     @Test
@@ -183,19 +176,4 @@
 
         assertTrue( equals( programStageDataElementStore.getAll(), stageDataElementA, stageDataElementB ) );
     }
-    
-    @Test
-    public void testGetListDataElementByStage()
-    {
-        programStageDataElementStore.save( stageDataElementA );
-        programStageDataElementStore.save( stageDataElementB );
-        programStageDataElementStore.save( stageDataElementC );
-        programStageDataElementStore.save( stageDataElementD );
-
-        Collection<DataElement> stageDataElements = programStageDataElementStore.getListDataElement( stageA );
-        assertTrue( equals( stageDataElements, dataElementA, dataElementB ) );
-
-        stageDataElements = programStageDataElementStore.getListDataElement( stageB );
-        assertTrue( equals( stageDataElements, dataElementA, dataElementB ) );
-    }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetAggPSDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetAggPSDataElementsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetAggPSDataElementsAction.java	2015-03-30 09:30:54 +0000
@@ -33,8 +33,9 @@
 import java.util.List;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
@@ -50,20 +51,9 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    @Autowired
     private ProgramStageService programStageService;
 
-    public void setProgramStageService( ProgramStageService programStageService )
-    {
-        this.programStageService = programStageService;
-    }
-
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -94,8 +84,9 @@
     @Override
     public String execute()
     {
-        dataElementList = new ArrayList<>( programStageDataElementService
-            .getListDataElement( programStageService.getProgramStage( psId ) ) );
+        ProgramStage stage = programStageService.getProgramStage( psId );
+        
+        dataElementList = new ArrayList<>( stage.getAllDataElements() );
 
         if ( dataElementList != null && !dataElementList.isEmpty() )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetTrackedEntityDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetTrackedEntityDataElementsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/caseaggregation/GetTrackedEntityDataElementsAction.java	2015-03-30 09:30:54 +0000
@@ -30,16 +30,13 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 
 import com.opensymphony.xwork2.Action;
@@ -71,13 +68,6 @@
         this.programStageService = programStageService;
     }
 
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -113,20 +103,14 @@
         if ( programStageId == null )
         {
             Program program = programService.getProgram( programId );
-
-            Set<DataElement> dataElementsInProgram = new HashSet<>();
-
-            for ( ProgramStage programStage : program.getProgramStages() )
-            {
-                dataElementsInProgram.addAll( programStageDataElementService.getListDataElement( programStage ) );
-            }
             
-            dataElements = new ArrayList<>( dataElementsInProgram );
+            dataElements = new ArrayList<>( program.getAllDataElements() );
         }
         else
         {
-            dataElements = new ArrayList<>( programStageDataElementService
-                .getListDataElement( programStageService.getProgramStage( programStageId ) ) );
+            ProgramStage stage = programStageService.getProgramStage( programStageId );
+            
+            dataElements = new ArrayList<>( stage.getAllDataElements() );
         }
         
         Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetSelectedDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetSelectedDataElementsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/GetSelectedDataElementsAction.java	2015-03-30 09:30:54 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 
 import com.opensymphony.xwork2.Action;
@@ -58,13 +57,6 @@
         this.programStageService = programStageService;
     }
 
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
     // -------------------------------------------------------------------------
     // Getters & Setters
     // -------------------------------------------------------------------------
@@ -93,7 +85,7 @@
     {
         ProgramStage programStage = programStageService.getProgramStage( associationId );
 
-        dataElementList = new ArrayList<>( programStageDataElementService.getListDataElement( programStage ) );
+        dataElementList = new ArrayList<>( programStage.getAllDataElements() );
 
         Collections.sort( dataElementList, new IdentifiableObjectNameComparator() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SelectDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SelectDataElementAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/SelectDataElementAction.java	2015-03-30 09:30:54 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.system.filter.DataElementStringTypeFilter;
 import org.hisp.dhis.system.util.FilterUtils;
@@ -60,13 +59,6 @@
     {
         this.programStageService = programStageService;
     }
-
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
     
     // -------------------------------------------------------------------------
     // Getters & Setters
@@ -119,7 +111,7 @@
         
         if ( association != null )
         {
-            dataElements =  new ArrayList<>( programStageDataElementService.getListDataElement( association )  );
+            dataElements =  new ArrayList<>( association.getAllDataElements() );
 
             if ( typeTextOnly )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewDataEntryFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewDataEntryFormAction.java	2015-03-30 09:30:54 +0000
@@ -38,7 +38,6 @@
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.program.ProgramDataEntryService;
 import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.user.UserSettingService;
@@ -79,13 +78,6 @@
         this.programStageService = programStageService;
     }
 
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
     private SystemSettingManager systemSettingManager;
 
     public void setSystemSettingManager( SystemSettingManager systemSettingManager )
@@ -222,7 +214,7 @@
         // Get selected program-stage
         // ---------------------------------------------------------------------
 
-        dataElements = new ArrayList<>( programStageDataElementService.getListDataElement( programStage ) );
+        dataElements = new ArrayList<>( programStage.getAllDataElements() );
 
         Collections.sort( dataElements, new IdentifiableObjectNameComparator() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2015-03-29 20:22:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2015-03-30 09:30:54 +0000
@@ -406,8 +406,6 @@
     </property>
     <property name="programDataEntryService"
       ref="org.hisp.dhis.program.ProgramDataEntryService" />
-    <property name="programStageDataElementService"
-      ref="org.hisp.dhis.program.ProgramStageDataElementService" />
     <property name="systemSettingManager">
       <ref bean="org.hisp.dhis.setting.SystemSettingManager" />
     </property>
@@ -456,8 +454,6 @@
     <property name="programStageService">
       <ref bean="org.hisp.dhis.program.ProgramStageService" />
     </property>
-    <property name="programStageDataElementService"
-      ref="org.hisp.dhis.program.ProgramStageDataElementService" />
   </bean>
 
   <bean
@@ -467,8 +463,6 @@
     <property name="programStageService">
       <ref bean="org.hisp.dhis.program.ProgramStageService" />
     </property>
-    <property name="programStageDataElementService"
-      ref="org.hisp.dhis.program.ProgramStageDataElementService" />
   </bean>
 
   <bean
@@ -682,20 +676,12 @@
     scope="prototype">
     <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
     <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
-    <property name="programStageDataElementService"
-      ref="org.hisp.dhis.program.ProgramStageDataElementService" />
   </bean>
 
   <bean
     id="org.hisp.dhis.trackedentity.action.caseaggregation.GetAggPSDataElementsAction"
     class="org.hisp.dhis.trackedentity.action.caseaggregation.GetAggPSDataElementsAction"
-    scope="prototype">
-    <property name="programStageService">
-      <ref bean="org.hisp.dhis.program.ProgramStageService" />
-    </property>
-    <property name="programStageDataElementService"
-      ref="org.hisp.dhis.program.ProgramStageDataElementService" />
-  </bean>
+    scope="prototype"/>
 
   <bean
     id="org.hisp.dhis.trackedentity.action.caseaggregation.RemoveCaseAggregationConditionAction"