use of org.commongeoregistry.adapter.metadata.DefaultSerializer in project geoprism-registry by terraframe.
the class ListTypeService method record.
@Request(RequestType.SESSION)
public JsonObject record(String sessionId, String oid, String uid) {
ListTypeVersion version = ListTypeVersion.get(oid);
if (version.getWorking()) {
ListType type = version.getListType();
if (type.doesActorHaveExploratoryPermission()) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
ServerGeoObjectType geoObjectType = type.getGeoObjectType();
ServerGeoObjectIF geoObject = new ServerGeoObjectService().getGeoObject(uid, geoObjectType.getCode());
JsonObject object = new JsonObject();
object.addProperty("recordType", "GEO_OBJECT");
object.add("type", geoObject.getType().toJSON(new DefaultSerializer()));
object.addProperty("code", geoObject.getCode());
object.addProperty(ListTypeVersion.FORDATE, format.format(version.getForDate()));
// Add geometry so we can zoom to it
object.add("geoObject", geoObject.toGeoObject(version.getForDate()).toJSON());
return object;
}
}
return version.record(uid);
}
Aggregations