dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36688
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18769: Program stage section, getting available program indicators from program, not stage.
------------------------------------------------------------
revno: 18769
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-31 11:52:30 +0200
message:
Program stage section, getting available program indicators from program, not stage.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageSectionAction.java 2015-03-31 09:52:30 +0000
@@ -29,11 +29,10 @@
*/
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.hisp.dhis.program.ProgramIndicator;
-import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageSection;
@@ -54,16 +53,9 @@
// Dependencies
// -------------------------------------------------------------------------
+ @Autowired
private ProgramStageService programStageService;
- public void setProgramStageService( ProgramStageService programStageService )
- {
- this.programStageService = programStageService;
- }
-
- @Autowired
- private ProgramIndicatorService programIndicatorService;
-
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -89,9 +81,9 @@
return section;
}
- private Collection<ProgramStageDataElement> availableDataElements;
+ private List<ProgramStageDataElement> availableDataElements;
- public Collection<ProgramStageDataElement> getAvailableDataElements()
+ public List<ProgramStageDataElement> getAvailableDataElements()
{
return availableDataElements;
}
@@ -113,15 +105,20 @@
{
programStage = programStageService.getProgramStage( programStageId );
- availableDataElements = programStage.getProgramStageDataElements();
- availableProgramIndicators = new ArrayList<>( programStage.getProgramIndicators() );
-
- for ( ProgramStageSection section : programStage.getProgramStageSections() )
+ if ( programStage != null && programStage.getProgram() != null )
{
- availableDataElements.removeAll( section.getProgramStageDataElements() );
+ availableDataElements = new ArrayList<>( programStage.getProgramStageDataElements() );
+ availableProgramIndicators = new ArrayList<>( programStage.getProgram().getProgramIndicators() );
+
+ for ( ProgramStageSection section : programStage.getProgramStageSections() )
+ {
+ availableDataElements.removeAll( section.getProgramStageDataElements() );
+ }
+
+ Collections.sort( availableDataElements );
+ Collections.sort( availableProgramIndicators );
}
-
return SUCCESS;
}
}
=== 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-30 09:30:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2015-03-31 09:52:30 +0000
@@ -352,9 +352,7 @@
<bean
id="org.hisp.dhis.trackedentity.action.programstage.ShowAddProgramStageSectionAction"
class="org.hisp.dhis.trackedentity.action.programstage.ShowAddProgramStageSectionAction"
- scope="prototype">
- <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
- </bean>
+ scope="prototype"/>
<bean
id="org.hisp.dhis.trackedentity.action.programstage.ValidateProgramStageSectionAction"