dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17566
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7030: Added convencience methods for Program types
------------------------------------------------------------
revno: 7030
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-24 11:45:14 +0200
message:
Added convencience methods for Program types
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/AddRouteAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/DisplayRoutesAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventAction.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-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-05-24 09:45:14 +0000
@@ -305,4 +305,14 @@
{
return Patient.class.getMethod( "get" + property ).invoke( patient );
}
+
+ public boolean isSingleEvent()
+ {
+ return type != null && ( SINGLE_EVENT_WITH_REGISTRATION == type || SINGLE_EVENT_WITHOUT_REGISTRATION == type );
+ }
+
+ public boolean isRegistration()
+ {
+ return type != null && ( SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/AddRouteAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/AddRouteAction.java 2012-04-16 15:48:50 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/AddRouteAction.java 2012-05-24 09:45:14 +0000
@@ -27,14 +27,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.opensymphony.xwork2.Action;
import java.io.File;
import java.io.FileInputStream;
+
import org.apache.camel.CamelContext;
import org.apache.camel.model.RoutesDefinition;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.opensymphony.xwork2.Action;
+
/**
* @author Bob Jolliffe
* @version $Id$
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/DisplayRoutesAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/DisplayRoutesAction.java 2012-04-16 15:48:50 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/integration/DisplayRoutesAction.java 2012-05-24 09:45:14 +0000
@@ -27,11 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.opensymphony.xwork2.Action;
import java.util.List;
+
import org.apache.camel.CamelContext;
import org.apache.camel.model.RouteDefinition;
+import com.opensymphony.xwork2.Action;
+
/**
* @author Bob Jolliffe
* @version $Id$
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java 2012-05-23 19:48:53 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java 2012-05-24 09:45:14 +0000
@@ -84,7 +84,7 @@
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
-
+
private String beneficiaryId;
public String getBeneficiaryId()
@@ -97,7 +97,7 @@
this.beneficiaryId = beneficiaryId;
}
- private List<Program> programList = new ArrayList<Program>();
+ private List<Program> programList = new ArrayList<Program>();
public List<Program> getProgramList()
{
@@ -132,9 +132,9 @@
{
this.patient = patient;
}
-
+
private boolean validated;
-
+
public boolean isValidated()
{
return validated;
@@ -150,19 +150,23 @@
throws Exception
{
patient = patientService.getPatient( Integer.parseInt( beneficiaryId ) );
- for ( Program program : programService.getPrograms( patient.getOrganisationUnit() ) )
+
+ for ( Program program : programService.getPrograms( patient.getOrganisationUnit() ) )
{
- if ( program.getType() == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
+ if ( !program.isSingleEvent() )
{
if ( programInstanceService.getProgramInstances( patient, program ).size() > 0 )
{
enrolledProgramList.add( program );
-
- } else {
+
+ }
+ else
+ {
programList.add( program );
}
}
}
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java 2012-05-23 19:48:53 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java 2012-05-24 09:45:14 +0000
@@ -115,7 +115,7 @@
patient = patientService.getPatient( patientId );
for ( ProgramInstance programInstance : programInstanceService.getProgramInstances( patient ) )
{
- if ( programInstance.getProgram().getType() == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
+ if ( !programInstance.getProgram().isSingleEvent() )
{
programInstances.add( programInstance );
}
@@ -123,5 +123,4 @@
return SUCCESS;
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-05-16 09:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-05-24 09:45:14 +0000
@@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.hisp.dhis.api.mobile.model.Activity;
import org.hisp.dhis.api.mobile.model.ActivityPlan;
import org.hisp.dhis.api.mobile.model.DataElement;
@@ -255,7 +256,7 @@
{
prevDataValues.put( "DE" + patientDataValue.getDataElement().getId(), patientDataValue.getValue() );
}
+
return SUCCESS;
-
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-05-16 09:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-05-24 09:45:14 +0000
@@ -321,7 +321,5 @@
{
return "success_find";
}
-
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java 2012-04-10 06:49:47 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/ShowActivityTypeAction.java 2012-05-24 09:45:14 +0000
@@ -5,7 +5,6 @@
public class ShowActivityTypeAction
implements Action
{
-
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -38,8 +37,8 @@
public String execute()
throws Exception
{
- this.organisationUnitId = orgUnitId;
+ this.organisationUnitId = orgUnitId;
+
return SUCCESS;
}
-
}
=== modified 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 2012-05-23 19:48:53 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventAction.java 2012-05-24 09:45:14 +0000
@@ -105,7 +105,7 @@
for ( Program program : allProgram )
{
- if ( program.getType() == Program.SINGLE_EVENT_WITH_REGISTRATION )
+ if ( program.isSingleEvent() )
{
singleEventList.add( program );
}