Search in sources :

Example 36 with JsonValue

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

the class ExportFormJob method toJson.

@Override
public JsonValue toJson() {
    JsonValue object = createObject();
    object.put("model", tableModel.toJson());
    return object;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 37 with JsonValue

use of org.activityinfo.json.JsonValue 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);
}
Also used : JsonValue(org.activityinfo.json.JsonValue) URL(java.net.URL) JsonParser(org.activityinfo.json.JsonParser)

Example 38 with JsonValue

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

the class EnumItem method toJsonObject.

public JsonValue toJsonObject() {
    JsonValue jsonObject = createObject();
    jsonObject.put("id", id.asString());
    jsonObject.put("label", label);
    if (!Strings.isNullOrEmpty(code)) {
        jsonObject.put("code", code);
    }
    return jsonObject;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 39 with JsonValue

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

the class EnumType method getParametersAsJson.

@Override
public JsonValue getParametersAsJson() {
    JsonValue enumValueArray = Json.createArray();
    for (EnumItem enumItem : getValues()) {
        enumValueArray.add(enumItem.toJsonObject());
    }
    JsonValue object = createObject();
    object.put("cardinality", cardinality.name().toLowerCase());
    object.put("presentation", presentation.name().toLowerCase());
    object.put("values", enumValueArray);
    return object;
}
Also used : JsonValue(org.activityinfo.json.JsonValue)

Example 40 with JsonValue

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

the class GeoArea method toJson.

@Override
public JsonValue toJson() {
    JsonValue object = createObject();
    object.put("blobId", blobId);
    object.put("bbox", envelope.toJsonElement());
    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