dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36312
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18599: Analytics tables. Using no ACL in queries for dimensional objects to avoid issues with sharing/cu...
------------------------------------------------------------
revno: 18599
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-13 16:48:26 +0100
message:
Analytics tables. Using no ACL in queries for dimensional objects to avoid issues with sharing/current user.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java
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/JdbcCompletenessTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.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/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.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/common/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2015-03-13 15:48:26 +0000
@@ -133,7 +133,9 @@
<T extends NameableObject> int getCountLikeShortName( Class<T> clazz, String shortName );
- <T extends DimensionalObject> List<T> getByDataDimensionNoAcl( Class<T> clazz, boolean dataDimension );
+ <T extends DimensionalObject> List<T> getDataDimensions( Class<T> clazz );
+
+ <T extends DimensionalObject> List<T> getDataDimensionsNoAcl( Class<T> clazz );
void refresh( Object object );
=== 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 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2015-03-13 15:48:26 +0000
@@ -114,13 +114,6 @@
DataElementCategory getDataElementCategoryByName( String name );
/**
- * Returns DataElementCategories which are considered data dimensions.
- *
- * @return DataElementCategories which are considered data dimensions.
- */
- Collection<DataElementCategory> getDataDimensionDataElementCategories();
-
- /**
* Returns all DataElementCategories.
*
* @return a collection of all DataElementCategories.
@@ -651,8 +644,6 @@
Collection<CategoryOptionGroupSet> getAllCategoryOptionGroupSets();
- Collection<CategoryOptionGroupSet> getDataDimensionCategoryOptionGroupSets();
-
CategoryOptionGroupSet getCategoryOptionGroupSetByName( String name );
int getCategoryOptionGroupSetCount();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2015-03-13 15:48:26 +0000
@@ -483,8 +483,6 @@
Collection<DataElementGroupSet> getAllDataElementGroupSets();
- Collection<DataElementGroupSet> getDataDimensionDataElementGroupSets();
-
Collection<DataElementGroupSet> getDataElementGroupSets( Collection<Integer> identifiers );
List<DataElementGroupSet> getDataElementGroupSetsByUid( Collection<String> uids );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java 2015-03-13 15:48:26 +0000
@@ -230,8 +230,6 @@
*/
Collection<OrganisationUnitGroupSet> getAllOrganisationUnitGroupSets();
- Collection<OrganisationUnitGroupSet> getDataDimensionOrganisationUnitGroupSets();
-
/**
* Returns all compulsory OrganisationUnitGroupSets.
*
=== 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 2015-03-10 11:36:58 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2015-03-13 15:48:26 +0000
@@ -46,6 +46,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
@@ -61,7 +62,6 @@
import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Cal;
@@ -92,6 +92,13 @@
{
this.resourceTableStore = resourceTableStore;
}
+
+ private IdentifiableObjectManager idObjectManager;
+
+ public void setIdObjectManager( IdentifiableObjectManager idObjectManager )
+ {
+ this.idObjectManager = idObjectManager;
+ }
private OrganisationUnitService organisationUnitService;
@@ -100,13 +107,6 @@
this.organisationUnitService = organisationUnitService;
}
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
private DataElementCategoryService categoryService;
public void setCategoryService( DataElementCategoryService categoryService )
@@ -241,7 +241,7 @@
List<DataElementCategoryOptionCombo> categoryOptionCombos =
new ArrayList<>( categoryService.getAllDataElementCategoryOptionCombos() );
- List<CategoryOptionGroupSet> groupSets = new ArrayList<>( categoryService.getAllCategoryOptionGroupSets() );
+ List<CategoryOptionGroupSet> groupSets = new ArrayList<>( idObjectManager.getAllNoAcl( CategoryOptionGroupSet.class ) );
Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
@@ -283,7 +283,7 @@
@Transactional
public void generateDataElementGroupSetTable()
{
- List<DataElementGroupSet> groupSets = new ArrayList<>( dataElementService.getDataDimensionDataElementGroupSets() );
+ List<DataElementGroupSet> groupSets = new ArrayList<>( idObjectManager.getDataDimensionsNoAcl( DataElementGroupSet.class ) );
Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
@@ -322,7 +322,7 @@
public void generateOrganisationUnitGroupSetTable()
{
List<OrganisationUnitGroupSet> groupSets = new ArrayList<>(
- organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets() );
+ idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class ) );
Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
@@ -345,7 +345,8 @@
// Create table - only using data dimension categories
// ---------------------------------------------------------------------
- List<DataElementCategory> categories = new ArrayList<>( categoryService.getDataDimensionDataElementCategories() );
+ List<DataElementCategory> categories = new ArrayList<>(
+ idObjectManager.getDataDimensionsNoAcl( DataElementCategory.class ) );
Collections.sort( categories, IdentifiableObjectNameComparator.INSTANCE );
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2015-03-03 16:18:51 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2015-03-13 15:48:26 +0000
@@ -11,8 +11,8 @@
<bean id="org.hisp.dhis.resourcetable.ResourceTableService" class="org.hisp.dhis.resourcetable.DefaultResourceTableService">
<property name="resourceTableStore" ref="org.hisp.dhis.resourcetable.ResourceTableStore" />
+ <property name="idObjectManager" ref="org.hisp.dhis.common.IdentifiableObjectManager" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2015-02-25 20:40:28 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2015-03-13 15:48:26 +0000
@@ -292,10 +292,10 @@
@Override
public List<DimensionalObject> getAllDimensions()
{
- Collection<DataElementCategory> dcs = categoryService.getDataDimensionDataElementCategories();
- Collection<CategoryOptionGroupSet> cogs = categoryService.getDataDimensionCategoryOptionGroupSets();
- Collection<DataElementGroupSet> degs = dataElementService.getDataDimensionDataElementGroupSets();
- Collection<OrganisationUnitGroupSet> ougs = organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets();
+ Collection<DataElementCategory> dcs = identifiableObjectManager.getDataDimensions( DataElementCategory.class );
+ Collection<CategoryOptionGroupSet> cogs = identifiableObjectManager.getDataDimensions( CategoryOptionGroupSet.class );
+ Collection<DataElementGroupSet> degs = identifiableObjectManager.getDataDimensions( DataElementGroupSet.class );
+ Collection<OrganisationUnitGroupSet> ougs = identifiableObjectManager.getDataDimensions( OrganisationUnitGroupSet.class );
final List<DimensionalObject> dimensions = new ArrayList<>();
@@ -312,7 +312,7 @@
@Override
public List<DimensionalObject> getDimensionConstraints()
{
- Collection<CategoryOptionGroupSet> cogs = categoryService.getDataDimensionCategoryOptionGroupSets();
+ Collection<CategoryOptionGroupSet> cogs = identifiableObjectManager.getDataDimensions( CategoryOptionGroupSet.class );
Collection<DataElementCategory> cs = categoryService.getAttributeCategories();
final List<DimensionalObject> dimensions = new ArrayList<>();
=== 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 2015-03-08 16:34:25 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2015-03-13 15:48:26 +0000
@@ -265,13 +265,13 @@
List<String[]> columns = new ArrayList<>();
Collection<DataElementGroupSet> dataElementGroupSets =
- dataElementService.getDataDimensionDataElementGroupSets();
+ idObjectManager.getDataDimensionsNoAcl( DataElementGroupSet.class );
Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
- idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true );
+ idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class );
Collection<CategoryOptionGroupSet> categoryOptionGroupSets =
- idObjectManager.getByDataDimensionNoAcl( CategoryOptionGroupSet.class, true );
+ idObjectManager.getDataDimensionsNoAcl( CategoryOptionGroupSet.class );
Collection<DataElementCategory> disaggregationCategories =
categoryService.getDisaggregationDataDimensionCategoriesNoAcl();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2015-03-13 15:48:26 +0000
@@ -163,7 +163,7 @@
List<String[]> columns = new ArrayList<>();
Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
- idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true );
+ idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class );
Collection<OrganisationUnitLevel> levels =
organisationUnitService.getOrganisationUnitLevels();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java 2015-03-13 15:48:26 +0000
@@ -157,7 +157,7 @@
List<String[]> columns = new ArrayList<>();
Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
- idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true );
+ idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class );
Collection<OrganisationUnitLevel> levels =
organisationUnitService.getOrganisationUnitLevels();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2015-03-13 15:48:26 +0000
@@ -232,7 +232,7 @@
List<String[]> columns = new ArrayList<>();
Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
- idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true );
+ idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class );
Collection<OrganisationUnitLevel> levels =
organisationUnitService.getOrganisationUnitLevels();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2015-03-13 15:48:26 +0000
@@ -909,16 +909,30 @@
@Override
@SuppressWarnings( "unchecked" )
- public <T extends DimensionalObject> List<T> getByDataDimensionNoAcl( Class<T> clazz, boolean dataDimension )
- {
- GenericDimensionalObjectStore<DimensionalObject> store = getDimensionalObjectStore( clazz );
-
- if ( store == null )
- {
- return new ArrayList<>();
- }
-
- return (List<T>) store.getByDataDimensionNoAcl( dataDimension );
+ public <T extends DimensionalObject> List<T> getDataDimensions( Class<T> clazz )
+ {
+ GenericDimensionalObjectStore<DimensionalObject> store = getDimensionalObjectStore( clazz );
+
+ if ( store == null )
+ {
+ return new ArrayList<>();
+ }
+
+ return (List<T>) store.getByDataDimension( true );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public <T extends DimensionalObject> List<T> getDataDimensionsNoAcl( Class<T> clazz )
+ {
+ GenericDimensionalObjectStore<DimensionalObject> store = getDimensionalObjectStore( clazz );
+
+ if ( store == null )
+ {
+ return new ArrayList<>();
+ }
+
+ return (List<T>) store.getByDataDimensionNoAcl( true );
}
//--------------------------------------------------------------------------
=== 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 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2015-03-13 15:48:26 +0000
@@ -141,23 +141,6 @@
}
@Override
- public Collection<DataElementCategory> getDataDimensionDataElementCategories()
- {
- Collection<DataElementCategory> categories = getAllDataElementCategories();
-
- FilterUtils.filter( categories, new Filter<DataElementCategory>()
- {
- @Override
- public boolean retain( DataElementCategory category )
- {
- return category != null && category.isDataDimension();
- }
- } );
-
- return categories;
- }
-
- @Override
public Collection<DataElementCategory> getAllDataElementCategories()
{
return i18n( i18nService, categoryStore.getAll() );
@@ -1037,12 +1020,6 @@
}
@Override
- public Collection<CategoryOptionGroupSet> getDataDimensionCategoryOptionGroupSets()
- {
- return categoryOptionGroupSetStore.getByDataDimension( true );
- }
-
- @Override
public CategoryOptionGroupSet getCategoryOptionGroupSetByName( String name )
{
return categoryOptionGroupSetStore.getByName( name );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2015-03-08 10:49:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2015-03-13 15:48:26 +0000
@@ -680,12 +680,6 @@
}
@Override
- public Collection<DataElementGroupSet> getDataDimensionDataElementGroupSets()
- {
- return i18n( i18nService, dataElementGroupSetStore.getByDataDimension( true ) );
- }
-
- @Override
public Collection<DataElementGroupSet> getDataElementGroupSets( final Collection<Integer> identifiers )
{
Collection<DataElementGroupSet> groupSets = getAllDataElementGroupSets();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2015-03-13 15:48:26 +0000
@@ -293,12 +293,6 @@
}
@Override
- public Collection<OrganisationUnitGroupSet> getDataDimensionOrganisationUnitGroupSets()
- {
- return i18n( i18nService, organisationUnitGroupSetStore.getByDataDimension( true ) );
- }
-
- @Override
public Collection<OrganisationUnitGroupSet> getCompulsoryOrganisationUnitGroupSets()
{
Collection<OrganisationUnitGroupSet> groupSets = new ArrayList<>();