dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38964
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19783: Model, changed DataElementCategory and DataElementCategoryCombo dataDimensionType property from S...
------------------------------------------------------------
revno: 19783
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-08-18 18:46:02 -0400
message:
Model, changed DataElementCategory and DataElementCategoryCombo dataDimensionType property from String to enum DataDimensionType
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionType.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DataDimensionTypeUserType.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryComboStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementDomain.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/HibernateCategoryComboStore.java
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/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java
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/resources/org/hisp/dhis/dd/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js
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/addDataElementCategoryForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryForm.vm
--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DataDimensionType.java 2015-08-18 22:46:02 +0000
@@ -0,0 +1,62 @@
+package org.hisp.dhis.common;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum DataDimensionType
+{
+ DISAGGREGATION("disaggregation"), ATTRIBUTE("attribute");
+
+ private final String value;
+
+ DataDimensionType( String value )
+ {
+ this.value = value;
+ }
+
+ public static DataDimensionType fromValue( String value )
+ {
+ for ( DataDimensionType type : DataDimensionType.values() )
+ {
+ if ( type.value.equalsIgnoreCase( value ) )
+ {
+ return type;
+ }
+ }
+
+ return null;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
=== modified 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 2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryComboStore.java 2015-08-18 22:46:02 +0000
@@ -30,6 +30,7 @@
import java.util.List;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
/**
@@ -38,5 +39,5 @@
public interface CategoryComboStore
extends GenericIdentifiableObjectStore<DataElementCategoryCombo>
{
- List<DataElementCategoryCombo> getCategoryCombosByDimensionType( String dimensionType );
+ List<DataElementCategoryCombo> getCategoryCombosByDimensionType( DataDimensionType dataDimensionType );
}
=== 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-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryStore.java 2015-08-18 22:46:02 +0000
@@ -30,6 +30,7 @@
import java.util.List;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.GenericDimensionalObjectStore;
/**
@@ -38,9 +39,9 @@
public interface CategoryStore
extends GenericDimensionalObjectStore<DataElementCategory>
{
- List<DataElementCategory> getCategoriesByDimensionType( String dimensionType );
-
- List<DataElementCategory> getCategories( String dimensionType, boolean dataDimension );
-
- List<DataElementCategory> getCategoriesNoAcl( String dimensionType, boolean dataDimension );
+ List<DataElementCategory> getCategoriesByDimensionType( DataDimensionType dataDimensionType );
+
+ List<DataElementCategory> getCategories( DataDimensionType dataDimensionType, boolean dataDimension );
+
+ List<DataElementCategory> getCategoriesNoAcl( DataDimensionType dataDimensionType, boolean dataDimension );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2015-07-15 16:04:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2015-08-18 22:46:02 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
@@ -69,7 +70,7 @@
public static final String DEFAULT_NAME = "default";
- private String dataDimensionType;
+ private DataDimensionType dataDimensionType;
@Scanned
private List<DataElementCategoryOption> categoryOptions = new ArrayList<>();
@@ -189,12 +190,12 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getDataDimensionType()
+ public DataDimensionType getDataDimensionType()
{
return dataDimensionType;
}
- public void setDataDimensionType( String dataDimensionType )
+ public void setDataDimensionType( DataDimensionType dataDimensionType )
{
this.dataDimensionType = dataDimensionType;
}
=== 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 2015-07-13 12:34:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2015-08-18 22:46:02 +0000
@@ -34,8 +34,10 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.CombinationGenerator;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.MergeStrategy;
@@ -62,10 +64,7 @@
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.
*/
@@ -78,7 +77,7 @@
*/
private Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<>();
- private String dimensionType;
+ private DataDimensionType dataDimensionType;
private boolean skipTotal;
@@ -322,14 +321,14 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getDimensionType()
+ public DataDimensionType getDataDimensionType()
{
- return dimensionType;
+ return dataDimensionType;
}
- public void setDimensionType( String dimensionType )
+ public void setDataDimensionType( DataDimensionType dataDimensionType )
{
- this.dimensionType = dimensionType;
+ this.dataDimensionType = dataDimensionType;
}
@JsonProperty
@@ -352,11 +351,22 @@
if ( other.getClass().isInstance( this ) )
{
- DataElementCategoryCombo dataElementCategoryCombo = (DataElementCategoryCombo) other;
+ DataElementCategoryCombo categoryCombo = (DataElementCategoryCombo) other;
+
+ skipTotal = categoryCombo.isSkipTotal();
+
+ if ( strategy.isReplace() )
+ {
+ dataDimensionType = categoryCombo.getDataDimensionType();
+ }
+ else if ( strategy.isMerge() )
+ {
+ dataDimensionType = categoryCombo.getDataDimensionType() == null ? dataDimensionType : categoryCombo.getDataDimensionType();
+ }
removeAllDataElementCategories();
- for ( DataElementCategory dataElementCategory : dataElementCategoryCombo.getCategories() )
+ for ( DataElementCategory dataElementCategory : categoryCombo.getCategories() )
{
addDataElementCategory( dataElementCategory );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementDomain.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementDomain.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementDomain.java 2015-08-18 22:46:02 +0000
@@ -39,7 +39,7 @@
private final String value;
- private DataElementDomain( String value )
+ DataElementDomain( String value )
{
this.value = value;
}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DataDimensionTypeUserType.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DataDimensionTypeUserType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DataDimensionTypeUserType.java 2015-08-18 22:46:02 +0000
@@ -0,0 +1,43 @@
+package org.hisp.dhis.common;
+
+/*
+ * 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.hibernate.EnumUserType;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class DataDimensionTypeUserType
+ extends EnumUserType<DataDimensionType>
+{
+ public DataDimensionTypeUserType()
+ {
+ super( DataDimensionType.class );
+ }
+}
=== 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-06-24 10:36:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2015-08-18 22:46:02 +0000
@@ -41,6 +41,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.GenericDimensionalObjectStore;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IdentifiableObjectUtils;
@@ -228,25 +229,25 @@
@Override
public List<DataElementCategory> getDisaggregationCategories()
{
- return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );
+ return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataDimensionType.DISAGGREGATION ) );
}
@Override
public List<DataElementCategory> getDisaggregationDataDimensionCategoriesNoAcl()
{
- return i18n( i18nService, categoryStore.getCategoriesNoAcl( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION, true ) );
+ return i18n( i18nService, categoryStore.getCategoriesNoAcl( DataDimensionType.DISAGGREGATION, true ) );
}
@Override
public List<DataElementCategory> getAttributeCategories()
{
- return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) );
+ return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataDimensionType.ATTRIBUTE ) );
}
@Override
public List<DataElementCategory> getAttributeDataDimensionCategoriesNoAcl()
{
- return i18n( i18nService, categoryStore.getCategoriesNoAcl( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE, true ) );
+ return i18n( i18nService, categoryStore.getCategoriesNoAcl( DataDimensionType.ATTRIBUTE, true ) );
}
@Override
@@ -483,8 +484,7 @@
}
@Override
- public List<DataElementCategoryCombo> getDataElementCategoryCombosBetweenByName( String name, int first,
- int max )
+ public List<DataElementCategoryCombo> getDataElementCategoryCombosBetweenByName( String name, int first, int max )
{
return i18n( i18nService, categoryComboStore.getAllLikeName( name, first, max ) );
}
@@ -492,16 +492,13 @@
@Override
public List<DataElementCategoryCombo> getDisaggregationCategoryCombos()
{
- return i18n( i18nService,
- categoryComboStore
- .getCategoryCombosByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );
+ return i18n( i18nService, categoryComboStore.getCategoryCombosByDimensionType( DataDimensionType.DISAGGREGATION ) );
}
@Override
public List<DataElementCategoryCombo> getAttributeCategoryCombos()
{
- return i18n( i18nService,
- categoryComboStore.getCategoryCombosByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_ATTTRIBUTE ) );
+ return i18n( i18nService, categoryComboStore.getCategoryCombosByDimensionType( DataDimensionType.ATTRIBUTE ) );
}
@Override
=== modified 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 2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryComboStore.java 2015-08-18 22:46:02 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.dataelement.CategoryComboStore;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -44,8 +45,8 @@
{
@Override
@SuppressWarnings("unchecked")
- public List<DataElementCategoryCombo> getCategoryCombosByDimensionType( String dimensionType )
+ public List<DataElementCategoryCombo> getCategoryCombosByDimensionType( DataDimensionType dataDimensionType )
{
- return getSharingCriteria( Restrictions.or( Restrictions.eq( "dimensionType", dimensionType ), Restrictions.eq( "name", "default" ) ) ).list();
+ return getSharingCriteria( Restrictions.or( Restrictions.eq( "dataDimensionType", dataDimensionType ), Restrictions.eq( "name", "default" ) ) ).list();
}
}
=== 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-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryStore.java 2015-08-18 22:46:02 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.dataelement.CategoryStore;
import org.hisp.dhis.dataelement.DataElementCategory;
@@ -44,26 +45,26 @@
{
@Override
@SuppressWarnings("unchecked")
- public List<DataElementCategory> getCategoriesByDimensionType( String dimensionType )
+ public List<DataElementCategory> getCategoriesByDimensionType( DataDimensionType dataDimensionType )
{
- return getSharingCriteria( Restrictions.eq( "dataDimensionType", dimensionType ) ).list();
+ return getSharingCriteria( Restrictions.eq( "dataDimensionType", dataDimensionType ) ).list();
}
@Override
@SuppressWarnings("unchecked")
- public List<DataElementCategory> getCategories( String dimensionType, boolean dataDimension )
+ public List<DataElementCategory> getCategories( DataDimensionType dataDimensionType, boolean dataDimension )
{
return getSharingCriteria(
- Restrictions.eq( "dataDimensionType", dimensionType ),
+ Restrictions.eq( "dataDimensionType", dataDimensionType ),
Restrictions.eq( "dataDimension", dataDimension ) ).list();
}
@Override
@SuppressWarnings("unchecked")
- public List<DataElementCategory> getCategoriesNoAcl( String dimensionType, boolean dataDimension )
+ public List<DataElementCategory> getCategoriesNoAcl( DataDimensionType dataDimensionType, boolean dataDimension )
{
return getCriteria(
- Restrictions.eq( "dataDimensionType", dimensionType ),
+ Restrictions.eq( "dataDimensionType", dataDimensionType ),
Restrictions.eq( "dataDimension", dataDimension ) ).list();
}
}
=== 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 2015-08-04 13:40:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-08-18 22:46:02 +0000
@@ -28,13 +28,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.amplecode.quick.BatchHandler;
import org.amplecode.quick.BatchHandlerFactory;
import org.amplecode.quick.StatementHolder;
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.organisationunit.OrganisationUnitService;
@@ -43,13 +49,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author Lars Helge Overland
*/
@@ -742,10 +741,6 @@
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" );
- executeSql( "update dataelementcategory set dimensiontype = '"
- + DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION + "' where dimensiontype is null" );
executeSql( "update dataset set categorycomboid = " + defaultCategoryComboId + " where categorycomboid is null" );
// set default dataDimension on orgUnitGroupSet and deGroupSet
@@ -831,6 +826,15 @@
executeSql( "UPDATE report set cachestrategy='RESPECT_SYSTEM_SETTING' where cachestrategy is null" );
executeSql( "UPDATE sqlview set cachestrategy='RESPECT_SYSTEM_SETTING' where cachestrategy is null" );
+ executeSql( "update categorycombo set datadimensiontype = 'DISAGGREGATION' where dimensiontype = 'disaggregation'" );
+ executeSql( "update categorycombo set datadimensiontype = 'ATTRIBUTE' where dimensiontype = 'attribute'" );
+ executeSql( "update categorycombo set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
+ executeSql( "alter table categorycombo drop column dimensiontype" );
+ executeSql( "update dataelementcategory set datadimensiontype = 'DISAGGREGATION' where dimensiontype = 'disaggregation'" );
+ executeSql( "update dataelementcategory set datadimensiontype = 'ATTRIBUTE' where dimensiontype = 'attribute'" );
+ executeSql( "update dataelementcategory set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
+ executeSql( "alter table dataelementcategory drop column dimensiontype" );
+
oauth2();
upgradeDataValuesWithAttributeOptionCombo();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml 2014-03-26 18:56:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml 2015-08-18 22:46:02 +0000
@@ -17,7 +17,7 @@
<property name="name" column="name" not-null="true" unique="true" length="230" />
- <property name="dataDimensionType" column="dimensiontype" />
+ <property name="dataDimensionType" column="datadimensiontype" type="org.hisp.dhis.common.DataDimensionTypeUserType" />
<!-- Access properties -->
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_dataelementcategory_userid" />
=== 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 2014-02-14 12:15:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml 2015-08-18 22:46:02 +0000
@@ -32,8 +32,8 @@
foreign-key="fk_categorycombo_categoryoptioncomboid" unique="true" />
</set>
- <property name="dimensionType" column="dimensiontype" />
-
+ <property name="dataDimensionType" column="datadimensiontype" type="org.hisp.dhis.common.DataDimensionTypeUserType" />
+
<property name="skipTotal" column="skiptotal" />
<!-- Access properties -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/AddDataElementCategoryAction.java 2015-08-18 22:46:02 +0000
@@ -32,6 +32,7 @@
import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -39,7 +40,6 @@
/**
* @author Selamawit
- * @version $Id$
*/
public class AddDataElementCategoryAction
implements Action
@@ -80,11 +80,11 @@
this.dataDimension = dataDimension;
}
- private String dimensionType;
+ private String dataDimensionType;
- public void setDimensionType( String dimensionType )
+ public void setDataDimensionType( String dataDimensionType )
{
- this.dimensionType = dimensionType;
+ this.dataDimensionType = dataDimensionType;
}
private List<String> coSelected = new ArrayList<>();
@@ -105,7 +105,7 @@
dataElementCategory.setName( StringUtils.trimToNull( name ) );
dataElementCategory.setCode( StringUtils.trimToNull( code ) );
dataElementCategory.setDataDimension( dataDimension );
- dataElementCategory.setDataDimensionType( dimensionType );
+ dataElementCategory.setDataDimensionType( DataDimensionType.valueOf( dataDimensionType ) );
for ( String id : coSelected )
{
=== 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 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/AddDataElementCategoryComboAction.java 2015-08-18 22:46:02 +0000
@@ -31,6 +31,7 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -73,11 +74,11 @@
this.code = code;
}
- private String dimensionType;
+ private String dataDimensionType;
- public void setDimensionType( String dimensionType )
+ public void setDataDimensionType( String dataDimensionType )
{
- this.dimensionType = dimensionType;
+ this.dataDimensionType = dataDimensionType;
}
private boolean skipTotal;
@@ -104,7 +105,7 @@
DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo();
categoryCombo.setName( StringUtils.trimToNull( name ) );
categoryCombo.setCode( StringUtils.trimToNull( code ) );
- categoryCombo.setDimensionType( dimensionType );
+ categoryCombo.setDataDimensionType( DataDimensionType.valueOf( dataDimensionType ) );
categoryCombo.setSkipTotal( skipTotal );
List<DataElementCategory> categories = new ArrayList<>();
=== 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 2015-06-02 11:47:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2015-08-18 22:46:02 +0000
@@ -233,4 +233,5 @@
approve_data=Approve data
decimals_in_data_output=Decimals in data output
categories = Categories
-ignore_data_approval=Ignore data approval
\ No newline at end of file
+ignore_data_approval=Ignore data approval
+data_dimension_type=Data dimension type
\ 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/javascript/categoryOptionCombo.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js 2014-09-25 07:30:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js 2015-08-18 22:46:02 +0000
@@ -48,6 +48,6 @@
});
},
getType: function () {
- return $('#dimensionType').val().toLowerCase();
+ return $('#dataDimensionType').val().toUpperCase();
}
};
=== 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 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm 2015-08-18 22:46:02 +0000
@@ -3,7 +3,7 @@
jQuery(document).ready( function(){
dhis2.coc.clearAndSetAjaxSelect(dhis2.coc.getType(), false);
- $('#dimensionType').on('change', function( e ) {
+ $('#dataDimensionType').on('change', function( e ) {
dhis2.coc.clearAndSetAjaxSelect(dhis2.coc.getType(), true);
});
@@ -42,11 +42,11 @@
<td><input type="text" id="code" name="code" ></td>
</tr>
<tr>
- <td><label>$i18n.getString( "dimension_type" )</td>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
<td>
- <select id="dimensionType" name="dimensionType">
- <option value="disaggregation" selected="selected">$i18n.getString( "disaggregation" )</option>
- <option value="attribute">$i18n.getString( "attribute" )</option>
+ <select id="dataDimensionType" name="dataDimensionType">
+ <option value="DISAGGREGATION" selected="selected">$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE">$i18n.getString( "attribute" )</option>
</select>
</td>
</tr>
@@ -67,9 +67,9 @@
"i18n_selected": "selected_categories"
})
- <p>
- <input type="submit" name="add" value="$i18n.getString( 'add' )" style="width:10em" />
- <input type="button" name="cancel" onclick="dhis2.commons.redirectCurrentPage( 'categoryCombo.action' )" value="$i18n.getString( 'cancel' )" style="width:10em" />
- </p>
+ <p>
+ <input type="submit" name="add" value="$i18n.getString( 'add' )" style="width:10em" />
+ <input type="button" name="cancel" onclick="dhis2.commons.redirectCurrentPage( 'categoryCombo.action' )" value="$i18n.getString( 'cancel' )" style="width:10em" />
+ </p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryForm.vm 2015-08-18 22:46:02 +0000
@@ -43,11 +43,11 @@
<td><input type="checkbox" id="dataDimension" name="dataDimension" value="true" /></td>
</tr>
<tr>
- <td><label>$i18n.getString( "dimension_type" )</td>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
<td>
- <select id="dimensionType" name="dimensionType">
- <option value="disaggregation" selected="selected">$i18n.getString( "disaggregation" )</option>
- <option value="attribute">$i18n.getString( "attribute" )</option>
+ <select id="dataDimensionType" name="dataDimensionType">
+ <option value="DISAGGREGATION" selected="selected">$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE">$i18n.getString( "attribute" )</option>
</select>
</td>
</tr>
@@ -56,11 +56,11 @@
</tr>
</table>
-#jqSelected({
- "prefix": "co",
- "i18n_available": "available_category_options",
- "i18n_selected": "selected_category_options"
- })
+ #jqSelected({
+ "prefix": "co",
+ "i18n_available": "available_category_options",
+ "i18n_selected": "selected_category_options"
+ })
<p>
<input type="submit" value="$i18n.getString( 'add' )" style="width:100px">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm 2015-08-18 22:46:02 +0000
@@ -3,7 +3,7 @@
jQuery(document).ready( function(){
dhis2.coc.clearAndSetAjaxSelect(dhis2.coc.getType(), false);
- $('#dimensionType').on('change', function( e ) {
+ $('#dataDimensionType').on('change', function( e ) {
dhis2.coc.clearAndSetAjaxSelect(dhis2.coc.getType(), true);
});
@@ -42,11 +42,11 @@
<td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $dataElementCategoryCombo.code )"></td>
</tr>
<tr>
- <td><label>$i18n.getString( "dimension_type" )</td>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
<td>
- <select id="dimensionType" name="dimensionType" disabled="disabled">
- <option value="disaggregation"#if( "disaggregation" == $dataElementCategoryCombo.dimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
- <option value="attribute"#if( "attribute" == $dataElementCategoryCombo.dimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
+ <select id="dataDimensionType" name="dataDimensionType" disabled="disabled">
+ <option value="DISAGGREGATION"#if( "DISAGGREGATION" == $dataElementCategoryCombo.dataDimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE"#if( "ATTRIBUTE" == $dataElementCategoryCombo.dataDimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
</select>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryForm.vm 2015-02-06 13:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryForm.vm 2015-08-18 22:46:02 +0000
@@ -48,11 +48,11 @@
<td><input type="checkbox" id="dataDimension" name="dataDimension" value="true"#if( $dataElementCategory.dataDimension ) checked="checked"#end/></td>
</tr>
<tr>
- <td><label>$i18n.getString( "dimension_type" )</td>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
<td>
- <select id="dimensionType" name="dimensionType" disabled="disabled">
- <option value="disaggregation"#if( "disaggregation" == $dataElementCategory.dimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
- <option value="attribute"#if( "attribute" == $dataElementCategory.dimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
+ <select id="dataDmensionType" name="dataDimensionType" disabled="disabled">
+ <option value="DISAGGREGATION"#if( "DISAGGREGATION" == $dataElementCategory.dataDimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE"#if( "ATTRIBUTE" == $dataElementCategory.dataDimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
</select>
</td>
</tr>