← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8309: Remove stageInProgram in program-stage.

 

------------------------------------------------------------
revno: 8309
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-01 10:06:32 +0700
message:
  Remove stageInProgram in program-stage.
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageOrderComparator.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.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/ProgramStage.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.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/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-09-25 03:50:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java	2012-10-01 03:06:32 +0000
@@ -40,14 +40,21 @@
     extends BaseIdentifiableObject
 {
     public static final String TYPE_DEFAULT = "default";
+
     public static final String TYPE_SECTION = "section";
+
     public static final String TYPE_CUSTOM = "custom";
-    
+
     public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-name}";
+
     public static final String TEMPLATE_MESSSAGE_PROGRAM_NAME = "{program-name}";
+
     public static final String TEMPLATE_MESSSAGE_PROGAM_STAGE_NAME = "{program-stage-name}";
+
     public static final String TEMPLATE_MESSSAGE_DUE_DATE = "{due-date}";
+
     public static final String TEMPLATE_MESSSAGE_ORGUNIT_NAME = "{orgunit-name}";
+
     public static final String TEMPLATE_MESSSAGE_DAYS_SINCE_DUE_DATE = "{days-since-due-date}";
 
     /**
@@ -57,8 +64,6 @@
 
     private String description;
 
-    private int stageInProgram;
-
     private int minDaysFromStart;
 
     private Boolean irregular;
@@ -74,11 +79,11 @@
     private Integer standardInterval;
 
     private String reportDateDescription;
-    
+
     private Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
-    
+
     private Boolean autoGenerateEvent = true;
-    
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -136,7 +141,7 @@
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
-    
+
     public DataEntryForm getDataEntryForm()
     {
         return dataEntryForm;
@@ -197,16 +202,6 @@
         this.irregular = irregular;
     }
 
-    public int getStageInProgram()
-    {
-        return stageInProgram;
-    }
-
-    public void setStageInProgram( int stageInProgram )
-    {
-        this.stageInProgram = stageInProgram;
-    }
-
     public int getMinDaysFromStart()
     {
         return minDaysFromStart;
@@ -246,7 +241,7 @@
     {
         this.reportDateDescription = reportDateDescription;
     }
-    
+
     public Boolean getAutoGenerateEvent()
     {
         return autoGenerateEvent;
@@ -271,7 +266,7 @@
 
         return TYPE_DEFAULT;
     }
-    
+
     public String getDefaultTemplateMessage()
     {
         return "Dear {person-name}, please come to your appointment on {program-stage-name} at {due-date}";

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java	2011-03-01 08:15:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceComparator.java	1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-package org.hisp.dhis.program.comparator;
-
-import java.util.Comparator;
-
-import org.hisp.dhis.program.ProgramStageInstance;
-
-public class ProgramStageInstanceComparator implements Comparator<ProgramStageInstance>
-{
-    public int compare( ProgramStageInstance programStageInstance1, ProgramStageInstance programStageInstance2 )
-    {
-        return programStageInstance1.getProgramStage().getStageInProgram() - programStageInstance2.getProgramStage().getStageInProgram();
-    }
-
-}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageOrderComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageOrderComparator.java	2011-04-15 11:12:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageOrderComparator.java	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-package org.hisp.dhis.program.comparator;
-
-import java.util.Comparator;
-
-import org.hisp.dhis.program.ProgramStage;
-
-public class ProgramStageOrderComparator implements Comparator<ProgramStage>
-{
-    public int compare( ProgramStage programStage1, ProgramStage programStage2 )
-    {
-        return programStage1.getStageInProgram() - programStage2.getStageInProgram();
-    }
-}

=== 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-09-25 05:18:34 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-10-01 03:06:32 +0000
@@ -120,7 +120,7 @@
         updateProgramStageTabularReportTable();
         moveStoredByFormStageInstanceToDataValue();
         
-        executeSql( "ALTER TABLE patiesntattribute DROP COLUMN inheritable" );
+        executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" );
         executeSql( "ALTER TABLE programstageinstance DROP COLUMN stageInProgram" );
         
         updateRelationshipIdentifiers();
@@ -133,6 +133,8 @@
         executeSql( "UPDATE programstage SET autoGenerateEvent=true WHERE autoGenerateEvent is null" );
         
         executeSql( "UPDATE program SET generatedByEnrollmentDate=false WHERE generatedByEnrollmentDate is null" );
+       
+        executeSql( "ALTER TABLE programstage DROP COLUMN stageInProgram" );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-09-25 03:50:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml	2012-10-01 03:06:32 +0000
@@ -15,9 +15,7 @@
 	&identifiableProperties;
 
     <property name="description" />
-
-    <property name="stageInProgram" column="stageinprogram" not-null="true" />
-
+	
     <property name="minDaysFromStart" column="mindaysfromstart" not-null="true" />
 
     <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_programstage_program" />

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java'
--- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java	2010-02-22 13:47:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java	2012-10-01 03:06:32 +0000
@@ -69,9 +69,9 @@
         
         organisationUnitService.addOrganisationUnit( organisationUnit );              
         
-        programStageA = createProgramStage( 'A', 2, 5 );       
-        programStageB = createProgramStage( 'B', 2, 5 );
-        programStageC = createProgramStage( 'C', 2, 5 );        
+        programStageA = createProgramStage( 'A', 5 );       
+        programStageB = createProgramStage( 'B', 5 );
+        programStageC = createProgramStage( 'C', 5 );        
 
         programStageService.saveProgramStage( programStageA );
         programStageService.saveProgramStage( programStageB );

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2012-07-10 10:34:53 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2012-10-01 03:06:32 +0000
@@ -890,13 +890,12 @@
         return program;
     }
 
-    public static ProgramStage createProgramStage( char uniqueCharacter, int stage, int minDays )
+    public static ProgramStage createProgramStage( char uniqueCharacter, int minDays )
     {
         ProgramStage programStage = new ProgramStage();
 
         programStage.setName( "name" + uniqueCharacter );
         programStage.setDescription( "description" + uniqueCharacter );
-        programStage.setStageInProgram( stage );
         programStage.setMinDaysFromStart( minDays );
 
         return programStage;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2012-09-25 05:18:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2012-10-01 03:06:32 +0000
@@ -239,7 +239,6 @@
 
             programStage.setName( SINGLE_EVENT + " " + name );
             programStage.setDescription( description );
-            programStage.setStageInProgram( program.getProgramStages().size() + 1 );
             programStage.setProgram( program );
             programStage.setMinDaysFromStart( 0 );
             programStage.setReportDateDescription( REPORT_DATE_DESCRIPTION );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-09-25 03:50:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2012-10-01 03:06:32 +0000
@@ -200,7 +200,6 @@
 
         programStage.setName( name );
         programStage.setDescription( description );
-        programStage.setStageInProgram( program.getProgramStages().size() + 1 );
         programStage.setProgram( program );
         programStage.setStandardInterval( standardInterval );
         programStage.setReportDateDescription( reportDateDescription );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java	2012-06-13 03:59:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSortOrderAction.java	2012-10-01 03:06:32 +0000
@@ -82,8 +82,6 @@
 
     public String execute()
     {
-        int stageInProgram = 1;
-
         Program program = programService.getProgram( id );
 
         if ( program.getProgramStages() != null )
@@ -93,12 +91,10 @@
 
             for ( ProgramStage programStage : programStages )
             {
-                programStage.setStageInProgram( stageInProgram++ );
-
                 programStageService.updateProgramStage( programStage );
             }
         }
-        
+
         return SUCCESS;
     }
 }