=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent'
=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action'
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventAction.java 2012-05-03 09:53:40 +0000
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.singleevent.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetSingleEventAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramService programService;
+
+ public ProgramService getProgramService()
+ {
+ return programService;
+ }
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public OrganisationUnitService getOrganisationUnitService()
+ {
+ return organisationUnitService;
+ }
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List singleEventList = new ArrayList();
+
+ public List getSingleEventList()
+ {
+ return singleEventList;
+ }
+
+ public void setSingleEventList( List singleEventList )
+ {
+ this.singleEventList = singleEventList;
+ }
+
+ private String organisationUnitId;
+
+ public String getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( organisationUnitId ) );
+ Collection allProgram = programService.getPrograms( orgUnit );
+
+ for ( Program program : allProgram )
+ {
+ if ( program.getSingleEvent() && !program.getAnonymous() )
+ {
+ singleEventList.add( program );
+ }
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventBeneficiaryAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventBeneficiaryAction.java 2012-05-03 09:53:40 +0000
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.singleevent.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetSingleEventBeneficiaryAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramInstanceService programInstanceService;
+
+ public ProgramInstanceService getProgramInstanceService()
+ {
+ return programInstanceService;
+ }
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private ProgramService programService;
+
+ public ProgramService getProgramService()
+ {
+ return programService;
+ }
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public OrganisationUnitService getOrganisationUnitService()
+ {
+ return organisationUnitService;
+ }
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List singleEventBeneficiaryList = new ArrayList();
+
+ public List getSingleEventBeneficiaryList()
+ {
+ return singleEventBeneficiaryList;
+ }
+
+ public void setSingleEventBeneficiaryList( List singleEventBeneficiaryList )
+ {
+ this.singleEventBeneficiaryList = singleEventBeneficiaryList;
+ }
+
+ private String organisationUnitId;
+
+ public String getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ public void setOrganisationUnitId( String organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private String programId;
+
+ public String getProgramId()
+ {
+ return programId;
+ }
+
+ public void setProgramId( String programId )
+ {
+ this.programId = programId;
+ }
+
+ private boolean validated;
+
+ public boolean isValidated()
+ {
+ return validated;
+ }
+
+ public void setValidated( boolean validated )
+ {
+ this.validated = validated;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( organisationUnitId ) );
+ Program program = programService.getProgram( Integer.parseInt( programId ) );
+ Collection allPatient = patientService.getPatients( orgUnit );
+ for ( Patient patient : allPatient )
+ {
+ if ( programInstanceService.getProgramInstances( patient, program ).size() == 0 )
+ {
+ singleEventBeneficiaryList.add( patient );
+ }
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 2012-05-03 09:53:40 +0000
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.singleevent.action;
+
+import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+
+public class GetSingleEventFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input Output
+ // -------------------------------------------------------------------------
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ public Integer getOrganisationUnitId()
+ {
+ return this.organisationUnitId;
+ }
+
+ private Integer programId;
+
+ public Integer getProgramId()
+ {
+ return programId;
+ }
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ private String eventName;
+
+ public String getEventName()
+ {
+ return this.eventName;
+ }
+
+ private Integer beneficiaryId;
+
+ public Integer getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ public void setBeneficiaryId( Integer beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ private Integer instId;
+
+ public void setInstId( Integer instId )
+ {
+ this.instId = instId;
+ }
+
+ public Integer getInstId()
+ {
+ return this.instId;
+ }
+
+ private boolean update;
+
+ public void setUpdate( boolean update )
+ {
+ this.update = update;
+ }
+
+ public boolean getUpdate()
+ {
+ return this.update;
+ }
+
+ private List dynForm = new ArrayList( 100 );
+
+ public List getDynForm()
+ {
+ return dynForm;
+ }
+
+ private ArrayList programStageDataElements = new ArrayList();
+
+ public ArrayList getProgramStageDataElements()
+ {
+ return this.programStageDataElements;
+ }
+
+ static final Comparator OrderBySortOrder = new Comparator()
+ {
+ public int compare( ProgramStageDataElement i1, ProgramStageDataElement i2 )
+ {
+ return i1.getSortOrder().compareTo( i2.getSortOrder() );
+ }
+ };
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ Program program = programService.getProgram( programId );
+ eventName = program.getName();
+ ProgramStage programStage = program.getProgramStages().iterator().next();
+ programStageDataElements = new ArrayList( programStage.getProgramStageDataElements() );
+ Collections.sort( programStageDataElements, OrderBySortOrder );
+ dynForm.clear();
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 2012-05-03 09:53:40 +0000
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.singleevent.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import com.opensymphony.xwork2.Action;
+
+public class SaveSingleEventAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private PatientService patientService;
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private PatientDataValueService patientDataValueService;
+
+ public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+ {
+ this.patientDataValueService = patientDataValueService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private NamebasedUtils util;
+
+ public NamebasedUtils getUtil()
+ {
+ return util;
+ }
+
+ public void setUtil( NamebasedUtils util )
+ {
+ this.util = util;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input Output
+ // -------------------------------------------------------------------------
+
+ private Map typeViolations = new HashMap();
+
+ public Map getTypeViolations()
+ {
+ return typeViolations;
+ }
+
+ private Integer programId;
+
+ public Integer getProgramId()
+ {
+ return programId;
+ }
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ private Integer beneficiaryId;
+
+ public Integer getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ public void setBeneficiaryId( Integer beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ private String eventName;
+
+ public String getEventName()
+ {
+ return this.eventName;
+ }
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ public Integer getOrganisationUnitId()
+ {
+ return this.organisationUnitId;
+ }
+
+ private boolean update;
+
+ public void setUpdate( boolean update )
+ {
+ this.update = update;
+ }
+
+ public boolean getUpdate()
+ {
+ return this.update;
+ }
+
+ private Integer instId;
+
+ public void setInstId( Integer instId )
+ {
+ this.instId = instId;
+ }
+
+ public Integer getInstId()
+ {
+ return this.instId;
+ }
+
+ private List dynForm = new ArrayList();
+
+ public void setDynForm( List dynForm )
+ {
+ this.dynForm = dynForm;
+ }
+
+ public List getDynForm()
+ {
+ return dynForm;
+ }
+
+ private String resultString;
+
+ public void setResultString( String resultString )
+ {
+ this.resultString = resultString;
+ }
+
+ public String getResultString()
+ {
+ return this.resultString;
+ }
+
+ private ArrayList programStageDataElements = new ArrayList();
+
+ public ArrayList getProgramStageDataElements()
+ {
+ return this.programStageDataElements;
+ }
+
+ static final Comparator OrderBySortOrder = new Comparator()
+ {
+ public int compare( ProgramStageDataElement i1, ProgramStageDataElement i2 )
+ {
+ return i1.getSortOrder().compareTo( i2.getSortOrder() );
+ }
+ };
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ Program program = programService.getProgram( programId );
+ eventName = program.getName();
+
+ Patient patient = patientService.getPatient( beneficiaryId );
+ ProgramStage programStage = program.getProgramStages().iterator().next();
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ programStageDataElements = new ArrayList( programStage.getProgramStageDataElements() );
+ Collections.sort( programStageDataElements, OrderBySortOrder );
+
+ // -------------------------------------------------------------------------
+ // Validation
+ // -------------------------------------------------------------------------
+
+ int i = 0;
+ for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+ {
+ DataElement dataElement = programStageDataElement.getDataElement();
+ String value = dynForm.get( i ).trim();
+ Boolean valueIsEmpty = (value == null || value.length() == 0);
+
+ if ( !valueIsEmpty )
+ {
+ String typeViolation = util.getTypeViolation( dataElement, value );
+
+ if ( typeViolation != null )
+ {
+ typeViolations.put( String.valueOf( dataElement.getId() ), typeViolation );
+ }
+ }
+
+ i++;
+ }
+
+ if ( !typeViolations.isEmpty() )
+ {
+ return ERROR;
+ }
+
+ ProgramInstance programInstance = new ProgramInstance();
+ programInstance.setEnrollmentDate( new Date() );
+ programInstance.setDateOfIncident( new Date() );
+ programInstance.setProgram( program );
+ programInstance.setPatient( patient );
+ programInstance.setCompleted( false );
+ programInstanceService.addProgramInstance( programInstance );
+
+ ProgramStageInstance programStageInstance = new ProgramStageInstance();
+ programStageInstance.setOrganisationUnit( organisationUnit );
+ programStageInstance.setProgramInstance( programInstance );
+ programStageInstance.setProgramStage( programStage );
+ programStageInstance.setDueDate( new Date() );
+ programStageInstance.setExecutionDate( new Date() );
+ programStageInstance.setCompleted( false );
+ programStageInstanceService.addProgramStageInstance( programStageInstance );
+
+ i = 0;
+ for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
+ {
+ DataElement dataElement = programStageDataElement.getDataElement();
+
+ PatientDataValue patientDataValue = new PatientDataValue();
+ patientDataValue.setDataElement( dataElement );
+ patientDataValue.setProgramStageInstance( programStageInstance );
+ patientDataValue.setValue( dynForm.get( i ).trim() );
+ patientDataValue.setProgramStageInstance( programStageInstance );
+ patientDataValueService.savePatientDataValue( patientDataValue );
+ i++;
+ }
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-04-20 02:32:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-05-03 09:53:40 +0000
@@ -286,10 +286,61 @@
ref="org.hisp.dhis.program.ProgramInstanceService"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -197,6 +198,37 @@
/dhis-web-light/programEnrollmentForm.vm
+
+
+
+
+ /dhis-web-light/main.vm
+ /dhis-web-light/selectSingleEvent.vm
+
+
+
+
+ /dhis-web-light/main.vm
+ /dhis-web-light/selectSingleEventBeneficiary.vm
+
+
+
+
+ /dhis-web-light/main.vm
+ /dhis-web-light/singleEventForm.vm
+
+
+
+
+ /mobile/selectSingleEventBeneficiary.action?programId=${programId}&organisationUnitId=${organisationUnitId}&validated=true
+ /dhis-web-light/main.vm
+ /dhis-web-light/singleEventForm.vm
+
+
$i18n.getString( "current_activityplan" )
$i18n.getString( "all_activityplan" )
+ $i18n.getString( "single_event" )
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEvent.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEvent.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEvent.vm 2012-05-03 09:53:40 +0000
@@ -0,0 +1,19 @@
+$i18n.getString( "single_event_list" )
+
+
+
+
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEventBeneficiary.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEventBeneficiary.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectSingleEventBeneficiary.vm 2012-05-03 09:53:40 +0000
@@ -0,0 +1,23 @@
+$i18n.getString( "beneficiary_list" )
+ #if( $validated)
+
+ #else
+
+ #end
+
+
+
+
+
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleEventForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleEventForm.vm 2012-05-03 09:53:40 +0000
@@ -0,0 +1,48 @@
+Single Event: $eventName
+
+
+
+