dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22249
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10669: Impl support for categories as dimensions in analytics engine
------------------------------------------------------------
revno: 10669
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-04-22 19:49:11 +0200
message:
Impl support for categories as dimensions in analytics engine
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/DimensionType.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-04-22 17:22:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2013-04-22 17:49:11 +0000
@@ -92,6 +92,14 @@
* @return a collection of DataElementCategories.
*/
Collection<DataElementCategory> getDataElementCategories( Collection<Integer> identifiers );
+
+ /**
+ * Retrieves the DataElementCategories with the given uids.
+ *
+ * @param uids the uids of the DataElementCategories to retrieve.
+ * @return a collection of DataElementCategories.
+ */
+ Collection<DataElementCategory> getDataElementCategoriesByUid( Collection<String> uids );
/**
* Retrieves the DataElementCategory with the given name.
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionType.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionType.java 2013-01-30 13:46:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionType.java 2013-04-22 17:49:11 +0000
@@ -37,5 +37,6 @@
PERIOD,
ORGANISATIONUNIT,
DATAELEMENT_GROUPSET,
- ORGANISATIONUNIT_GROUPSET
+ ORGANISATIONUNIT_GROUPSET,
+ CATEGORY
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-04-04 18:06:19 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-04-22 17:49:11 +0000
@@ -79,6 +79,7 @@
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroupSet;
@@ -627,6 +628,15 @@
return Arrays.asList( new Dimension( dimension, DimensionType.DATAELEMENT_GROUPSET, null, degs.getDisplayName(), des ) );
}
+ DataElementCategory dec = categoryService.getDataElementCategory( dimension );
+
+ if ( dec != null && dec.isDataDimension() )
+ {
+ List<IdentifiableObject> decos = asList( categoryService.getDataElementCategoriesByUid( options ) );
+
+ return Arrays.asList( new Dimension( dimension, DimensionType.CATEGORY, null, dec.getDisplayName(), decos ) );
+ }
+
throw new IllegalQueryException( "Dimension identifier does not reference any dimension: " + dimension );
}
@@ -673,6 +683,10 @@
{
options = asList( dataElementService.getDataElementGroupSet( dimension.getDimension() ).getMembers() );
}
+ else if ( DimensionType.CATEGORY.equals( dimension.getType() ) )
+ {
+ options = asList( categoryService.getDataElementCategory( dimension.getDimension() ).getCategoryOptions() );
+ }
}
// -----------------------------------------------------------------
=== 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-04-22 17:22:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-04-22 17:49:11 +0000
@@ -48,7 +48,6 @@
/**
* @author Abyot Asalefew
- * @version $Id$
*/
@Transactional
public class DefaultDataElementCategoryService
@@ -164,6 +163,11 @@
}
} );
}
+
+ public Collection<DataElementCategory> getDataElementCategoriesByUid( Collection<String> uids )
+ {
+ return dataElementCategoryStore.getByUid( uids );
+ }
public DataElementCategory getDataElementCategoryByName( String name )
{