Put JSON null in changes happened when value is null

pull/14/head
Sam Bosley 12 years ago
parent c2a31285c0
commit c9f2dfb14c

@ -299,7 +299,7 @@ public class DateUtilities {
public static String timeToIso8601(long time, boolean includeTime) {
if (time == 0)
return ""; //$NON-NLS-1$
return null;
Date date = new Date(time);
String formatString = "yyyy-MM-dd'T'HH:mm:ssZ"; //$NON-NLS-1$
if (!includeTime)

@ -144,7 +144,10 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
if (!validateValue(localProperty, value))
return null;
changeJson.put("value", value);
if (value == null)
changeJson.put("value", JSONObject.NULL);
else
changeJson.put("value", value);
}
changeJson.put("column", serverColumn);
@ -261,15 +264,18 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
String value = getAsString(data);
if (RemoteModel.NO_UUID.equals(value) && property.checkFlag(Property.PROP_FLAG_USER_ID))
return ActFmPreferenceService.userId();
if (property.checkFlag(Property.PROP_FLAG_JSON))
if (property.checkFlag(Property.PROP_FLAG_JSON)) {
if (TextUtils.isEmpty(value))
return null;
try {
if (value != null && value.startsWith("["))
return new JSONArray(value);
else
return new JSONObject(value);
} catch (JSONException e) {
//
return null;
}
}
return value;
}

Loading…
Cancel
Save