dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28984
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14569: Data set logic method
------------------------------------------------------------
revno: 14569
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-31 15:30:38 +0200
message:
Data set logic method
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
--
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/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2014-03-31 13:30:38 +0000
@@ -88,6 +88,28 @@
return name.equals( DEFAULT_NAME );
}
+ /**
+ * Returns a set of category option group sets which are associated with the
+ * category option groups of this category option.
+ */
+ public Set<CategoryOptionGroupSet> getGroupSets()
+ {
+ Set<CategoryOptionGroupSet> groupSets = new HashSet<CategoryOptionGroupSet>();
+
+ if ( groups != null )
+ {
+ for ( CategoryOptionGroup group : groups )
+ {
+ if ( group.getGroupSet() != null )
+ {
+ groupSets.add( group.getGroupSet() );
+ }
+ }
+ }
+
+ return groupSets;
+ }
+
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2014-03-31 13:30:38 +0000
@@ -46,8 +46,11 @@
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
+import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.indicator.Indicator;
@@ -463,6 +466,28 @@
return this;
}
+ /**
+ * Returns a set of category option group sets which are linked to this data
+ * set through its category combination.
+ */
+ public Set<CategoryOptionGroupSet> getCategoryOptionGroupSets()
+ {
+ Set<CategoryOptionGroupSet> groupSets = new HashSet<CategoryOptionGroupSet>();
+
+ if ( categoryCombo != null )
+ {
+ for ( DataElementCategory category : categoryCombo.getCategories() )
+ {
+ for ( DataElementCategoryOption categoryOption : category.getCategoryOptions() )
+ {
+ groupSets.addAll( categoryOption.getGroupSets() );
+ }
+ }
+ }
+
+ return groupSets;
+ }
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------