← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19110: ProgramRuleActionType, added new option for hiding program stage section. ProgramRuleAction, adde...

 

------------------------------------------------------------
revno: 19110
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-05-08 15:46:50 +0200
message:
  ProgramRuleActionType, added new option for hiding program stage section. ProgramRuleAction, added association to ProgramStageSection in order to support the action of hiding sections.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleActionType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml


--
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/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-04-28 13:03:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-05-08 13:46:50 +0000
@@ -36,6 +36,7 @@
 import org.hisp.dhis.common.view.DimensionalView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.program.ProgramStageSection;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonView;
@@ -88,18 +89,29 @@
     private ProgramRuleActionType programRuleActionType;
     
     /**
-     * The dataelement that is affected by the ruleAction. 
-     * Used for 
-     *       hidefield
-     *       showwarning
-     *       showerror
+     * The data element that is affected by the rule action. 
+     * Used for:
+     * 
+     * <ul>
+     * <li>hidefield</li>
+     * <li>showwarning</li>
+     * <li>showerror</li>
+     * </ul>
      */
     private DataElement dataElement;
     
     /**
+     * The program stage section that is affected by the rule action.
+     */
+    private ProgramStageSection programStageSection;
+    
+    /**
      * Used to determine which widget to display data for the two action types:
-     *       displaytext
-     *       displaykeydata
+     * 
+     * <ul>
+     * <li>displaytext</li>
+     * <li>displaykeydata</li>
+     * </ul>
      */
     private String location;
 
@@ -178,6 +190,19 @@
     }
 
     @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public ProgramStageSection getProgramStageSection()
+    {
+        return programStageSection;
+    }
+
+    public void setProgramStageSection( ProgramStageSection programStageSection )
+    {
+        this.programStageSection = programStageSection;
+    }
+
+    @JsonProperty
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getLocation()
     {
@@ -227,6 +252,7 @@
                 programRule = programRuleAction.getProgramRule();
                 programRuleActionType = programRuleAction.getProgramRuleActionType();
                 dataElement = programRuleAction.getDataElement();
+                programStageSection = programRuleAction.getProgramStageSection();
                 location = programRuleAction.getLocation();
                 content = programRuleAction.getContent();
                 data = programRuleAction.getData();
@@ -236,6 +262,7 @@
                 programRule = programRuleAction.getProgramRule() == null ? programRule : programRuleAction.getProgramRule();
                 programRuleActionType = programRuleAction.getProgramRuleActionType() == null ? programRuleActionType : programRuleAction.getProgramRuleActionType();
                 dataElement = programRuleAction.getDataElement() == null ? dataElement : programRuleAction.getDataElement();
+                programStageSection = programRuleAction.getProgramStageSection() == null ? programStageSection : programRuleAction.getProgramStageSection();
                 location = programRuleAction.getLocation() == null ? location : programRuleAction.getLocation();
                 content = programRuleAction.getContent() == null ? content : programRuleAction.getContent();
                 data = programRuleAction.getData() == null ? data : programRuleAction.getData();            

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleActionType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleActionType.java	2015-03-13 08:24:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleActionType.java	2015-05-08 13:46:50 +0000
@@ -35,6 +35,7 @@
     DISPLAYTEXT( "displaytext" ),
     DISPLAYKEYVALUEPAIR( "displaykeyvaluepair" ),
     HIDEFIELD( "hidefield" ),
+    HIDESECTION( "hidesection" ),
     ASSIGNVARIABLE( "assignvariable" ),
     SHOWWARNING( "showwarning" ),
     SHOWERROR( "showerror" );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java	2015-04-28 13:03:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java	2015-05-08 13:46:50 +0000
@@ -84,10 +84,14 @@
     private TrackedEntityAttribute attribute;
 
     /**
-     * The data element that is linked to the variable. Must de defined if the
+     * The data element that is linked to the variable. Must be defined if the
      * sourceType is one of the following:
-     * dataelement_newest_event_program_stage dataelement_newest_event_program
-     * dataelement_current_event
+     * 
+     * <ul>
+     * <li>dataelement_newest_event_program_stage</li>
+     * <li>dataelement_newest_event_program</li>
+     * <li>dataelement_current_event</li>
+     * </ul>
      */
     private DataElement dataElement;
 
@@ -107,11 +111,11 @@
     }
 
     public ProgramRuleVariable( String name, 
-            Program program, 
-            ProgramRuleVariableSourceType sourceType,
-            TrackedEntityAttribute attribute,
-            DataElement dataElement,
-            ProgramStage programStage)
+        Program program, 
+        ProgramRuleVariableSourceType sourceType,
+        TrackedEntityAttribute attribute,
+        DataElement dataElement,
+        ProgramStage programStage)
     {
         this();
         this.name = name;

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml	2015-04-28 20:52:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml	2015-05-08 13:46:50 +0000
@@ -29,6 +29,9 @@
     <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" 
         column="dataelementid" foreign-key="fk_programruleaction_dataelement" />
 
+	<many-to-one name="programStageSection" class="org.hisp.dhis.program.ProgramStageSection"
+		column="programstagesectionid" foreign-key="fk_programruleaction_programstagesection" />
+
     <property name="location" />
    
     <property name="content" type="text" />