dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40677
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20669: ProgramRuleActio, added ProgramIndicator to model to allow for hiding of indicators
------------------------------------------------------------
revno: 20669
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-13 12:07:22 +0200
message:
ProgramRuleActio, added ProgramIndicator to model to allow for hiding of indicators
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionStoreTest.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/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java 2015-10-13 09:51:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java 2015-10-13 10:07:22 +0000
@@ -42,6 +42,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.ProgramIndicator;
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -114,6 +115,15 @@
private TrackedEntityAttribute attribute;
/**
+ * The program indicator that is affected by the rule action.
+ * Used for:
+ * <ul>
+ * <li>hidefield</li>
+ * </ul>
+ */
+ private ProgramIndicator programIndicator;
+
+ /**
* The program stage section that is affected by the rule action.
*/
private ProgramStageSection programStageSection;
@@ -148,13 +158,14 @@
}
public ProgramRuleAction( String name, ProgramRule programRule, ProgramRuleActionType programRuleActionType,
- DataElement dataElement, TrackedEntityAttribute attribute, String location, String content, String data )
+ DataElement dataElement, TrackedEntityAttribute attribute, ProgramIndicator programIndicator, String location, String content, String data )
{
this.name = name;
this.programRule = programRule;
this.programRuleActionType = programRuleActionType;
this.dataElement = dataElement;
this.attribute = attribute;
+ this.programIndicator = programIndicator;
this.location = location;
this.content = content;
this.data = data;
@@ -216,6 +227,18 @@
this.attribute = attribute;
}
+ @JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public ProgramIndicator getProgramIndicator()
+ {
+ return programIndicator;
+ }
+
+ public void setProgramIndicator( ProgramIndicator programIndicator )
+ {
+ this.programIndicator = programIndicator;
+ }
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml 2015-09-07 09:28:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/programrule/hibernate/ProgramRuleAction.hbm.xml 2015-10-13 10:07:22 +0000
@@ -31,6 +31,9 @@
<many-to-one name="attribute" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute"
column="trackedentityattributeid" foreign-key="fk_programruleaction_trackedentityattribute" />
+ <many-to-one name="programIndicator" class="org.hisp.dhis.program.ProgramIndicator"
+ column="programindicatorid" foreign-key="fk_programruleaction_programindicator" />
+
<many-to-one name="programStageSection" class="org.hisp.dhis.program.ProgramStageSection"
column="programstagesectionid" foreign-key="fk_programruleaction_programstagesection" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionServiceTest.java 2015-08-28 09:33:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionServiceTest.java 2015-10-13 10:07:22 +0000
@@ -92,10 +92,10 @@
@Test
public void testAddGet()
{
- ProgramRuleAction actionA = new ProgramRuleAction( "ActionA", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, "$myvar", "true");
- ProgramRuleAction actionB = new ProgramRuleAction( "ActionB", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, "con","Hello", "$placeofliving");
- ProgramRuleAction actionC = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null);
- ProgramRuleAction actionD = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, null, attributeA, null, null, null);
+ ProgramRuleAction actionA = new ProgramRuleAction( "ActionA", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, null, "$myvar", "true");
+ ProgramRuleAction actionB = new ProgramRuleAction( "ActionB", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, null, "con","Hello", "$placeofliving");
+ ProgramRuleAction actionC = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null, null);
+ ProgramRuleAction actionD = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, null, attributeA, null, null, null, null);
int idA = actionService.addProgramRuleAction( actionA );
int idB = actionService.addProgramRuleAction( actionB );
@@ -111,11 +111,11 @@
@Test
public void testGetByProgram()
{
- ProgramRuleAction actionD = new ProgramRuleAction( "ActionD", programRuleB, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, "$myvar", "true");
- ProgramRuleAction actionE = new ProgramRuleAction( "ActionE", programRuleB, ProgramRuleActionType.DISPLAYTEXT, null, null, "con","Hello", "$placeofliving");
- ProgramRuleAction actionF = new ProgramRuleAction( "ActionF", programRuleB, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null);
+ ProgramRuleAction actionD = new ProgramRuleAction( "ActionD", programRuleB, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, null, "$myvar", "true");
+ ProgramRuleAction actionE = new ProgramRuleAction( "ActionE", programRuleB, ProgramRuleActionType.DISPLAYTEXT, null, null, null, "con","Hello", "$placeofliving");
+ ProgramRuleAction actionF = new ProgramRuleAction( "ActionF", programRuleB, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null, null);
//Add an action that is not part of programRuleB....
- ProgramRuleAction actionG = new ProgramRuleAction( "ActionG", programRuleC, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null);
+ ProgramRuleAction actionG = new ProgramRuleAction( "ActionG", programRuleC, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null, null);
actionService.addProgramRuleAction( actionD );
actionService.addProgramRuleAction( actionE );
@@ -136,7 +136,7 @@
@Test
public void testUpdate()
{
- ProgramRuleAction actionH = new ProgramRuleAction( "ActionH", programRuleB, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, "$myvar", "true");
+ ProgramRuleAction actionH = new ProgramRuleAction( "ActionH", programRuleB, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, null, "$myvar", "true");
int idH = actionService.addProgramRuleAction( actionH );
@@ -155,8 +155,8 @@
@Test
public void testDeleteProgramRuleVariable()
{
- ProgramRuleAction actionI = new ProgramRuleAction( "ActionI", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, "$myvar", "true");
- ProgramRuleAction actionJ = new ProgramRuleAction( "ActionJ", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, "con","Hello", "$placeofliving");
+ ProgramRuleAction actionI = new ProgramRuleAction( "ActionI", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, null, "$myvar", "true");
+ ProgramRuleAction actionJ = new ProgramRuleAction( "ActionJ", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, null, "con","Hello", "$placeofliving");
int idI = actionService.addProgramRuleAction( actionI );
int idJ = actionService.addProgramRuleAction( actionJ );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionStoreTest.java 2015-09-13 21:12:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/programrule/ProgramRuleActionStoreTest.java 2015-10-13 10:07:22 +0000
@@ -75,9 +75,9 @@
@Test
public void testGetByProgram()
{
- ProgramRuleAction actionA = new ProgramRuleAction( "ActionA", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, "$myvar", "true");
- ProgramRuleAction actionB = new ProgramRuleAction( "ActionB", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, "con","Hello", "$placeofliving");
- ProgramRuleAction actionC = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null);
+ ProgramRuleAction actionA = new ProgramRuleAction( "ActionA", programRuleA, ProgramRuleActionType.ASSIGNVARIABLE, null, null, null, null, "$myvar", "true");
+ ProgramRuleAction actionB = new ProgramRuleAction( "ActionB", programRuleA, ProgramRuleActionType.DISPLAYTEXT, null, null, null, "con","Hello", "$placeofliving");
+ ProgramRuleAction actionC = new ProgramRuleAction( "ActionC", programRuleA, ProgramRuleActionType.HIDEFIELD, dataElementA, null, null, null, null, null);
actionStore.save( actionA );
actionStore.save( actionB );