← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14092: Support for category option group sets in analytics service

 

------------------------------------------------------------
revno: 14092
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-02-21 14:44:04 +0100
message:
  Support for category option group sets in analytics service
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/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	2014-02-13 14:24:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2014-02-21 13:44:04 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.hierarchy.HierarchyViolationException;
 
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -396,7 +397,6 @@
      * DataElementCategoryOptions.
      * 
      * @param categoryOptions
-     * @return
      */
     DataElementCategoryOptionCombo getDataElementCategoryOptionCombo(
         Collection<DataElementCategoryOption> categoryOptions );
@@ -410,6 +410,12 @@
      */
     DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo );
 
+    /**
+     * Retrieves a DataElementCategoryOptionCombo.
+     * 
+     * @param categoryCombo the DataElementCategoryOptionCombo.
+     * @param categoryOptions the set of DataElementCategoryOptions.
+     */
     DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryCombo categoryCombo,
         Set<DataElementCategoryOption> categoryOptions );
 
@@ -563,6 +569,8 @@
     CategoryOptionGroup getCategoryOptionGroup( int id );
 
     CategoryOptionGroup getCategoryOptionGroup( String uid );
+    
+    List<CategoryOptionGroup> getCategoryOptionGroupsByUid( Collection<String> uids );
 
     void deleteCategoryOptionGroup( CategoryOptionGroup group );
 
@@ -593,6 +601,8 @@
     CategoryOptionGroupSet getCategoryOptionGroupSet( int id );
 
     CategoryOptionGroupSet getCategoryOptionGroupSet( String uid );
+    
+    List<CategoryOptionGroupSet> getCategoryOptionGroupSetsByUid( Collection<String> uids );
 
     void deleteCategoryOptionGroupSet( CategoryOptionGroupSet group );
 

=== 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	2014-02-04 21:38:37 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2014-02-21 13:44:04 +0000
@@ -99,6 +99,7 @@
 import org.hisp.dhis.common.NameableObject;
 import org.hisp.dhis.common.NameableObjectUtils;
 import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -964,6 +965,17 @@
             return Arrays.asList( object );
         }
         
+        CategoryOptionGroupSet cogs = categoryService.getCategoryOptionGroupSet( dimension );
+        
+        if ( cogs != null )
+        {
+            List<NameableObject> cogz = asList( categoryService.getCategoryOptionGroupsByUid( items ) );
+            
+            DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.CATEGORYOPTION_GROUPSET, null, cogs.getDisplayName(), cogz );
+            
+            return Arrays.asList( object );
+        }
+        
         DataElementCategory dec = categoryService.getDataElementCategory( dimension );
         
         if ( dec != null && dec.isDataDimension() )

=== 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	2014-02-13 14:24:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-02-21 13:44:04 +0000
@@ -793,6 +793,11 @@
         return categoryOptionGroupStore.getByUid( uid );
     }
 
+    public List<CategoryOptionGroup> getCategoryOptionGroupsByUid( Collection<String> uids )
+    {
+        return categoryOptionGroupStore.getByUid( uids );
+    }
+    
     public void deleteCategoryOptionGroup( CategoryOptionGroup group )
     {
         categoryOptionGroupStore.delete( group );
@@ -874,6 +879,11 @@
     {
         return categoryOptionGroupSetStore.getByUid( uid );
     }
+    
+    public List<CategoryOptionGroupSet> getCategoryOptionGroupSetsByUid( Collection<String> uids )
+    {
+        return categoryOptionGroupSetStore.getByUid( uids );
+    }
 
     public void deleteCategoryOptionGroupSet( CategoryOptionGroupSet group )
     {


Follow ups