← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21686: add mapping fra categories.combos <=> combos.categories

 

------------------------------------------------------------
revno: 21686
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-01-11 13:37:10 +0700
message:
  add mapping fra categories.combos <=> combos.categories
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.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/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2016-01-11 06:09:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2016-01-11 06:37:10 +0000
@@ -50,9 +50,7 @@
 import org.hisp.dhis.common.view.ExportView;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 /**
  * A Category is a dimension of a data element. DataElements can have sets of
@@ -73,7 +71,7 @@
     @Scanned
     private List<DataElementCategoryOption> categoryOptions = new ArrayList<>();
 
-    private Set<DataElementCategoryCombo> categoryCombos = new HashSet<>();
+    private List<DataElementCategoryCombo> categoryCombos = new ArrayList<>();
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -242,12 +240,12 @@
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlElementWrapper( localName = "categoryCombos", namespace = DxfNamespaces.DXF_2_0 )
     @JacksonXmlProperty( localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0 )
-    public Set<DataElementCategoryCombo> getCategoryCombos()
+    public List<DataElementCategoryCombo> getCategoryCombos()
     {
         return categoryCombos;
     }
 
-    public void setCategoryCombos( Set<DataElementCategoryCombo> categoryCombos )
+    public void setCategoryCombos( List<DataElementCategoryCombo> categoryCombos )
     {
         this.categoryCombos = categoryCombos;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2015-08-18 22:46:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2016-01-11 06:37:10 +0000
@@ -3,7 +3,7 @@
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
   [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+  >
 
 <hibernate-mapping>
   <class name="org.hisp.dhis.dataelement.DataElementCategory" table="dataelementcategory">
@@ -19,6 +19,24 @@
 
     <property name="dataDimensionType" column="datadimensiontype" type="org.hisp.dhis.common.DataDimensionTypeUserType" />
 
+    <list name="categoryOptions" table="categories_categoryoptions">
+      <cache usage="read-write" />
+      <key column="categoryid" foreign-key="fk_categories_categoryoptions_categoryid" />
+      <list-index column="sort_order" base="1" />
+      <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption" column="categoryoptionid"
+        foreign-key="fk_category_categoryoptionid" />
+    </list>
+
+    <list name="categoryCombos" table="categorycombos_categories" inverse="true">
+      <cache usage="read-write" />
+      <key column="categoryid" foreign-key="fk_categorycombo_categoryid" />
+      <list-index column="sort_order" base="1" />
+      <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryCombo" column="categorycomboid"
+        foreign-key="fk_categorycombos_categories_categorycomboid" />
+    </list>
+
+    <property name="dataDimension" column="datadimension" />
+
     <!-- Access properties -->
     <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_dataelementcategory_userid" />
 
@@ -30,15 +48,5 @@
       <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
     </set>
 
-    <list name="categoryOptions" table="categories_categoryoptions">
-      <cache usage="read-write" />
-      <key column="categoryid" foreign-key="fk_categories_categoryoptions_categoryid" />
-      <list-index column="sort_order" base="1" />
-      <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption" column="categoryoptionid"
-        foreign-key="fk_category_categoryoptionid" />
-    </list>
-
-    <property name="dataDimension" column="datadimension" />
-
   </class>
 </hibernate-mapping>