Search in sources :

Example 16 with RestBodyResponse

use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.

the class RegistryController method updateHierarchyType.

/**
 * Updates the given {@link HierarchyType} represented as JSON.
 *
 * @param sessionId
 * @param gtJSON
 *          JSON of the {@link HierarchyType} to be updated.
 */
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.HIERARCHY_TYPE_UPDATE)
public ResponseIF updateHierarchyType(ClientRequestIF request, @RequestParamter(name = "htJSON", required = true) String htJSON) {
    HierarchyType hierarchyType = ServiceFactory.getHierarchyService().updateHierarchyType(request.getSessionId(), htJSON);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(hierarchyType.toJSON(serializer));
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 17 with RestBodyResponse

use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.

the class RegistryController method createGeoObjectOverTime.

@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_TIME_CREATE)
public ResponseIF createGeoObjectOverTime(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_TIME_CREATE_PARAM_GEOOBJECT) String jGeoObj) {
    GeoObjectOverTime geoObject = this.registryService.createGeoObjectOverTime(request.getSessionId(), jGeoObj);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(geoObject.toJSON(serializer));
}
Also used : GeoObjectOverTime(org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 18 with RestBodyResponse

use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.

the class RegistryController method getGeoObjectBoundsAtDate.

@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "geoobject-time/get-bounds")
public ResponseIF getGeoObjectBoundsAtDate(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_CODE) String code, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARAM_TYPE_CODE) String typeCode, @RequestParamter(name = "date") String date) throws JSONException, ParseException {
    Date forDate = GeoRegistryUtil.parseDate(date, true);
    GeoObject geoObject = this.registryService.getGeoObjectByCode(request.getSessionId(), code, typeCode, forDate);
    String bounds = this.registryService.getGeoObjectBoundsAtDate(request.getSessionId(), geoObject, forDate);
    return new RestBodyResponse(bounds);
}
Also used : GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Date(java.util.Date) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 19 with RestBodyResponse

use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.

the class RegistryController method updateGeoObjectOverTime.

@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_TIME_UPDATE)
public ResponseIF updateGeoObjectOverTime(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_TIME_UPDATE_PARAM_GEOOBJECT) String jGeoObj) {
    GeoObjectOverTime goTime = this.registryService.updateGeoObjectOverTime(request.getSessionId(), jGeoObj);
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(goTime.toJSON(serializer));
}
Also used : GeoObjectOverTime(org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 20 with RestBodyResponse

use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.

the class RegistryController method getGeoObjectByCode.

/**
 * Returns a GeoObject with the given code.
 *
 * @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_CODE)
public ResponseIF getGeoObjectByCode(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_CODE) String code, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_TYPE_CODE) String typeCode, @RequestParamter(name = "date") String date) throws JSONException {
    GeoObject geoObject = this.registryService.getGeoObjectByCode(request.getSessionId(), code, typeCode, GeoRegistryUtil.parseDate(date, true));
    CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
    return new RestBodyResponse(geoObject.toJSON(serializer));
}
Also used : GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Aggregations

RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)53 Endpoint (com.runwaysdk.mvc.Endpoint)52 CustomSerializer (org.commongeoregistry.adapter.metadata.CustomSerializer)25 Date (java.util.Date)16 JsonObject (com.google.gson.JsonObject)14 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)11 JsonArray (com.google.gson.JsonArray)10 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)8 JSONArray (org.json.JSONArray)7 JSONObject (org.json.JSONObject)7 SimpleDateFormat (java.text.SimpleDateFormat)5 InputStream (java.io.InputStream)4 GeoObjectOverTime (org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime)4 OrganizationDTO (org.commongeoregistry.adapter.metadata.OrganizationDTO)4 ImportStrategy (net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy)3 ParentTreeNode (org.commongeoregistry.adapter.dataaccess.ParentTreeNode)3 GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)3 PermissionContext (net.geoprism.registry.permission.PermissionContext)2 TreeNode (org.commongeoregistry.adapter.dataaccess.TreeNode)2 ValueObjectDTO (com.runwaysdk.business.ValueObjectDTO)1