Send changes to PICTURE columns as actual JSON objects, not strings

pull/14/head
Sam Bosley 13 years ago
parent 19a99e6603
commit 7d6e025335

@ -45,6 +45,8 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
public static final int PROP_FLAG_USER_ID = 1 << 2;
/** Is this field a boolean? */
public static final int PROP_FLAG_BOOLEAN = 1 << 3;
/** Is this field a serialized JSON object? */
public static final int PROP_FLAG_JSON = 1 << 4;
public int flags = 0;

@ -63,7 +63,7 @@ public final class TagData extends RemoteModel {
/** Project picture */
public static final StringProperty PICTURE = new StringProperty(
TABLE, "picture");
TABLE, "picture", Property.PROP_FLAG_JSON);
/** Tag team array (JSON) */
@Deprecated public static final StringProperty MEMBERS = new StringProperty(

@ -60,7 +60,7 @@ public final class User extends RemoteModel {
/** User picture */
public static final StringProperty PICTURE = new StringProperty(
TABLE, "picture");
TABLE, "picture", Property.PROP_FLAG_JSON);
/** Remote id */
public static final StringProperty UUID = new StringProperty(

@ -54,7 +54,7 @@ public class UserActivity extends RemoteModel {
/** Picture */
public static final StringProperty PICTURE = new StringProperty(
TABLE, "picture");
TABLE, "picture", Property.PROP_FLAG_JSON);
/** Target id */
public static final StringProperty TARGET_ID = new StringProperty(

@ -204,6 +204,12 @@ 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))
try {
return new JSONObject(value);
} catch (JSONException e) {
//
}
return value;
}

Loading…
Cancel
Save