Search in sources :

Example 71 with JsonValue

use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.

the class FormLabel method toJsonObject.

@Override
public JsonValue toJsonObject() {
    JsonValue object = createObject();
    object.put("id", id.asString());
    object.put("label", label);
    object.put("type", "label");
    object.put("visible", visible);
    return object;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 72 with JsonValue

use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.

the class FormPermissions method toJson.

public JsonValue toJson() {
    JsonValue object = Json.createObject();
    object.put("view", view);
    object.put("createRecord", createRecord);
    object.put("updateRecord", updateRecord);
    object.put("deleteRecord", deleteRecord);
    object.put("viewFilter", viewFilter);
    object.put("updateFilter", updateFilter);
    return object;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 73 with JsonValue

use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.

the class FormRecord method fromJson.

public static FormRecord fromJson(JsonValue element) {
    JsonValue jsonObject = element;
    FormRecord formRecord = new FormRecord();
    formRecord.recordId = jsonObject.get("recordId").asString();
    formRecord.formId = jsonObject.get("formId").asString();
    if (jsonObject.hasKey("parentRecordId")) {
        formRecord.parentRecordId = jsonObject.get("parentRecordId").asString();
    }
    formRecord.fields = jsonObject.get("fields");
    return formRecord;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 74 with JsonValue

use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.

the class FormRecord method toJson.

@Override
public JsonValue toJson() {
    assert recordId != null;
    assert formId != null;
    JsonValue jsonObject = createObject();
    jsonObject.put("recordId", recordId);
    jsonObject.put("formId", formId);
    if (parentRecordId != null) {
        jsonObject.put("parentRecordId", parentRecordId);
    }
    jsonObject.put("fields", fields);
    return jsonObject;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 75 with JsonValue

use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.

the class TableColumn method toJson.

@Value.Lazy
public JsonValue toJson() {
    JsonValue object = Json.createObject();
    object.put("id", getId());
    if (getLabel().isPresent()) {
        object.put("label", getLabel().get());
    }
    if (getWidth().isPresent()) {
        object.put("width", getWidth().get());
    }
    object.put("formula", getFormula());
    return object;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Aggregations

JsonValue (org.activityinfo.json.JsonValue)117 Test (org.junit.Test)24 ResourceId (org.activityinfo.model.resource.ResourceId)19 FormClass (org.activityinfo.model.form.FormClass)13 FormField (org.activityinfo.model.form.FormField)9 FieldValue (org.activityinfo.model.type.FieldValue)8 HashMap (java.util.HashMap)6 Map (java.util.Map)6 QuantityType (org.activityinfo.model.type.number.QuantityType)5 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Annotation (java.lang.annotation.Annotation)3 ArrayList (java.util.ArrayList)3 FormTreeBuilder (org.activityinfo.model.formTree.FormTreeBuilder)3 JaxRsJsonReader (org.activityinfo.server.endpoint.rest.JaxRsJsonReader)3 TypedRecordUpdate (org.activityinfo.store.spi.TypedRecordUpdate)3 EmbeddedEntity (com.google.appengine.api.datastore.EmbeddedEntity)2 URL (java.net.URL)2 JsonException (org.activityinfo.json.JsonException)2 JsonMappingException (org.activityinfo.json.JsonMappingException)2