use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class FormMetadata method toJson.
@Override
public JsonValue toJson() {
JsonValue object = createObject();
object.put("id", id.asString());
if (!visible) {
object.put("visible", false);
}
if (deleted) {
object.put("deleted", true);
}
if (schema != null) {
object.put("schema", schema.toJson());
}
if (!locks.isEmpty()) {
object.put("locks", locks.toJson());
}
if (visible) {
object.put("version", version);
object.put("schemaVersion", schemaVersion);
object.put("permissions", permissions.toJson());
}
return object;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class CatalogEntry method fromJson.
public static CatalogEntry fromJson(JsonValue jsonElement) {
JsonValue jsonObject = jsonElement;
CatalogEntry model = new CatalogEntry();
model.id = jsonObject.get("id").asString();
model.type = CatalogEntryType.valueOf(jsonObject.get("type").asString().toUpperCase());
model.label = jsonObject.get("label").asString();
model.leaf = jsonObject.getBoolean("leaf");
return model;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class ReferenceType method getParametersAsJson.
@Override
public JsonValue getParametersAsJson() {
JsonValue object = createObject();
object.put("cardinality", cardinality.name().toLowerCase());
JsonValue rangeArray = Json.createArray();
for (ResourceId formId : range) {
JsonValue rangeObject = createObject();
rangeObject.put("formId", formId.asString());
rangeArray.add(rangeObject);
}
object.put("range", rangeArray);
return object;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class SerialNumber method toJson.
@Override
public JsonValue toJson() {
if (prefix == null) {
return Json.create(number);
} else {
JsonValue object = createObject();
object.put("prefix", prefix);
object.put("number", number);
return object;
}
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class Attachment method toJsonElement.
public JsonValue toJsonElement() {
JsonValue object = createObject();
object.put("mimeType", mimeType);
object.put("width", width);
object.put("height", height);
object.put("filename", filename);
object.put("blobId", blobId);
return object;
}
Aggregations