use of org.activityinfo.json.JsonParser in project activityinfo by bedatadriven.
the class FormClassTest method parseResource.
private FormClass parseResource() throws IOException {
URL resource = Resources.getResource(FormClass.class, "OldFormClass1.json");
String json = Resources.toString(resource, Charsets.UTF_8);
JsonParser parser = new org.activityinfo.json.JsonParser();
JsonValue element = parser.parse(json);
return FormClass.fromJson(element);
}
use of org.activityinfo.json.JsonParser in project activityinfo by bedatadriven.
the class ActivityPolicy method updateFormClass.
private void updateFormClass(Activity activity, String name, String json) {
if (!Strings.isNullOrEmpty(json)) {
JsonParser parser = new JsonParser();
JsonValue jsonObject = parser.parse(json);
FormClass formClass = FormClass.fromJson(jsonObject);
formClass.setLabel(name);
String updatedJson = formClass.toJsonString();
JsonHelper.updateWithJson(activity, updatedJson);
}
}
Aggregations