dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02978
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 985: Made the association between DataElement and DataElementGroup bidirectional. Allowed for introduc...
------------------------------------------------------------
revno: 985
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-11-06 11:21:54 +0100
message:
Made the association between DataElement and DataElementGroup bidirectional. Allowed for introducing method DimensionOptionElement.getDimensionOptions.
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/DataElementCategoryOptionCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.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 09:18:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-11-06 10:21:54 +0000
@@ -125,6 +125,11 @@
private Date lastUpdated;
/**
+ * The data element groups which this
+ */
+ private Set<DataElementGroup> groups = new HashSet<DataElementGroup>();
+
+ /**
* The data sets which this data element is a member of.
*/
private Set<DataSet> dataSets = new HashSet<DataSet>();
@@ -218,6 +223,11 @@
{
return null;
}
+
+ public List<? extends DimensionOption> getDimensionOptions()
+ {
+ return new ArrayList<DimensionOption>( groups );
+ }
public boolean isDimensionSet()
{
@@ -436,6 +446,16 @@
this.lastUpdated = lastUpdated;
}
+ public Set<DataElementGroup> getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups( Set<DataElementGroup> groups )
+ {
+ this.groups = groups;
+ }
+
public Set<DataSet> getDataSets()
{
return dataSets;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2009-11-06 10:21:54 +0000
@@ -35,6 +35,7 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.dimension.DimensionOptionElement;
/**
@@ -63,6 +64,15 @@
public DataElementCategoryOptionCombo()
{
}
+
+ // -------------------------------------------------------------------------
+ // Dimension
+ // -------------------------------------------------------------------------
+
+ public List<? extends DimensionOption> getDimensionOptions()
+ {
+ return categoryOptions;
+ }
// -------------------------------------------------------------------------
// hashCode, equals and toString
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java 2009-11-06 10:21:54 +0000
@@ -27,10 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
/**
* @author Lars Helge Overland
*/
public interface DimensionOptionElement
{
String getName();
+
+ List<? extends DimensionOption> getDimensionOptions();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2009-11-05 19:04:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2009-11-06 10:21:54 +0000
@@ -29,11 +29,14 @@
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.datadictionary.ExtendedDataElement;
import org.hisp.dhis.dimension.Dimension;
+import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.dimension.DimensionOptionElement;
import org.hisp.dhis.dimension.DimensionSet;
@@ -68,6 +71,8 @@
private Date lastUpdated;
+ private Set<IndicatorGroup> groups = new HashSet<IndicatorGroup>();
+
private List<IndicatorGroupSet> groupSets = new ArrayList<IndicatorGroupSet>();
// -------------------------------------------------------------------------
@@ -105,7 +110,12 @@
{
return groupSets;
}
-
+
+ public List<? extends DimensionOption> getDimensionOptions()
+ {
+ return new ArrayList<DimensionOption>( groups );
+ }
+
public boolean isDimensionSet()
{
return groupSets != null && groupSets.size() > 0;
@@ -283,6 +293,16 @@
this.url = url;
}
+ public Set<IndicatorGroup> getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups( Set<IndicatorGroup> groups )
+ {
+ this.groups = groups;
+ }
+
public List<IndicatorGroupSet> getGroupSets()
{
return groupSets;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2009-11-03 11:04:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2009-11-06 10:21:54 +0000
@@ -52,6 +52,11 @@
<property name="lastUpdated"/>
+ <set name="groups" table="dataelementgroupmembers" inverse="true">
+ <key column="dataelementid"/>
+ <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid"/>
+ </set>
+
<set name="dataSets" table="datasetmembers" inverse="true">
<key column="dataelementid"/>
<many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid"/>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2009-11-03 11:04:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2009-11-06 10:21:54 +0000
@@ -60,5 +60,10 @@
<property name="lastUpdated"/>
+ <set name="groups" table="indicatorgroupmembers" inverse="true">
+ <key column="indicatorid"/>
+ <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid"/>
+ </set>
+
</class>
</hibernate-mapping>
=== 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-08-31 15:37:16 +0000
+++ 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
@@ -25,6 +25,6 @@
<many-to-many class="org.hisp.dhis.indicator.Indicator"
column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid"/>
</set>
-
+
</class>
</hibernate-mapping>