← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17216: Analytics/resource tables. Only including data dimension data element group sets and organisation...

 

------------------------------------------------------------
revno: 17216
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-22 17:41:27 +0200
message:
  Analytics/resource tables. Only including data dimension data element group sets and organisation unit group sets in resource tables.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
  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/hibernate/HibernateCategoryStore.java
  resources/sql/integritychecks.sql


--
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/CategoryStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java	2014-10-22 15:41:27 +0000
@@ -39,4 +39,6 @@
     extends GenericDimensionalObjectStore<DataElementCategory>
 {
     Collection<DataElementCategory> getCategoriesByDimensionType( String dimensionType );
+    
+    Collection<DataElementCategory> getCategories( String dimensionType, boolean dataDimension );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2014-10-22 14:53:14 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2014-10-22 15:41:27 +0000
@@ -279,7 +279,7 @@
     @Transactional
     public void generateDataElementGroupSetTable()
     {
-        List<DataElementGroupSet> groupSets = new ArrayList<>( dataElementService.getAllDataElementGroupSets() );
+        List<DataElementGroupSet> groupSets = new ArrayList<>( dataElementService.getDataDimensionDataElementGroupSets() );
 
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
 
@@ -318,7 +318,7 @@
     public void generateOrganisationUnitGroupSetTable()
     {
         List<OrganisationUnitGroupSet> groupSets = new ArrayList<>(
-            organisationUnitGroupService.getAllOrganisationUnitGroupSets() );
+            organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets() );
 
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
 

=== 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-10-17 20:57:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-10-22 15:41:27 +0000
@@ -219,49 +219,25 @@
     @Override
     public Collection<DataElementCategory> getDisaggregationCategories()
     {
-        return i18n( i18nService,
-            categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );
+        return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );
     }
 
     @Override
     public Collection<DataElementCategory> getDisaggregationDataDimensionCategories()
     {
-        Collection<DataElementCategory> categories = getDisaggregationCategories();
-
-        FilterUtils.filter( categories, new Filter<DataElementCategory>()
-        {
-            @Override
-            public boolean retain( DataElementCategory category )
-            {
-                return category != null && category.isDataDimension();
-            }
-        } );
-
-        return categories;
+        return categoryStore.getCategories( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION, true );
     }
 
     @Override
     public Collection<DataElementCategory> getAttributeCategories()
     {
-        return i18n( i18nService,
-            categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) );
+        return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) );
     }
 
     @Override
     public Collection<DataElementCategory> getAttributeDataDimensionCategories()
     {
-        Collection<DataElementCategory> categories = getAttributeCategories();
-
-        FilterUtils.filter( categories, new Filter<DataElementCategory>()
-        {
-            @Override
-            public boolean retain( DataElementCategory category )
-            {
-                return category != null && category.isDataDimension();
-            }
-        } );
-
-        return categories;
+        return categoryStore.getCategories( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE, true );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryStore.java	2014-10-17 17:55:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryStore.java	2014-10-22 15:41:27 +0000
@@ -48,4 +48,13 @@
     {
         return getSharingCriteria( Restrictions.eq( "dataDimensionType", dimensionType ) ).list();
     }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Collection<DataElementCategory> getCategories( String dimensionType, boolean dataDimension )
+    {
+        return getSharingCriteria( 
+            Restrictions.eq( "dataDimensionType", dimensionType ),
+            Restrictions.eq( "dataDimension", dataDimension ) ).list();
+    }
 }

=== modified file 'resources/sql/integritychecks.sql'
--- resources/sql/integritychecks.sql	2014-10-06 22:28:17 +0000
+++ resources/sql/integritychecks.sql	2014-10-22 15:41:27 +0000
@@ -158,7 +158,7 @@
 join categorycombo c on (co.categorycomboid=c.categorycomboid)
 order by c.name, n.categoryoptioncomboname;
 
--- Get category combinations without data elements
+-- Get category combinations without data elements or data sets
 
 select * from categorycombo where categorycomboid not in (select distinct categorycomboid from dataelement);