dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17102
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6708: Fixed bug #984536: AttributeValues with empty string are saved as empty strings in the db. They a...
------------------------------------------------------------
revno: 6708
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-23 17:24:47 +0300
message:
Fixed bug #984536: AttributeValues with empty string are saved as empty strings in the db. They are now ignored.
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java 2012-04-23 14:24:47 +0000
@@ -27,17 +27,16 @@
package org.hisp.dhis.system.util;
+import net.sf.json.JSONObject;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.AttributeValue;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import net.sf.json.JSONObject;
-
-import org.hisp.dhis.attribute.Attribute;
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.AttributeValue;
-
/**
* @author mortenoh
*/
@@ -45,11 +44,11 @@
{
/**
* Given a list of JSON formatted values (with keys: 'id' and 'value'), this
- * method will add/update AttributeValue into the given Set.
- *
+ * method will add/update {@link AttributeValue} into the given {@code Set}.
+ *
* @param jsonAttributeValues List of JSON formatted values, needs two keys:
- * id => ID of attribute this value belongs to value => Actual value
- * @param attributeValues Set that will be updated
+ * id => ID of attribute this value belongs to value => Actual value
+ * @param attributeValues Set that will be updated
* @param attributeService
*/
public static void updateAttributeValuesFromJson( Set<AttributeValue> attributeValues,
@@ -65,7 +64,7 @@
Attribute attribute = attributeService.getAttribute( attributeValue.getId() );
- if ( attribute == null )
+ if ( attribute == null || attributeValue.getValue() == null || attributeValue.getValue().length() == 0 )
{
continue;
}
@@ -91,7 +90,6 @@
}
/**
- *
* @param attributeValues
* @return Map of <AttributeId, ValueString>
*/