dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18730
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7921: Remove StageInProgram property of program-stage-instances.
------------------------------------------------------------
revno: 7921
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-08-16 22:47:08 +0700
message:
Remove StageInProgram property of program-stage-instances.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveRepeatableEventAction.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/ProgramStageInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2012-08-16 15:47:08 +0000
@@ -56,8 +56,6 @@
private ProgramStage programStage;
- private int stageInProgram;
-
private Date dueDate;
private Date executionDate;
@@ -120,8 +118,7 @@
result = result * prime + programStage.hashCode();
result = result * prime + dueDate.hashCode();
result = result * prime + ((executionDate == null) ? 0 : executionDate.hashCode());
- result = result * prime + stageInProgram;
-
+
return result;
}
@@ -210,22 +207,6 @@
}
/**
- * @param stageInProgram the stageInProgram to set
- */
- public void setStageInProgram( int stageInProgram )
- {
- this.stageInProgram = stageInProgram;
- }
-
- /**
- * @return the stageInProgram
- */
- public int getStageInProgram()
- {
- return stageInProgram;
- }
-
- /**
* @return the completed
*/
public boolean isCompleted()
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-08-06 09:34:34 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-08-16 15:47:08 +0000
@@ -121,8 +121,7 @@
moveStoredByFormStageInstanceToDataValue();
executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" );
-
- executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" );
+ executeSql( "ALTER TABLE programstageinstance DROP COLUMN stageInProgram" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml 2012-08-09 08:57:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageInstance.hbm.xml 2012-08-16 15:47:08 +0000
@@ -16,8 +16,6 @@
<many-to-one name="programStage" class="org.hisp.dhis.program.ProgramStage" column="programstageid"
not-null="true" foreign-key="fk_programstageinstance_programstageid" />
- <property name="stageInProgram" column="stageinprogram" not-null="true" />
-
<property name="dueDate" column="duedate" />
<property name="executionDate" column="executiondate" />
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-06-28 06:28:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-08-16 15:47:08 +0000
@@ -144,10 +144,7 @@
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
-
programStageInstance.setProgramStage( programStage );
-
- programStageInstance.setStageInProgram( programInstance.getProgramStageInstances().size() + 1 );
programStageInstance.setDueDate( date );
programStageInstance.setExecutionDate( date );
programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java 2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RegisterIrregularEncounterAction.java 2012-08-16 15:47:08 +0000
@@ -124,7 +124,6 @@
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( progamStage );
- programStageInstance.setStageInProgram( progamStage.getStageInProgram() );
programStageInstance.setDueDate( format.parseDate( dueDate ) );
int id = programStageInstanceService.addProgramStageInstance( programStageInstance );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-07-10 06:06:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-08-16 15:47:08 +0000
@@ -180,7 +180,6 @@
programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
- programStageInstance.setStageInProgram( programStage.getStageInProgram() );
programStageInstance.setDueDate( dateValue );
programStageInstance.setExecutionDate( dateValue );
programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java 2012-07-10 06:06:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java 2012-08-16 15:47:08 +0000
@@ -176,7 +176,6 @@
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
- programStageInstance.setStageInProgram( programStage.getStageInProgram() );
programStageInstance.setDueDate( currentDate );
programStageInstance.setExecutionDate( currentDate );
programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java 2012-08-09 02:00:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java 2012-08-16 15:47:08 +0000
@@ -73,8 +73,6 @@
private SelectedStateManager selectedStateManager;
- private ProgramStageInstanceService programStageInstanceService;
-
private PatientDataValueService patientDataValueService;
private ProgramValidationService programValidationService;
@@ -132,12 +130,7 @@
{
this.programValidationService = programValidationService;
}
-
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
- {
- this.programStageInstanceService = programStageInstanceService;
- }
-
+
public void setPatientDataValueService( PatientDataValueService patientDataValueService )
{
this.patientDataValueService = patientDataValueService;
@@ -208,21 +201,25 @@
* ------------------------------------------------------------------------
**/
- private void checkDataElementInMultiStage( ProgramStageInstance programStageInstance,
- DataElement dataElement )
+ private void checkDataElementInMultiStage( ProgramStageInstance programStageInstance, DataElement dataElement )
{
ProgramInstance programInstance = programStageInstance.getProgramInstance();
- List<ProgramStage> stages = new ArrayList<ProgramStage>( programInstance.getProgram().getProgramStages() );
+ List<ProgramStageInstance> pogramStageInstances = new ArrayList<ProgramStageInstance>(
+ programInstance.getProgramStageInstances() );
- int index = programStageInstance.getStageInProgram();
+ int index=0;
+ for ( index=0; index<pogramStageInstances.size(); index++ )
+ {
+ if ( programStageInstance.equals( pogramStageInstances.get( index ) ) )
+ {
+ break;
+ }
+ }
if ( index > 0 )
{
- ProgramStage prevStage = stages.get( index - 1 );
- ProgramStageInstance prevStageInstance = programStageInstanceService.getProgramStageInstance(
- programInstance, prevStage );
+ ProgramStageInstance prevStageInstance = pogramStageInstances.get( index );
PatientDataValue prevValue = patientDataValueService.getPatientDataValue( prevStageInstance, dataElement );
-
if ( prevValue == null )
{
String message = i18n.getString( "selected" ) + " " + i18n.getString( "program_stage" ) + " "
@@ -258,8 +255,8 @@
for ( ProgramValidation validation : programValidations )
{
- leftsideFormulaMap.put( validation.getId(), programValidationService
- .getValidationDescription( validation.getLeftSide() ) );
+ leftsideFormulaMap.put( validation.getId(),
+ programValidationService.getValidationDescription( validation.getLeftSide() ) );
if ( validation.getDateType() )
{
@@ -275,22 +272,22 @@
rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_current_date" ) );
break;
case BEFORE_OR_EQUALS_TO_CURRENT_DATE:
- rightsideFormulaMap.put( validation.getId(), i18n
- .getString( "before_or_equals_to_current_date" ) );
+ rightsideFormulaMap.put( validation.getId(),
+ i18n.getString( "before_or_equals_to_current_date" ) );
break;
case AFTER_CURRENT_DATE:
rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_current_date" ) );
break;
case AFTER_OR_EQUALS_TO_CURRENT_DATE:
- rightsideFormulaMap.put( validation.getId(), i18n
- .getString( "after_or_equals_to_current_date" ) );
+ rightsideFormulaMap.put( validation.getId(),
+ i18n.getString( "after_or_equals_to_current_date" ) );
break;
case BEFORE_DUE_DATE:
rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_due_date" ) );
break;
case BEFORE_OR_EQUALS_TO_DUE_DATE:
- rightsideFormulaMap.put( validation.getId(), i18n
- .getString( "before_or_equals_to_due_date" ) );
+ rightsideFormulaMap.put( validation.getId(),
+ i18n.getString( "before_or_equals_to_due_date" ) );
break;
case AFTER_DUE_DATE:
rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_due_date" ) );
@@ -313,9 +310,10 @@
if ( rightValidation == BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS )
{
- rightsideFormulaMap.put( validation.getId(), i18n
- .getString( "in_range_due_date_plus_or_minus" )
- + " " + daysValue + i18n.getString( "days" ) );
+ rightsideFormulaMap.put(
+ validation.getId(),
+ i18n.getString( "in_range_due_date_plus_or_minus" ) + " " + daysValue
+ + i18n.getString( "days" ) );
}
}
}
@@ -325,8 +323,8 @@
}
else
{
- rightsideFormulaMap.put( validation.getId(), programValidationService
- .getValidationDescription( validation.getRightSide() ) );
+ rightsideFormulaMap.put( validation.getId(),
+ programValidationService.getValidationDescription( validation.getRightSide() ) );
}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2012-03-28 07:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2012-08-16 15:47:08 +0000
@@ -190,8 +190,6 @@
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
- programStageInstance.setStageInProgram( programStage.getStageInProgram() );
-
Date dueDate = DateUtils.getDateAfterAddition( format.parseDate( dateOfIncident ), programStage
.getMinDaysFromStart() );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-08-16 13:46:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-08-16 15:47:08 +0000
@@ -391,8 +391,6 @@
scope="prototype">
<property name="selectedStateManager"
ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
<property name="patientDataValueService"
ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
<property name="programValidationService"
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 2012-05-26 12:31:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 2012-08-16 15:47:08 +0000
@@ -221,7 +221,6 @@
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
- programStageInstance.setStageInProgram( programStage.getStageInProgram() );
Date dueDate = DateUtils.getDateAfterAddition( sdf.parseDateTime( incidentDate ).toDate(),
programStage.getMinDaysFromStart() );
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveRepeatableEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveRepeatableEventAction.java 2012-07-16 09:20:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveRepeatableEventAction.java 2012-08-16 15:47:08 +0000
@@ -182,7 +182,6 @@
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
- programStageInstance.setStageInProgram( currentStageInstance.getStageInProgram() );
programStageInstanceService.addProgramStageInstance( programStageInstance );
return SUCCESS;