dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39424
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19957: Value type fixes for event analytics
------------------------------------------------------------
revno: 19957
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 11:26:38 +0200
message:
Value type fixes for event analytics
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/util/ObjectUtils.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/common/QueryItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2015-09-03 09:26:38 +0000
@@ -28,15 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.legend.LegendSet;
import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.util.ObjectUtils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
/**
* Class which encapsulates a query parameter and value. Operator and filter
@@ -112,12 +111,12 @@
public String getTypeAsString()
{
- return ObjectUtils.VALUE_TYPE_JAVA_CLASS_MAP.get( valueType ).getName();
+ return valueType.getJavaClass().toString();
}
public boolean isNumeric()
{
- return Double.class.equals( ObjectUtils.VALUE_TYPE_JAVA_CLASS_MAP.get( valueType ) );
+ return valueType.isNumeric();
}
public boolean hasLegendSet()
=== 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-09-03 08:15:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java 2015-09-03 09:26:38 +0000
@@ -226,6 +226,7 @@
return ValueType.TEXT; // Fall back
}
+ //TODO remove and replace with ValueType.valueOf
public static ValueType fromValue( String value )
{
for ( ValueType valueType : ValueType.values() )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/util/ObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/util/ObjectUtils.java 2015-07-08 05:02:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/util/ObjectUtils.java 2015-09-03 09:26:38 +0000
@@ -28,31 +28,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.joda.time.DateTime;
public class ObjectUtils
{
- public static final Map<String, Class<?>> VALUE_TYPE_JAVA_CLASS_MAP = new HashMap<String, Class<?>>() { {
- put( DataElement.VALUE_TYPE_INT, Double.class );
- put( DataElement.VALUE_TYPE_STRING, String.class );
- put( DataElement.VALUE_TYPE_BOOL, Boolean.class );
- put( DataElement.VALUE_TYPE_TRUE_ONLY, Boolean.class );
- put( DataElement.VALUE_TYPE_DATE, Date.class );
- put( DataElement.VALUE_TYPE_DATETIME, DateTime.class );
- put( DataElement.VALUE_TYPE_UNIT_INTERVAL, Double.class );
- put( DataElement.VALUE_TYPE_PERCENTAGE, Double.class );
- put( TrackedEntityAttribute.TYPE_NUMBER, Double.class );
- put( TrackedEntityAttribute.TYPE_LETTER, String.class );
- put( TrackedEntityAttribute.TYPE_OPTION_SET, String.class );
- put( TrackedEntityAttribute.TYPE_EMAIL, String.class );
- } };
-
/**
* Returns the first non-null argument. Returns null if all arguments are null.
*