← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18719: Model. Added many-to-many association between ProgramStageSection and ProgramIndicator.

 

------------------------------------------------------------
revno: 18719
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-27 18:09:40 +0100
message:
  Model. Added many-to-many association between ProgramStageSection and ProgramIndicator.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.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/program/ProgramStageSection.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java	2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java	2015-03-27 17:09:40 +0000
@@ -56,6 +56,8 @@
     private ProgramStage programStage;
 
     private List<ProgramStageDataElement> programStageDataElements = new ArrayList<>();
+    
+    private List<ProgramIndicator> programIndicators = new ArrayList<>();
 
     private Integer sortOrder;
 
@@ -117,6 +119,20 @@
 
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlElementWrapper( localName = "programIndicators", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "programIndicator", namespace = DxfNamespaces.DXF_2_0 )
+    public List<ProgramIndicator> getProgramIndicators()
+    {
+        return programIndicators;
+    }
+
+    public void setProgramIndicators( List<ProgramIndicator> programIndicators )
+    {
+        this.programIndicators = programIndicators;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Integer getSortOrder()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml	2014-06-12 09:41:31 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml	2015-03-27 17:09:40 +0000
@@ -23,6 +23,13 @@
       <list-index column="section_sort_order" base="1" />
       <one-to-many class="org.hisp.dhis.program.ProgramStageDataElement" />
     </list>
+    
+    <list name="programIndicators" table="programstagesection_programindicators">
+      <key column="programstagesectionid" foreign-key="fk_programstagesection_programindicators_sectionid" />
+      <list-index column="sort_order" base="1" />
+      <many-to-many class="org.hisp.dhis.program.ProgramIndicator" column="programindicatorid"
+      	foreign-key="fk_programstagesection_programindicators_indicatorid"/>
+    </list>
 
     <property name="sortOrder" column="sortorder" not-null="true" />