=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryComboStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryComboStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryComboStore.java 2013-12-20 12:15:39 +0000 @@ -0,0 +1,42 @@ +package org.hisp.dhis.dataelement; + +/* + * Copyright (c) 2004-2013, 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 java.util.Collection; + +import org.hisp.dhis.common.GenericIdentifiableObjectStore; + +/** + * @author Lars Helge Overland + */ +public interface CategoryComboStore + extends GenericIdentifiableObjectStore +{ + Collection getCategoryCombosByDimensionType( String dimensionType ); +} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-09-16 17:07:25 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-12-20 12:15:39 +0000 @@ -61,6 +61,9 @@ private static final long serialVersionUID = 1549406078091077760L; public static final String DEFAULT_CATEGORY_COMBO_NAME = "default"; + + public static final String DIMENSION_TYPE_DISAGGREGATION = "disaggregation"; + public static final String DIMENSION_TYPE_ATTTRIBUTE = "attribute"; /** * A set with categories. @@ -74,8 +77,10 @@ */ private Set optionCombos = new HashSet(); + private String dimensionType; + private boolean skipTotal; - + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -279,6 +284,19 @@ @JsonProperty @JsonView({ DetailedView.class, ExportView.class }) @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + public String getDimensionType() + { + return dimensionType; + } + + public void setDimensionType( String dimensionType ) + { + this.dimensionType = dimensionType; + } + + @JsonProperty + @JsonView({ DetailedView.class, ExportView.class }) + @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) public boolean isSkipTotal() { return skipTotal; === 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-12-19 23:00:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2013-12-20 12:15:39 +0000 @@ -282,6 +282,20 @@ */ Collection getAllDataElementCategoryCombos(); + /** + * Retrieves all DataElementCategoryCombos of dimension type disaggregation. + * + * @return a collection of DataElementCategoryCombos. + */ + Collection getDisaggregationCategoryCombos(); + + /** + * Retrieves all DataElementCategoryCombos of dimension type attribute. + * + * @return a collection of DataElementCategoryCombos. + */ + Collection getAttributeCategoryCombos(); + // ------------------------------------------------------------------------- // CategoryOptionCombo // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2013-12-20 12:15:39 +0000 @@ -39,7 +39,6 @@ /** * @author Lars Helge Overland - * @version $Id$ */ public class DataElementDeletionHandler extends DeletionHandler === 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-12-19 23:00:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-12-20 12:15:39 +0000 @@ -42,7 +42,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.GenericDimensionalObjectStore; -import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.concept.Concept; import org.hisp.dhis.i18n.I18nService; import org.hisp.dhis.system.util.Filter; @@ -76,9 +75,9 @@ this.categoryOptionStore = categoryOptionStore; } - private GenericIdentifiableObjectStore categoryComboStore; + private CategoryComboStore categoryComboStore; - public void setCategoryComboStore( GenericIdentifiableObjectStore categoryComboStore ) + public void setCategoryComboStore( CategoryComboStore categoryComboStore ) { this.categoryComboStore = categoryComboStore; } @@ -388,6 +387,16 @@ return i18n( i18nService, categoryComboStore.getAllLikeNameOrderedName( name, first, max ) ); } + public Collection getDisaggregationCategoryCombos() + { + return i18n( i18nService, categoryComboStore.getCategoryCombosByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) ); + } + + public Collection getAttributeCategoryCombos() + { + return i18n( i18nService, categoryComboStore.getCategoryCombosByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) ); + } + // ------------------------------------------------------------------------- // CategoryOptionCombo // ------------------------------------------------------------------------- === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryComboStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryComboStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryComboStore.java 2013-12-20 12:15:39 +0000 @@ -0,0 +1,50 @@ +package org.hisp.dhis.dataelement.hibernate; + +/* + * Copyright (c) 2004-2013, 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 java.util.Collection; + +import org.hibernate.criterion.Restrictions; +import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; +import org.hisp.dhis.dataelement.CategoryComboStore; +import org.hisp.dhis.dataelement.DataElementCategoryCombo; + +/** + * @author Lars Helge Overland + */ +public class HibernateCategoryComboStore + extends HibernateIdentifiableObjectStore + implements CategoryComboStore +{ + @SuppressWarnings("unchecked") + public Collection getCategoryCombosByDimensionType( String dimensionType ) + { + return getCriteria( Restrictions.eq( "dimensionType", dimensionType ) ).list(); + } +} === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2013-12-16 12:27:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2013-12-20 12:15:39 +0000 @@ -28,21 +28,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.hisp.dhis.i18n.I18nUtils.getCountByName; +import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween; +import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName; +import static org.hisp.dhis.i18n.I18nUtils.getObjectsByName; +import static org.hisp.dhis.i18n.I18nUtils.i18n; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.i18n.I18nService; -import org.hisp.dhis.mapping.MapLegend; import org.hisp.dhis.mapping.MapLegendSet; import org.hisp.dhis.system.util.Filter; import org.hisp.dhis.system.util.FilterUtils; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import static org.hisp.dhis.i18n.I18nUtils.*; - /** * @author Lars Helge Overland * @version $Id$ === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2013-12-16 12:27:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2013-12-20 12:15:39 +0000 @@ -28,18 +28,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Iterator; +import java.util.Set; + import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.expression.ExpressionService; -import org.hisp.dhis.mapping.MapLegend; import org.hisp.dhis.mapping.MapLegendSet; import org.hisp.dhis.system.deletion.DeletionHandler; -import java.util.Iterator; -import java.util.Set; - /** * @author Lars Helge Overland * @version $Id$ === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-12-19 18:12:57 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-12-20 12:15:39 +0000 @@ -34,6 +34,7 @@ import org.amplecode.quick.StatementManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.jdbc.StatementBuilder; import org.hisp.dhis.jdbc.batchhandler.RelativePeriodsBatchHandler; import org.hisp.dhis.period.RelativePeriods; @@ -652,7 +653,9 @@ executeSql( "ALTER TABLE dataset DROP COLUMN symbol" ); executeSql( "ALTER TABLE users ALTER COLUMN password DROP NOT NULL" ); - + + executeSql( "update categorycombo set dimensiontype = '" + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" ); + upgradeDataValuesWithAttributeOptionCombo(); upgradeMapViewsToAnalyticalObject(); === 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 2013-12-19 23:00:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-12-20 12:15:39 +0000 @@ -150,7 +150,7 @@ - + @@ -455,7 +455,7 @@ - + === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml 2013-02-07 10:25:34 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml 2013-12-20 12:15:39 +0000 @@ -32,7 +32,9 @@ foreign-key="fk_categorycombo_categoryoptioncomboid" unique="true" /> - - + + + + === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2013-12-20 12:15:39 +0000 @@ -68,7 +68,7 @@ @Override public void setUpTest() { - categoryComboStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.dataelement.DataElementCategoryComboStore" ); + categoryComboStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.dataelement.CategoryComboStore" ); categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css 2013-12-13 15:09:46 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css 2013-12-20 12:15:39 +0000 @@ -94,7 +94,7 @@ padding: 6px 6px; margin: 4px 0; border-radius: 3px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.12); } #loginMessage === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2013-12-12 12:42:07 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2013-12-20 12:15:39 +0000 @@ -553,7 +553,7 @@ border-radius: 3px; padding: 6px 5px; margin: 2px 0; - color: #555; + color: #333; } .setting select, === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java 2013-12-20 12:15:39 +0000 @@ -68,13 +68,20 @@ this.name = name; } + private String dimensionType; + + public void setDimensionType( String dimensionType ) + { + this.dimensionType = dimensionType; + } + private boolean skipTotal; public void setSkipTotal( boolean skipTotal ) { this.skipTotal = skipTotal; } - + private Collection selectedList = new HashSet(); public void setSelectedList( Collection selectedList ) @@ -88,9 +95,10 @@ public String execute() { - DataElementCategoryCombo dataElementCategoryCombo = new DataElementCategoryCombo(); - dataElementCategoryCombo.setName( name ); - dataElementCategoryCombo.setSkipTotal( skipTotal ); + DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo(); + categoryCombo.setName( name ); + categoryCombo.setDimensionType( dimensionType ); + categoryCombo.setSkipTotal( skipTotal ); List categories = new ArrayList(); @@ -102,11 +110,11 @@ categories.add( dataElementCategory ); } - dataElementCategoryCombo.setCategories( categories ); - - dataElementCategoryService.addDataElementCategoryCombo( dataElementCategoryCombo ); - - dataElementCategoryService.generateOptionCombos( dataElementCategoryCombo ); + categoryCombo.setCategories( categories ); + + dataElementCategoryService.addDataElementCategoryCombo( categoryCombo ); + + dataElementCategoryService.generateOptionCombos( categoryCombo ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/UpdateDataElementCategoryComboAction.java 2013-12-20 12:15:39 +0000 @@ -75,6 +75,13 @@ this.name = name; } + private String dimensionType; + + public void setDimensionType( String dimensionType ) + { + this.dimensionType = dimensionType; + } + private boolean skipTotal; public void setSkipTotal( boolean skipTotal ) @@ -95,11 +102,12 @@ public String execute() { - DataElementCategoryCombo dataElementCategoryCombo = dataElementCategoryService + DataElementCategoryCombo categoryCombo = dataElementCategoryService .getDataElementCategoryCombo( id ); - dataElementCategoryCombo.setName( name ); - dataElementCategoryCombo.setSkipTotal( skipTotal ); + categoryCombo.setName( name ); + categoryCombo.setDimensionType( dimensionType ); + categoryCombo.setSkipTotal( skipTotal ); List updatedCategories = new ArrayList(); @@ -111,9 +119,9 @@ updatedCategories.add( dataElementCategory ); } - dataElementCategoryCombo.setCategories( updatedCategories ); + categoryCombo.setCategories( updatedCategories ); - dataElementCategoryService.updateDataElementCategoryCombo( dataElementCategoryCombo ); + dataElementCategoryService.updateDataElementCategoryCombo( categoryCombo ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-11-21 09:28:42 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-12-20 12:15:39 +0000 @@ -208,4 +208,7 @@ selected_category_options=Selected category options use_as_data_dimension=Use as data dimension tip=Tip -use=use \ No newline at end of file +use=use +dimension_type=Dimension type +disaggregation=Disaggregation +attribute=Attribute \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm 2013-07-19 08:23:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm 2013-12-20 12:15:39 +0000 @@ -40,6 +40,15 @@ +