dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27050
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13410: Analytics, impl support attribute category options
------------------------------------------------------------
revno: 13410
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 18:18:05 +0100
message:
Analytics, impl support attribute category options
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.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/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2013-12-20 22:02:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2013-12-23 17:18:05 +0000
@@ -121,8 +121,7 @@
/**
* Returns all DataElementCategories.
*
- * @return a collection of all DataElementCategories, or an empty collection if there
- * are no DataElementCategories.
+ * @return a collection of all DataElementCategories.
*/
Collection<DataElementCategory> getAllDataElementCategories();
@@ -134,12 +133,28 @@
Collection<DataElementCategory> getDisaggregationCategories();
/**
+ * Retrieves all DataElementCategories of dimension type disaggregation and
+ * data dimensional.
+ *
+ * @return a collection of DataElementCategoryCombos.
+ */
+ Collection<DataElementCategory> getDisaggregationDataDimensionCategories();
+
+ /**
* Retrieves all DataElementCategories of dimension type attribute.
*
* @return a collection of DataElementCategoryCombos.
*/
Collection<DataElementCategory> getAttributeCategories();
+ /**
+ * Retrieves all DataElementCategories of dimension type attribute and
+ * data dimensional.
+ *
+ * @return a collection of DataElementCategoryCombos.
+ */
+ Collection<DataElementCategory> getAttributeDataDimensionCategories();
+
// -------------------------------------------------------------------------
// CategoryOption
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-12-10 14:17:42 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-12-23 17:18:05 +0000
@@ -165,7 +165,8 @@
"from datavalue dv " +
"left join _dataelementgroupsetstructure degs on dv.dataelementid=degs.dataelementid " +
"left join _organisationunitgroupsetstructure ougs on dv.sourceid=ougs.organisationunitid " +
- "left join _categorystructure cs on dv.categoryoptioncomboid=cs.categoryoptioncomboid " +
+ "left join _categorystructure dcs on dv.categoryoptioncomboid=dcs.categoryoptioncomboid " +
+ "left join _categorystructure acs on dv.attributeoptioncomboid=acs.categoryoptioncomboid " +
"left join _orgunitstructure ous on dv.sourceid=ous.organisationunitid " +
"left join _periodstructure ps on dv.periodid=ps.periodid " +
"left join dataelement de on dv.dataelementid=de.dataelementid " +
@@ -193,8 +194,11 @@
Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
organisationUnitGroupService.getAllOrganisationUnitGroupSets();
- Collection<DataElementCategory> categories =
- categoryService.getDataDimensionDataElementCategories();
+ Collection<DataElementCategory> disaggregationCategories =
+ categoryService.getDisaggregationDataDimensionCategories();
+
+ Collection<DataElementCategory> attributeCategories =
+ categoryService.getAttributeDataDimensionCategories();
Collection<OrganisationUnitLevel> levels =
organisationUnitService.getOrganisationUnitLevels();
@@ -211,9 +215,15 @@
columns.add( col );
}
- for ( DataElementCategory category : categories )
- {
- String[] col = { quote( category.getUid() ), "character(11)", "cs." + quote( category.getUid() ) };
+ for ( DataElementCategory category : disaggregationCategories )
+ {
+ String[] col = { quote( category.getUid() ), "character(11)", "dcs." + quote( category.getUid() ) };
+ columns.add( col );
+ }
+
+ for ( DataElementCategory category : attributeCategories )
+ {
+ String[] col = { quote( category.getUid() ), "character(11)", "acs." + quote( category.getUid() ) };
columns.add( col );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-12-20 22:02:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-12-23 17:18:05 +0000
@@ -194,10 +194,40 @@
return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );
}
+ public Collection<DataElementCategory> getDisaggregationDataDimensionCategories()
+ {
+ Collection<DataElementCategory> categories = getDisaggregationCategories();
+
+ FilterUtils.filter( categories, new Filter<DataElementCategory>()
+ {
+ public boolean retain( DataElementCategory category )
+ {
+ return category != null && category.isDataDimension();
+ }
+ } );
+
+ return categories;
+ }
+
public Collection<DataElementCategory> getAttributeCategories()
{
return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) );
}
+
+ public Collection<DataElementCategory> getAttributeDataDimensionCategories()
+ {
+ Collection<DataElementCategory> categories = getAttributeCategories();
+
+ FilterUtils.filter( categories, new Filter<DataElementCategory>()
+ {
+ public boolean retain( DataElementCategory category )
+ {
+ return category != null && category.isDataDimension();
+ }
+ } );
+
+ return categories;
+ }
@Override
public Collection<DataElementCategory> getDataElementCategoryBetween( int first, int max )