dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02980
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 986: Made the association between GroupSet and Group bidirectional and one-to-many. Allowed for introd...
------------------------------------------------------------
revno: 986
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-11-06 11:43:00 +0100
message:
Made the association between GroupSet and Group bidirectional and one-to-many. Allowed for introducing method DimensionOption.getDimension.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.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/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-11-06 10:21:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-11-06 10:43:00 +0000
@@ -229,6 +229,11 @@
return new ArrayList<DimensionOption>( groups );
}
+ public Dimension getDimension()
+ {
+ return DIMENSION;
+ }
+
public boolean isDimensionSet()
{
return groupSets != null && groupSets.size() > 0;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2009-11-06 10:43:00 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dimension.Dimension;
import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.dimension.DimensionOptionElement;
@@ -71,6 +72,15 @@
{
return categoryOptionCombos;
}
+
+ // -------------------------------------------------------------------------
+ // Dimension
+ // -------------------------------------------------------------------------
+
+ public Dimension getDimension()
+ {
+ return category;
+ }
// -------------------------------------------------------------------------
// hashCode, equals and toString
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2009-11-06 10:43:00 +0000
@@ -33,6 +33,7 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dimension.Dimension;
import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.dimension.DimensionOptionElement;
@@ -41,15 +42,12 @@
* @version $Id: DataElementGroup.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class DataElementGroup
- extends IdentifiableObject
- implements DimensionOption
+ extends IdentifiableObject implements DimensionOption
{
-
- /**
- * The members of the DataElementGroup.
- */
private Set<DataElement> members = new HashSet<DataElement>();
+ private DataElementGroupSet groupSet;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -72,6 +70,11 @@
return new ArrayList<DataElement>( members );
}
+ public Dimension getDimension()
+ {
+ return groupSet;
+ }
+
// -------------------------------------------------------------------------
// hashCode and equals
// -------------------------------------------------------------------------
@@ -115,7 +118,6 @@
// Getters and setters
// -------------------------------------------------------------------------
-
public Set<DataElement> getMembers()
{
return members;
@@ -125,4 +127,14 @@
{
this.members = members;
}
+
+ public DataElementGroupSet getGroupSet()
+ {
+ return groupSet;
+ }
+
+ public void setGroupSet( DataElementGroupSet groupSet )
+ {
+ this.groupSet = groupSet;
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java 2009-11-03 11:34:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java 2009-11-06 10:43:00 +0000
@@ -33,7 +33,6 @@
import java.util.Map;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dimension.Dimension;
import org.hisp.dhis.dimension.DimensionOption;
@@ -156,9 +155,9 @@
if ( optionCombo != null && !optionCombo.isDefault() )
{
- for ( DataElementCategoryOption categoryOption : optionCombo.getCategoryOptions() )
+ for ( DimensionOption dimensionOption : optionCombo.getDimensionOptions() )
{
- dimensions.put( categoryOption.getCategory(), categoryOption );
+ dimensions.put( dimensionOption.getDimension(), dimensionOption );
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java 2009-11-06 10:43:00 +0000
@@ -37,4 +37,6 @@
String getName();
List<? extends DimensionOptionElement> getDimensionOptionElements();
+
+ Dimension getDimension();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2009-11-06 10:43:00 +0000
@@ -33,6 +33,7 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dimension.Dimension;
import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.dimension.DimensionOptionElement;
@@ -41,11 +42,12 @@
* @version $Id: IndicatorGroup.java 5296 2008-05-29 16:06:14Z larshelg $
*/
public class IndicatorGroup
- extends IdentifiableObject
- implements DimensionOption
+ extends IdentifiableObject implements DimensionOption
{
private Set<Indicator> members = new HashSet<Indicator>();
+ private IndicatorGroupSet groupSet;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -67,6 +69,11 @@
{
return new ArrayList<Indicator>( members );
}
+
+ public Dimension getDimension()
+ {
+ return groupSet;
+ }
// -------------------------------------------------------------------------
// hashCode and equals
@@ -111,7 +118,6 @@
// Getters and setters
// -------------------------------------------------------------------------
-
public Set<Indicator> getMembers()
{
return members;
@@ -121,4 +127,14 @@
{
this.members = members;
}
+
+ public IndicatorGroupSet getGroupSet()
+ {
+ return groupSet;
+ }
+
+ public void setGroupSet( IndicatorGroupSet groupSet )
+ {
+ this.groupSet = groupSet;
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2009-11-06 09:18:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2009-11-06 10:43:00 +0000
@@ -140,6 +140,11 @@
{
return null;
}
+
+ public Dimension getDimension()
+ {
+ return DIMENSION;
+ }
// -------------------------------------------------------------------------
// hashCode, equals and toString
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2009-11-06 09:18:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2009-11-06 10:43:00 +0000
@@ -107,6 +107,11 @@
{
return null;
}
+
+ public Dimension getDimension()
+ {
+ return DIMENSION;
+ }
// -------------------------------------------------------------------------
// hashCode, equals and toString
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml 2009-08-31 15:37:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml 2009-11-06 10:43:00 +0000
@@ -24,8 +24,13 @@
<set name="members" table="dataelementgroupmembers">
<key column="dataelementgroupid"/>
<many-to-many class="org.hisp.dhis.dataelement.DataElement"
- column="dataelementid" foreign-key="fk_dataelementgroup_dataelementid"/>
+ column="dataelementid" foreign-key="fk_dataelementgroup_dataelementid"/>
</set>
+
+ <join table="dataelementgroupsetmembers" inverse="true">
+ <key column="dataelementgroupid"/>
+ <many-to-one column="dataelementgroupsetid" name="groupSet"/>
+ </join>
</class>
</hibernate-mapping>
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml 2009-10-27 17:41:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml 2009-11-06 10:43:00 +0000
@@ -22,7 +22,7 @@
<key column="dataelementgroupsetid"/>
<list-index column="sort_order" base="1"/>
<many-to-many class="org.hisp.dhis.dataelement.DataElementGroup"
- column="dataelementgroupid" foreign-key="fk_dataelementgroupset_dataelementgroupid"/>
+ column="dataelementgroupid" unique="true" foreign-key="fk_dataelementgroupset_dataelementgroupid"/>
</list>
</class>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml 2009-11-06 10:21:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml 2009-11-06 10:43:00 +0000
@@ -23,8 +23,13 @@
<set name="members" table="indicatorgroupmembers">
<key column="indicatorgroupid"/>
<many-to-many class="org.hisp.dhis.indicator.Indicator"
- column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid"/>
+ column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid"/>
</set>
+ <join table="indicatorgroupsetmembers" inverse="true">
+ <key column="indicatorgroupid"/>
+ <many-to-one column="indicatorgroupsetid" name="groupSet"/>
+ </join>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml 2009-10-27 17:41:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml 2009-11-06 10:43:00 +0000
@@ -22,7 +22,7 @@
<key column="indicatorgroupsetid"/>
<list-index column="sort_order" base="1"/>
<many-to-many class="org.hisp.dhis.indicator.IndicatorGroup"
- column="indicatorgroupid" foreign-key="fk_indicatorgroupset_indicatorgroupid"/>
+ column="indicatorgroupid" unique="true" foreign-key="fk_indicatorgroupset_indicatorgroupid"/>
</list>
</class>