← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18717: Model. Made Program - ProgramIndicators assocation bidirectional.

 

------------------------------------------------------------
revno: 18717
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-27 17:20:32 +0100
message:
  Model. Made Program - ProgramIndicators assocation bidirectional.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.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/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2015-03-12 07:39:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2015-03-27 16:20:32 +0000
@@ -102,6 +102,8 @@
 
     @Scanned
     private Set<UserAuthorityGroup> userRoles = new HashSet<>();
+    
+    private Set<ProgramIndicator> programIndicators = new HashSet<>();
 
     private Boolean onlyEnrollOnce = false;
 
@@ -148,7 +150,7 @@
     // -------------------------------------------------------------------------
     // Logic methods
     // -------------------------------------------------------------------------
-
+    
     /**
      * Returns the ProgramTrackedEntityAttribute of this Program which contains
      * the given TrackedEntityAttribute.
@@ -441,6 +443,21 @@
     }
 
     @JsonProperty
+    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
+    @JacksonXmlElementWrapper( localName = "programIndicators", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "programIndicator", namespace = DxfNamespaces.DXF_2_0 )
+    public Set<ProgramIndicator> getProgramIndicators()
+    {
+        return programIndicators;
+    }
+
+    public void setProgramIndicators( Set<ProgramIndicator> programIndicators )
+    {
+        this.programIndicators = programIndicators;
+    }
+
+    @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Boolean getOnlyEnrollOnce()

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2015-03-19 15:59:02 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2015-03-27 16:20:32 +0000
@@ -62,6 +62,11 @@
         column="userroleid" foreign-key="fk_program_userroles" />
     </set>
 
+	<set name="programIndicators" inverse="true">
+	  <key column="programid" />
+	  <one-to-many class="org.hisp.dhis.program.ProgramIndicator" />
+	</set>
+
     <set name="instanceReminders" order-by="daysAllowedSendMessage" cascade="all">
       <key column="programid" />
       <one-to-many class="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder" />