dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25936
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12879: Using immutable lists in LoadDataElementsAction
------------------------------------------------------------
revno: 12879
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-11-04 23:19:00 +0100
message:
Using immutable lists in LoadDataElementsAction
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2013-10-21 03:37:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2013-11-04 22:19:00 +0000
@@ -28,8 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientIdentifierType;
@@ -86,23 +88,23 @@
this.sectionId = sectionId;
}
- private Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();
+ private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
- public Collection<PatientIdentifierType> getIdentifierTypes()
+ public List<PatientIdentifierType> getIdentifierTypes()
{
return identifierTypes;
}
- private Collection<PatientAttribute> patientAttributes = new HashSet<PatientAttribute>();
+ private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
- public Collection<PatientAttribute> getPatientAttributes()
+ public List<PatientAttribute> getPatientAttributes()
{
return patientAttributes;
}
- private Collection<ProgramStageDataElement> psDataElements;
+ private List<ProgramStageDataElement> psDataElements = new ArrayList<ProgramStageDataElement>();
- public Collection<ProgramStageDataElement> getPsDataElements()
+ public List<ProgramStageDataElement> getPsDataElements()
{
return psDataElements;
}
@@ -116,24 +118,26 @@
throws Exception
{
Program program = null;
+
if ( programStageId != null )
{
ProgramStage programStage = programStageService.getProgramStage( programStageId );
- psDataElements = programStage.getProgramStageDataElements();
+ psDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
program = programStage.getProgram();
+
+ System.out.println("psd " + psDataElements.size());
}
else if ( sectionId != null )
{
ProgramStageSection section = programStageSectionService.getProgramStageSection( sectionId );
- psDataElements = section.getProgramStageDataElements();
+ psDataElements = new ArrayList<ProgramStageDataElement>( section.getProgramStageDataElements() );
program = section.getProgramStageDataElements().iterator().next().getProgramStage().getProgram();
}
if ( program != null && program.isRegistration() )
{
- identifierTypes = program.getPatientIdentifierTypes();
- patientAttributes = program.getPatientAttributes();
-
+ identifierTypes = new ArrayList<PatientIdentifierType>( program.getPatientIdentifierTypes() );
+ patientAttributes = new ArrayList<PatientAttribute>( program.getPatientAttributes() );
}
return SUCCESS;