=== 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 13:34:06 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2015-03-08 14:57:52 +0000 @@ -132,6 +132,8 @@ int getCountLikeName( Class clazz, String name ); int getCountLikeShortName( Class clazz, String shortName ); + + List getByDataDimensionNoAcl( Class clazz, boolean dataDimension ); void refresh( Object object ); === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java 2015-03-08 14:57:52 +0000 @@ -0,0 +1,36 @@ +package org.hisp.dhis.dataelement; + +/* + * Copyright (c) 2004-2015, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import org.hisp.dhis.common.GenericDimensionalObjectStore; + +public interface CategoryOptionGroupSetStore + extends GenericDimensionalObjectStore +{ +} === 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 2015-03-08 10:49:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java 2015-03-08 14:57:52 +0000 @@ -29,6 +29,7 @@ */ import java.util.Collection; +import java.util.List; import org.hisp.dhis.common.GenericDimensionalObjectStore; @@ -41,4 +42,6 @@ Collection getCategoriesByDimensionType( String dimensionType ); Collection getCategories( String dimensionType, boolean dataDimension ); + + List getCategoriesNoAcl( String dimensionType, boolean dataDimension ); } === 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-01-24 11:12:45 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2015-03-08 14:57:52 +0000 @@ -136,11 +136,11 @@ /** * Retrieves all DataElementCategories of dimension type disaggregation and - * data dimensional. + * data dimensional. Ignores ACL / sharing. * * @return a collection of DataElementCategoryCombos. */ - Collection getDisaggregationDataDimensionCategories(); + Collection getDisaggregationDataDimensionCategoriesNoAcl(); /** * Retrieves all DataElementCategories of dimension type attribute. @@ -151,11 +151,11 @@ /** * Retrieves all DataElementCategories of dimension type attribute and data - * dimensional. + * dimensional. Ignores ACL / sharing. * * @return a collection of DataElementCategoryCombos. */ - Collection getAttributeDataDimensionCategories(); + Collection getAttributeDataDimensionCategoriesNoAcl(); // ------------------------------------------------------------------------- // CategoryOption === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java 2015-02-27 11:50:10 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java 2015-03-08 14:57:52 +0000 @@ -43,11 +43,11 @@ import org.hisp.dhis.analytics.AnalyticsTable; import org.hisp.dhis.analytics.AnalyticsTableManager; import org.hisp.dhis.common.CodeGenerator; +import org.hisp.dhis.common.IdentifiableObjectManager; import org.hisp.dhis.dataapproval.DataApprovalLevelService; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.jdbc.StatementBuilder; -import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.period.Period; import org.hisp.dhis.setting.SystemSettingManager; @@ -71,7 +71,10 @@ public static final String PREFIX_ORGUNITGROUPSET = "ougs_"; public static final String PREFIX_ORGUNITLEVEL = "uidlevel"; public static final String PREFIX_INDEX = "in_"; - + + @Autowired + protected IdentifiableObjectManager idObjectManager; + @Autowired protected OrganisationUnitService organisationUnitService; @@ -79,9 +82,6 @@ protected DataElementService dataElementService; @Autowired - protected OrganisationUnitGroupService organisationUnitGroupService; - - @Autowired protected DataElementCategoryService categoryService; @Autowired === 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-02 10:56:38 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2015-03-08 14:57:52 +0000 @@ -268,16 +268,18 @@ dataElementService.getDataDimensionDataElementGroupSets(); Collection orgUnitGroupSets = - organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets(); - + idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true ); + + System.out.println("org unit group sets " + orgUnitGroupSets); + Collection categoryOptionGroupSets = - categoryService.getDataDimensionCategoryOptionGroupSets(); + idObjectManager.getByDataDimensionNoAcl( CategoryOptionGroupSet.class, true ); Collection disaggregationCategories = - categoryService.getDisaggregationDataDimensionCategories(); + categoryService.getDisaggregationDataDimensionCategoriesNoAcl(); Collection attributeCategories = - categoryService.getAttributeDataDimensionCategories(); + categoryService.getAttributeDataDimensionCategoriesNoAcl(); Collection levels = organisationUnitService.getOrganisationUnitLevels(); === 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-02 10:56:38 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2015-03-08 14:57:52 +0000 @@ -163,7 +163,7 @@ List columns = new ArrayList<>(); Collection orgUnitGroupSets = - organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets(); + idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true ); Collection 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-02 10:56:38 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java 2015-03-08 14:57:52 +0000 @@ -157,7 +157,7 @@ List columns = new ArrayList<>(); Collection orgUnitGroupSets = - organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets(); + idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true ); Collection 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-03 10:20:32 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2015-03-08 14:57:52 +0000 @@ -232,8 +232,8 @@ List columns = new ArrayList<>(); Collection orgUnitGroupSets = - organisationUnitGroupService.getDataDimensionOrganisationUnitGroupSets(); - + idObjectManager.getByDataDimensionNoAcl( OrganisationUnitGroupSet.class, true ); + Collection 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 13:34:06 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2015-03-08 14:57:52 +0000 @@ -68,7 +68,10 @@ @Autowired private Set> nameableObjectStores; - + + @Autowired + private Set> dimensionalObjectStores; + @Autowired private SessionFactory sessionFactory; @@ -79,6 +82,8 @@ private Map, GenericNameableObjectStore> nameableObjectStoreMap; + private Map, GenericDimensionalObjectStore> dimensionalObjectStoreMap; + //-------------------------------------------------------------------------- // IdentifiableObjectManager implementation //-------------------------------------------------------------------------- @@ -902,6 +907,20 @@ return (Collection) store.getAllNoAcl( first, max ); } + @Override + @SuppressWarnings( "unchecked" ) + public List getByDataDimensionNoAcl( Class clazz, boolean dataDimension ) + { + GenericDimensionalObjectStore store = getDimensionalObjectStore( clazz ); + + if ( store == null ) + { + return new ArrayList<>(); + } + + return (List) store.getByDataDimensionNoAcl( dataDimension ); + } + //-------------------------------------------------------------------------- // Supportive methods //-------------------------------------------------------------------------- @@ -946,6 +965,26 @@ return (GenericNameableObjectStore) store; } + @SuppressWarnings( "unchecked" ) + private GenericDimensionalObjectStore getDimensionalObjectStore( Class clazz ) + { + initMaps(); + + GenericDimensionalObjectStore store = dimensionalObjectStoreMap.get( clazz ); + + if ( store == null ) + { + store = dimensionalObjectStoreMap.get( clazz.getSuperclass() ); + + if ( store == null ) + { + log.warn( "No DimensionalObjectStore found for class: " + clazz ); + } + } + + return (GenericDimensionalObjectStore) store; + } + private void initMaps() { if ( identifiableObjectStoreMap != null ) @@ -966,5 +1005,12 @@ { nameableObjectStoreMap.put( store.getClazz(), store ); } + + dimensionalObjectStoreMap = new HashMap<>(); + + for ( GenericDimensionalObjectStore store : dimensionalObjectStores ) + { + dimensionalObjectStoreMap.put( store.getClazz(), store ); + } } } === 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 10:49:07 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2015-03-08 14:57:52 +0000 @@ -217,9 +217,9 @@ } @Override - public Collection getDisaggregationDataDimensionCategories() + public Collection getDisaggregationDataDimensionCategoriesNoAcl() { - return categoryStore.getCategories( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION, true ); + return categoryStore.getCategoriesNoAcl( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION, true ); } @Override @@ -229,9 +229,9 @@ } @Override - public Collection getAttributeDataDimensionCategories() + public Collection getAttributeDataDimensionCategoriesNoAcl() { - return categoryStore.getCategories( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE, true ); + return categoryStore.getCategoriesNoAcl( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE, true ); } @Override === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java 2015-03-08 14:57:52 +0000 @@ -0,0 +1,39 @@ +package org.hisp.dhis.dataelement.hibernate; + +/* + * Copyright (c) 2004-2015, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; +import org.hisp.dhis.dataelement.CategoryOptionGroupSet; +import org.hisp.dhis.dataelement.CategoryOptionGroupSetStore; + +public class HibernateCategoryOptionGroupSetStore + extends HibernateIdentifiableObjectStore + implements CategoryOptionGroupSetStore +{ +} === 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 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryStore.java 2015-03-08 14:57:52 +0000 @@ -29,6 +29,7 @@ */ import java.util.Collection; +import java.util.List; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; @@ -57,4 +58,13 @@ Restrictions.eq( "dataDimensionType", dimensionType ), Restrictions.eq( "dataDimension", dataDimension ) ).list(); } + + @Override + @SuppressWarnings("unchecked") + public List getCategoriesNoAcl( String dimensionType, boolean dataDimension ) + { + return getCriteria( + Restrictions.eq( "dataDimensionType", dimensionType ), + Restrictions.eq( "dataDimension", dataDimension ) ).list(); + } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-03-08 13:34:06 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-03-08 14:57:52 +0000 @@ -196,7 +196,7 @@ - +