dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39344
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19923: adds persisted valuetype (vtype), old types are still present for now, does not expose type/textt...
------------------------------------------------------------
revno: 19923
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-02 12:15:31 +0700
message:
adds persisted valuetype (vtype), old types are still present for now, does not expose type/texttype/numbertype in the web-api anymore (only valueType)
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.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/DataElement.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java 2015-08-31 07:23:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java 2015-09-02 05:15:31 +0000
@@ -28,11 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.google.common.collect.Lists;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import java.util.Date;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -59,6 +61,19 @@
OPTION_SET( String.class ),
USERNAME( String.class );
+ public static List<String> INTEGER_TYPE_STRINGS = Lists.newArrayList(
+ INTEGER.toString(), INTEGER_POSITIVE.toString(), INTEGER_NEGATIVE.toString(), INTEGER_ZERO_OR_POSITIVE.toString()
+ );
+
+ public static List<String> NUMERIC_TYPE_STRINGS = Lists.newArrayList(
+ INTEGER.toString(), INTEGER_POSITIVE.toString(), INTEGER_NEGATIVE.toString(), INTEGER_ZERO_OR_POSITIVE.toString(),
+ NUMBER.toString(), UNIT_INTERVAL.toString(), PERCENTAGE.toString()
+ );
+
+ public static List<String> TEXT_TYPE_STRINGS = Lists.newArrayList(
+ TEXT.toString(), LONG_TEXT.toString()
+ );
+
private final Class<?> javaClass;
ValueType()
@@ -83,7 +98,7 @@
public boolean isNumeric()
{
- return this.isInteger() || this == NUMBER;
+ return this.isInteger() || this == NUMBER || this == UNIT_INTERVAL || this == PERCENTAGE;
}
public boolean isText()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2015-09-01 06:25:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2015-09-02 05:15:31 +0000
@@ -616,7 +616,7 @@
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public ValueType getValueType()
{
- return ValueType.getFromDataElement( this );
+ return valueType != null ? valueType : ValueType.getFromDataElement( this );
}
public void setValueType( ValueType valueType )
@@ -624,6 +624,36 @@
this.valueType = valueType;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ public String getNumberType()
+ {
+ return numberType;
+ }
+
+ public void setNumberType( String numberType )
+ {
+ this.numberType = numberType;
+ }
+
+ public String getTextType()
+ {
+ return textType;
+ }
+
+ public void setTextType( String textType )
+ {
+ this.textType = textType;
+ }
+
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@@ -654,32 +684,6 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getTextType()
- {
- return textType;
- }
-
- public void setTextType( String textType )
- {
- this.textType = textType;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getType()
- {
- return type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getAggregationOperator()
{
return aggregationOperator;
@@ -774,19 +778,6 @@
this.zeroIsSignificant = zeroIsSignificant;
}
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getNumberType()
- {
- return numberType;
- }
-
- public void setNumberType( String numberType )
- {
- this.numberType = numberType;
- }
-
@JsonProperty( "attributeValues" )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "attributeValues", namespace = DxfNamespaces.DXF_2_0 )
=== 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-09-01 09:22:27 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java 2015-09-02 05:15:31 +0000
@@ -162,7 +162,7 @@
tables.add( new AnalyticsTable( baseName, getDimensionColumns( null ), period ) );
}
-
+
return tables;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2015-07-03 01:33:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2015-09-02 05:15:31 +0000
@@ -82,7 +82,7 @@
types.add( DataElement.VALUE_TYPE_INT );
types.add( DataElement.VALUE_TYPE_BOOL );
-
+
return getCriteria( Restrictions.in( "type", types ) ).list();
}
@@ -145,7 +145,7 @@
Query query = getQuery( hql );
query.executeUpdate();
-
+
//TODO improve
if ( !dataElementIds.isEmpty() )
@@ -262,7 +262,7 @@
Query query = getQuery( hql );
query.setInteger( "dataSetId", dataSet.getId() );
-
+
if ( max != null )
{
query.setMaxResults( max );
=== 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-09-01 14:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-09-02 05:15:31 +0000
@@ -28,19 +28,13 @@
* 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.DataElementService;
import org.hisp.dhis.jdbc.StatementBuilder;
import org.hisp.dhis.jdbc.batchhandler.RelativePeriodsBatchHandler;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -49,6 +43,13 @@
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
*/
@@ -73,6 +74,9 @@
@Autowired
private OrganisationUnitService organisationUnitService;
+ @Autowired
+ private DataElementService dataElementService;
+
// -------------------------------------------------------------------------
// Execute
// -------------------------------------------------------------------------
@@ -724,7 +728,7 @@
executeSql( "UPDATE optionset SET version=0 WHERE version IS NULL" );
executeSql( "UPDATE dataset SET version=0 WHERE version IS NULL" );
- executeSql( "UPDATE program SET version=0 WHERE version IS NULL" );
+ executeSql( "UPDATE program SET version=0 WHERE version IS NULL" );
executeSql( "update program set categorycomboid = " + defaultCategoryComboId + " where categorycomboid is null" );
executeSql( "ALTER TABLE datavalue ALTER COLUMN lastupdated TYPE timestamp" );
@@ -839,7 +843,7 @@
executeSql( "alter table dataelementcategory drop column dimensiontype" );
executeSql( "update categoryoptiongroupset set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
executeSql( "update categoryoptiongroup set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
-
+
oauth2();
upgradeDataValuesWithAttributeOptionCombo();
@@ -853,11 +857,32 @@
upgradeAggregationType( "chart" );
updateRelativePeriods();
+ updateValueTypes();
organisationUnitService.updatePaths();
log.info( "Tables updated" );
}
+ private void updateValueTypes()
+ {
+ executeSql( "update dataelement set vtype='NUMBER' where valuetype='int' and numbertype='number' and vtype is null" );
+ executeSql( "update dataelement set vtype='INTEGER' where valuetype='int' and numbertype='int' and vtype is null" );
+ executeSql( "update dataelement set vtype='INTEGER_POSITIVE' where valuetype='int' and numbertype='posInt' and vtype is null" );
+ executeSql( "update dataelement set vtype='INTEGER_NEGATIVE' where valuetype='int' and numbertype='negInt' and vtype is null" );
+ executeSql( "update dataelement set vtype='INTEGER_ZERO_OR_POSITIVE' where valuetype='int' and numbertype='zeroPositiveInt' and vtype is null" );
+ executeSql( "update dataelement set vtype='PERCENTAGE' where valuetype='int' and numbertype='percentage' and vtype is null" );
+ executeSql( "update dataelement set vtype='UNIT_INTERVAL' where valuetype='int' and numbertype='unitInterval' and vtype is null" );
+
+ executeSql( "update dataelement set vtype='TEXT' where valuetype='string' and texttype='text' and vtype is null" );
+ executeSql( "update dataelement set vtype='LONG_TEXT' where valuetype='string' and texttype='longText' and vtype is null" );
+
+ executeSql( "update dataelement set vtype='DATE' where valuetype='date' and vtype is null" );
+ executeSql( "update dataelement set vtype='DATETIME' where valuetype='datetime' and vtype is null" );
+ executeSql( "update dataelement set vtype='BOOLEAN' where valuetype='bool' and vtype is null" );
+ executeSql( "update dataelement set vtype='TRUE_ONLY' where valuetype='trueOnly' and vtype is null" );
+ executeSql( "update dataelement set vtype='USERNAME' where valuetype='username' and vtype is null" );
+ }
+
public void oauth2()
{
// OAuth2
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2015-08-19 03:02:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2015-09-02 05:15:31 +0000
@@ -28,13 +28,20 @@
<property name="textType" column="textType" length="16" />
+ <property name="valueType" column="vtype" length="36" access="property" not-null="false">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.common.ValueType</param>
+ <param name="useNamed">true</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
<property name="domainType" column="domainType" type="org.hisp.dhis.dataelement.DataElementDomainUserType" not-null="true" />
<property name="aggregationOperator" not-null="true" column="aggregationtype" length="16" />
<many-to-one name="categoryCombo" class="org.hisp.dhis.dataelement.DataElementCategoryCombo"
- column="categorycomboid"
- foreign-key="fk_dataelement_categorycomboid" />
+ column="categorycomboid" foreign-key="fk_dataelement_categorycomboid" />
<property name="url" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-08-02 12:27:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-09-02 05:15:31 +0000
@@ -17,17 +17,17 @@
<property name="shortName" column="shortname" not-null="false" unique="true" length="50" />
- <property name="description" type="text"/>
+ <property name="description" type="text" />
<property name="valueType" column="valuetype" not-null="true" />
-
+
<property name="aggregationType" length="40">
- <type name="org.hibernate.type.EnumType">
- <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
- <param name="type">12</param>
- </type>
- </property>
-
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
<many-to-one name="attributeGroup" class="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup"
column="trackedentityattributegroupid" foreign-key="fk_trackedentityattribute_attributegroupid" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java 2015-08-25 08:45:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java 2015-09-02 05:15:31 +0000
@@ -69,11 +69,11 @@
assertNotNull( dataElementA.getUid() );
assertNotNull( dataElementB.getUid() );
assertNotNull( dataElementC.getUid() );
-
+
assertNotNull( dataElementA.getLastUpdated() );
assertNotNull( dataElementB.getLastUpdated() );
assertNotNull( dataElementC.getLastUpdated() );
-
+
dataElementA = dataElementService.getDataElement( idA );
assertNotNull( dataElementA );
assertEquals( idA, dataElementA.getId() );
@@ -94,11 +94,11 @@
public void testUpdateDataElement()
{
DataElement dataElementA = createDataElement( 'A' );
-
+
int idA = dataElementService.addDataElement( dataElementA );
assertNotNull( dataElementA.getUid() );
assertNotNull( dataElementA.getLastUpdated() );
-
+
dataElementA = dataElementService.getDataElement( idA );
assertEquals( DataElement.VALUE_TYPE_INT, dataElementA.getType() );
@@ -128,21 +128,21 @@
assertNotNull( dataElementService.getDataElement( idD ) );
dataElementService.deleteDataElement( dataElementB );
-
+
assertNotNull( dataElementService.getDataElement( idA ) );
assertNull( dataElementService.getDataElement( idB ) );
assertNotNull( dataElementService.getDataElement( idC ) );
assertNotNull( dataElementService.getDataElement( idD ) );
dataElementService.deleteDataElement( dataElementC );
-
+
assertNotNull( dataElementService.getDataElement( idA ) );
assertNull( dataElementService.getDataElement( idB ) );
assertNull( dataElementService.getDataElement( idC ) );
assertNotNull( dataElementService.getDataElement( idD ) );
dataElementService.deleteDataElement( dataElementD );
-
+
assertNotNull( dataElementService.getDataElement( idA ) );
assertNull( dataElementService.getDataElement( idB ) );
assertNull( dataElementService.getDataElement( idC ) );
@@ -173,7 +173,7 @@
assertNotNull( dataElementB );
assertEquals( idB, dataElementB.getId() );
assertEquals( "DataElementB", dataElementB.getName() );
-
+
DataElement dataElementE = dataElementService.getDataElementByCode( "codeE" );
assertNull( dataElementE );
}
@@ -258,7 +258,7 @@
DataElement dataElementB = createDataElement( 'B' );
DataElement dataElementC = createDataElement( 'C' );
DataElement dataElementD = createDataElement( 'D' );
-
+
dataElementA.setType( DataElement.VALUE_TYPE_INT );
dataElementB.setType( DataElement.VALUE_TYPE_BOOL );
dataElementC.setType( DataElement.VALUE_TYPE_STRING );
@@ -307,7 +307,7 @@
assertEquals( 3, dataElementService.getDataElementsByAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM )
.size() );
}
-
+
@Test
public void testGetDataElementsByDomainType()
{
@@ -489,12 +489,12 @@
DataElementGroup dataElementGroupC = dataElementService.getDataElementGroupByName( "DataElementGroupC" );
assertNull( dataElementGroupC );
}
-
+
@Test
public void testGetDataElementsByZeroIsSignificantAndGroup()
{
DataElementGroup dataElementGroupA = new DataElementGroup( "DataElementGroupA" );
-
+
DataElement dataElementA = createDataElement( 'A' );
dataElementA.setZeroIsSignificant( true );
DataElement dataElementB = createDataElement( 'B' );
@@ -503,7 +503,7 @@
dataElementC.setZeroIsSignificant( true );
DataElement dataElementD = createDataElement( 'D' );
dataElementD.setZeroIsSignificant( false );
-
+
dataElementGroupA.addDataElement( dataElementA );
dataElementGroupA.addDataElement( dataElementB );
dataElementGroupA.addDataElement( dataElementC );
@@ -515,11 +515,11 @@
dataElementService.addDataElement( dataElementD );
dataElementService.addDataElementGroup( dataElementGroupA );
-
+
Set<DataElement> expected = new HashSet<>();
expected.add( dataElementA );
expected.add( dataElementC );
-
+
assertEquals( expected, dataElementService.getDataElementsByZeroIsSignificantAndGroup( true, dataElementGroupA ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-09-02 05:15:31 +0000
@@ -31,6 +31,7 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.ValueType;
import org.hisp.dhis.commons.collection.ListUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -245,6 +246,7 @@
dataElement.setNumberType( numberType );
}
+ dataElement.setValueType( ValueType.getFromDataElement( dataElement ) );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
@@ -256,8 +258,7 @@
if ( jsonAttributeValues != null )
{
- AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,
- attributeService );
+ AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues, attributeService );
}
dataElementService.addDataElement( dataElement );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-09-02 05:15:31 +0000
@@ -31,6 +31,7 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.ValueType;
import org.hisp.dhis.commons.collection.ListUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -267,12 +268,12 @@
dataElement.setTextType( null );
}
+ dataElement.setValueType( ValueType.getFromDataElement( dataElement ) );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
dataElement.setCategoryCombo( categoryCombo );
- dataElement.setAggregationLevels( new ArrayList<>( ListUtils
- .getIntegerCollection( aggregationLevels ) ) );
+ dataElement.setAggregationLevels( new ArrayList<>( ListUtils.getIntegerCollection( aggregationLevels ) ) );
dataElement.setOptionSet( optionSet );
dataElement.setCommentOptionSet( commentOptionSet );
dataElement.setLegendSet( legendSet );
@@ -291,8 +292,7 @@
.parseInt( dataElementGroupSets.get( i ) ) );
DataElementGroup oldGroup = groupSet.getGroup( dataElement );
- DataElementGroup newGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroups
- .get( i ) ) );
+ DataElementGroup newGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroups.get( i ) ) );
if ( oldGroup != null && oldGroup.getMembers().remove( dataElement ) )
{
@@ -309,8 +309,7 @@
if ( jsonAttributeValues != null )
{
- AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,
- attributeService );
+ AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues, attributeService );
}
dataElementService.updateDataElement( dataElement );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2015-08-02 13:30:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2015-09-02 05:15:31 +0000
@@ -87,29 +87,29 @@
<tr>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select id="valueType" name="valueType" onchange="changeValueType( this.value )">
- <option value="int" #if( $!dataElement.type == 'int' ) selected="selected" #end >$i18n.getString( "number" )</option>
- <option value="string" #if( $!dataElement.type == 'string' ) selected="selected" #end >$i18n.getString( "text" )</option>
- <option value="bool" #if( $!dataElement.type == 'bool' ) selected="selected" #end >$i18n.getString( "yes_no" )</option>
- <option value="trueOnly" #if( $!dataElement.type == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>
- <option value="date" #if( $!dataElement.type == 'date' ) selected="selected" #end >$i18n.getString( "date" )</option>
- <option value="username" #if( $!dataElement.type == 'username' ) selected="selected" #end >$i18n.getString( "user_name" )</option>
- </select>
+ <select id="valueType" name="valueType" onchange="changeValueType( this.value )">
+ <option value="int" #if( $!dataElement.type == 'int' ) selected="selected" #end >$i18n.getString( "number" )</option>
+ <option value="string" #if( $!dataElement.type == 'string' ) selected="selected" #end >$i18n.getString( "text" )</option>
+ <option value="bool" #if( $!dataElement.type == 'bool' ) selected="selected" #end >$i18n.getString( "yes_no" )</option>
+ <option value="trueOnly" #if( $!dataElement.type == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>
+ <option value="date" #if( $!dataElement.type == 'date' ) selected="selected" #end >$i18n.getString( "date" )</option>
+ <option value="username" #if( $!dataElement.type == 'username' ) selected="selected" #end >$i18n.getString( "user_name" )</option>
+ </select>
</td>
</tr>
<tr id='numberTypeTR' #if( $!dataElement.id > 0 && $!dataElement.type != 'int' ) style="display:none" #end>
<td><label for="numberValueType">$i18n.getString( "number_value_type" )</label></td>
<td>
- <select id="numberType" name="numberType">
- <option value="number" #if( $!dataElement.numberType == 'number' ) selected="selected" #end style="min-width:246px;">$i18n.getString( "number" )</option>
- <option value="int" #if( $!dataElement.numberType == 'int' ) selected="selected" #end>$i18n.getString( "int" )</option>
- <option value="posInt" #if( $!dataElement.numberType == 'posInt' ) selected="selected" #end>$i18n.getString( "positive_integer" )</option>
- <option value="negInt" #if( $!dataElement.numberType == 'negInt' ) selected="selected" #end>$i18n.getString( "negative_integer" )</option>
- <option value="zeroPositiveInt" #if( $!dataElement.numberType == 'zeroPositiveInt' ) selected="selected" #end>$i18n.getString( "zero_positive_int" )</option>
- <option value="unitInterval" #if( $!dataElement.numberType == 'unitInterval' ) selected="selected" #end>$i18n.getString( "unit_interval" )</option>
- <option value="percentage" #if( $!dataElement.numberType == 'percentage' ) selected="selected" #end>$i18n.getString( "percentage" )</option>
- </select>
- <script>
+ <select id="numberType" name="numberType">
+ <option value="number" #if( $!dataElement.numberType == 'number' ) selected="selected" #end style="min-width:246px;">$i18n.getString( "number" )</option>
+ <option value="int" #if( $!dataElement.numberType == 'int' ) selected="selected" #end>$i18n.getString( "int" )</option>
+ <option value="posInt" #if( $!dataElement.numberType == 'posInt' ) selected="selected" #end>$i18n.getString( "positive_integer" )</option>
+ <option value="negInt" #if( $!dataElement.numberType == 'negInt' ) selected="selected" #end>$i18n.getString( "negative_integer" )</option>
+ <option value="zeroPositiveInt" #if( $!dataElement.numberType == 'zeroPositiveInt' ) selected="selected" #end>$i18n.getString( "zero_positive_int" )</option>
+ <option value="unitInterval" #if( $!dataElement.numberType == 'unitInterval' ) selected="selected" #end>$i18n.getString( "unit_interval" )</option>
+ <option value="percentage" #if( $!dataElement.numberType == 'percentage' ) selected="selected" #end>$i18n.getString( "percentage" )</option>
+ </select>
+ <script>
</script>
</td>
</tr>
@@ -126,14 +126,14 @@
<td><label for="aggregationOperatorSelect" id="lblOperator">$i18n.getString( "aggregation_operator" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
<select id="aggregationOperatorSelect" name="aggregationOperator">
- <option value="sum" #if( $!dataElement.aggregationOperator == 'sum' ) selected="selected" #end>$i18n.getString( "sum" )</option>
- <option value="avg_sum_org_unit" #if( $!dataElement.aggregationOperator == 'avg_sum_org_unit' ) selected="selected" #end>$i18n.getString( "average_sum_in_org_unit_hierarchy" )</option>
- <option value="avg" #if( $!dataElement.aggregationOperator == 'avg' ) selected="selected" #end>$i18n.getString( "average" )</option>
- <option value="count" #if( $!dataElement.aggregationOperator == 'count' ) selected="selected" #end>$i18n.getString( "count" )</option>
- <option value="stddev" #if( $!dataElement.aggregationOperator == 'stddev' ) selected="selected" #end>$i18n.getString( "stddev" )</option>
- <option value="variance" #if( $!dataElement.aggregationOperator == 'variance' ) selected="selected" #end>$i18n.getString( "variance" )</option>
- <option value="min" #if( $!dataElement.aggregationOperator == 'min' ) selected="selected" #end>$i18n.getString( "min" )</option>
- <option value="max" #if( $!dataElement.aggregationOperator == 'max' ) selected="selected" #end>$i18n.getString( "max" )</option>
+ <option value="sum" #if( $!dataElement.aggregationOperator == 'sum' ) selected="selected" #end>$i18n.getString( "sum" )</option>
+ <option value="avg_sum_org_unit" #if( $!dataElement.aggregationOperator == 'avg_sum_org_unit' ) selected="selected" #end>$i18n.getString( "average_sum_in_org_unit_hierarchy" )</option>
+ <option value="avg" #if( $!dataElement.aggregationOperator == 'avg' ) selected="selected" #end>$i18n.getString( "average" )</option>
+ <option value="count" #if( $!dataElement.aggregationOperator == 'count' ) selected="selected" #end>$i18n.getString( "count" )</option>
+ <option value="stddev" #if( $!dataElement.aggregationOperator == 'stddev' ) selected="selected" #end>$i18n.getString( "stddev" )</option>
+ <option value="variance" #if( $!dataElement.aggregationOperator == 'variance' ) selected="selected" #end>$i18n.getString( "variance" )</option>
+ <option value="min" #if( $!dataElement.aggregationOperator == 'min' ) selected="selected" #end>$i18n.getString( "min" )</option>
+ <option value="max" #if( $!dataElement.aggregationOperator == 'max' ) selected="selected" #end>$i18n.getString( "max" )</option>
</select>
</td>
</tr>