dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39406
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19945: remove unused fields valueType in dataElementOperand
------------------------------------------------------------
revno: 19945
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 09:35:05 +0700
message:
remove unused fields valueType in dataElementOperand
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/OperandTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2015-07-15 11:04:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2015-09-03 02:35:05 +0000
@@ -28,11 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Matcher;
-
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+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.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
@@ -42,17 +43,15 @@
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.expression.ExpressionService;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
/**
* This object can act both as a hydrated persisted object and as a wrapper
* object (but not both at the same time).
- * <p/>
+ * <p>
* This object implements IdentifiableObject but does not have any UID. Instead
* the UID is generated based on the data element and category option combo which
* this object is based on.
@@ -94,8 +93,6 @@
private String operandName;
- private String valueType;
-
private String aggregationOperator;
private List<Integer> aggregationLevels = new ArrayList<>();
@@ -135,14 +132,13 @@
this.operandName = operandName;
}
- public DataElementOperand( String dataElementId, String optionComboId, String operandName, String valueType,
+ public DataElementOperand( String dataElementId, String optionComboId, String operandName,
String aggregationOperator, List<Integer> aggregationLevels, int frequencyOrder )
{
this.dataElementId = dataElementId;
this.optionComboId = optionComboId;
this.operandId = dataElementId + SEPARATOR + optionComboId;
this.operandName = operandName;
- this.valueType = valueType;
this.aggregationOperator = aggregationOperator;
this.aggregationLevels = aggregationLevels;
this.frequencyOrder = frequencyOrder;
@@ -355,7 +351,7 @@
{
return operandType != null && operandType.equals( TYPE_TOTAL );
}
-
+
/**
* Updates all transient properties.
*
@@ -371,7 +367,6 @@
this.aggregationOperator = dataElement.getAggregationOperator();
this.frequencyOrder = dataElement.getFrequencyOrder();
this.aggregationLevels = new ArrayList<>( dataElement.getAggregationLevels() );
- this.valueType = dataElement.getType();
this.uid = dataElementId + SEPARATOR + optionComboId;
this.name = getPrettyName( dataElement, categoryOptionCombo );
@@ -390,7 +385,6 @@
this.aggregationOperator = dataElement.getAggregationOperator();
this.frequencyOrder = dataElement.getFrequencyOrder();
this.aggregationLevels = new ArrayList<>( dataElement.getAggregationLevels() );
- this.valueType = dataElement.getType();
this.uid = dataElementId;
this.name = getPrettyName( dataElement, null );
@@ -504,19 +498,6 @@
@JsonProperty
@JsonView( { DetailedView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getValueType()
- {
- return valueType;
- }
-
- public void setValueType( String valueType )
- {
- this.valueType = valueType;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getAggregationOperator()
{
return aggregationOperator;
@@ -596,7 +577,6 @@
", optionComboId=" + optionComboId +
", operandId='" + operandId + '\'' +
", operandName='" + operandName + '\'' +
- ", valueType='" + valueType + '\'' +
", aggregationOperator='" + aggregationOperator + '\'' +
", aggregationLevels=" + aggregationLevels +
", frequencyOrder=" + frequencyOrder +
=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/OperandTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/OperandTest.java 2015-07-03 15:45:40 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/OperandTest.java 2015-09-03 02:35:05 +0000
@@ -28,28 +28,27 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.*;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
-import org.junit.Test;
+import static org.junit.Assert.*;
/**
* @author Lars Helge Overland
- * @version $Id$
*/
public class OperandTest
{
@Test
public void testGetRelevantAggregationLevel()
{
- DataElementOperand operand = new DataElementOperand( "a", "a", "Operand", null, null, new ArrayList<Integer>(), 0 );
-
+ DataElementOperand operand = new DataElementOperand( "a", "a", "Operand", null, new ArrayList<>(), 0 );
+
assertNull( operand.getRelevantAggregationLevel( 1 ) );
-
- operand = new DataElementOperand( "a", "a", "Operand", null, null, Arrays.asList( 3, 5 ), 0 );
-
+
+ operand = new DataElementOperand( "a", "a", "Operand", null, Arrays.asList( 3, 5 ), 0 );
+
assertEquals( new Integer( 3 ), operand.getRelevantAggregationLevel( 1 ) );
assertEquals( new Integer( 3 ), operand.getRelevantAggregationLevel( 2 ) );
assertEquals( new Integer( 3 ), operand.getRelevantAggregationLevel( 3 ) );
@@ -57,21 +56,21 @@
assertEquals( new Integer( 5 ), operand.getRelevantAggregationLevel( 5 ) );
assertNull( operand.getRelevantAggregationLevel( 6 ) );
}
-
+
@Test
public void testAggregationLevelIsValid()
{
- DataElementOperand operand = new DataElementOperand( "a", "a", "Operand", null, null, new ArrayList<Integer>(), 0 );
-
+ DataElementOperand operand = new DataElementOperand( "a", "a", "Operand", null, new ArrayList<>(), 0 );
+
assertTrue( operand.aggregationLevelIsValid( 1, 3 ) );
assertTrue( operand.aggregationLevelIsValid( 4, 3 ) );
-
- operand = new DataElementOperand( "a", "a", "Operand", null, null, Arrays.asList( 3, 5 ), 0 );
+
+ operand = new DataElementOperand( "a", "a", "Operand", null, Arrays.asList( 3, 5 ), 0 );
assertTrue( operand.aggregationLevelIsValid( 2, 2 ) );
assertTrue( operand.aggregationLevelIsValid( 2, 3 ) );
assertFalse( operand.aggregationLevelIsValid( 2, 4 ) );
-
+
assertTrue( operand.aggregationLevelIsValid( 3, 3 ) );
assertFalse( operand.aggregationLevelIsValid( 3, 4 ) );