use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method createGeoObject.
/**
* Creates a new GeoObject in the Common Geo-Registry
*
* @pre
* @post
*
* @param geoObject
* in GeoJSON format to be created.
* @throws ParseException
*
* @returns
* @throws //TODO
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_CREATE)
public ResponseIF createGeoObject(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_CREATE_PARAM_GEOOBJECT) String jGeoObj, @RequestParamter(name = "startDate") String startDateString, @RequestParamter(name = "endDate") String endDateString) throws ParseException {
Date startDate = (startDateString != null && startDateString.length() > 0) ? GeoRegistryUtil.parseDate(startDateString, true) : null;
Date endDate = (endDateString != null && endDateString.length() > 0) ? GeoRegistryUtil.parseDate(endDateString, true) : null;
GeoObject geoObject = this.registryService.createGeoObject(request.getSessionId(), jGeoObj, startDate, endDate);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(geoObject.toJSON(serializer));
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getGeoObject.
/**
* Returns a GeoObject with the given uid.
*
* @pre @post
*
* @param uid
* The UID of the GeoObject.
*
* @returns a GeoObject in GeoJSON format with the given uid. @throws
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_GET)
public ResponseIF getGeoObject(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARAM_ID) String id, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARAM_TYPE_CODE) String typeCode, @RequestParamter(name = "date") String date) throws JSONException {
GeoObject geoObject = this.registryService.getGeoObject(request.getSessionId(), id, typeCode, GeoRegistryUtil.parseDate(date, true));
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(geoObject.toJSON(serializer));
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getTypeAncestors.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "geoobjecttype/get-ancestors")
public ResponseIF getTypeAncestors(ClientRequestIF request, @RequestParamter(name = "code", required = true) String code, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "includeInheritedTypes") Boolean includeInheritedTypes, @RequestParamter(name = "includeChild") Boolean includeChild) {
if (includeInheritedTypes == null) {
includeInheritedTypes = false;
}
JsonArray response = new JsonArray();
List<GeoObjectType> ancestors = this.registryService.getAncestors(request.getSessionId(), code, hierarchyCode, includeInheritedTypes, includeChild);
for (GeoObjectType ancestor : ancestors) {
JsonObject object = new JsonObject();
object.addProperty("label", ancestor.getLabel().getValue());
object.addProperty("code", ancestor.getCode());
response.add(object);
}
return new RestBodyResponse(response.toString());
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method updateOrganization.
/**
* Update organization.
*
* @param sessionId
* @param json
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "orgainization/update")
public ResponseIF updateOrganization(ClientRequestIF request, @RequestParamter(name = "json", required = true) String json) {
OrganizationDTO org = this.registryService.updateOrganization(request.getSessionId(), json);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(org.toJSON(serializer));
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getGeoObjectOverTime.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_TIME_GET)
public ResponseIF getGeoObjectOverTime(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_TIME_GET_PARAM_ID) String id, @RequestParamter(name = RegistryUrls.GEO_OBJECT_TIME_GET_PARAM_TYPE_CODE) String typeCode) throws JSONException {
GeoObjectOverTime geoObject = this.registryService.getGeoObjectOverTime(request.getSessionId(), id, typeCode);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(geoObject.toJSON(serializer));
}
Aggregations