Search in sources :

Example 46 with Endpoint

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

the class ListTypeController method downloadShapefile.

@Endpoint(url = "download-shapefile", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF downloadShapefile(ClientRequestIF request, @RequestParamter(name = "oid", required = true) String oid, @RequestParamter(name = "filter") String filter) throws JSONException {
    JsonObject masterList = this.service.getVersion(request.getSessionId(), oid);
    String code = masterList.get(ListType.TYPE_CODE).getAsString() + "-" + masterList.get(ListTypeVersion.FORDATE).getAsString();
    return new InputStreamResponse(service.downloadShapefile(request.getSessionId(), oid), "application/zip", code + ".zip");
}
Also used : JsonObject(com.google.gson.JsonObject) InputStreamResponse(com.runwaysdk.mvc.InputStreamResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 47 with Endpoint

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

the class ListTypeController method apply.

@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "apply")
public ResponseIF apply(ClientRequestIF request, @RequestParamter(name = "list", required = true) String listJSON) {
    JsonObject list = JsonParser.parseString(listJSON).getAsJsonObject();
    JsonObject response = this.service.apply(request.getSessionId(), list);
    return new RestBodyResponse(response);
}
Also used : JsonObject(com.google.gson.JsonObject) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 48 with Endpoint

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

the class ListTypeController method exportSpreadsheet.

// @Endpoint(url = "generate-shapefile", method = ServletMethod.POST, error =
// ErrorSerialization.JSON)
// public ResponseIF generateShapefile(ClientRequestIF request,
// @RequestParamter(name = "oid") String oid) throws JSONException
// {
// final String jobId = service.generateShapefile(request.getSessionId(),
// oid);
// 
// final RestResponse response = new RestResponse();
// response.set("job", jobId);
// 
// return response;
// }
@Endpoint(url = "export-spreadsheet", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF exportSpreadsheet(ClientRequestIF request, @RequestParamter(name = "oid", required = true) String oid, @RequestParamter(name = "criteria") String criteria) throws JSONException {
    JsonObject masterList = this.service.getVersion(request.getSessionId(), oid);
    String code = masterList.get(ListType.TYPE_CODE).getAsString() + "-" + masterList.get(ListTypeVersion.FORDATE).getAsString();
    return new InputStreamResponse(service.exportSpreadsheet(request.getSessionId(), oid, criteria), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", code + ".xlsx");
}
Also used : JsonObject(com.google.gson.JsonObject) InputStreamResponse(com.runwaysdk.mvc.InputStreamResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 49 with Endpoint

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

the class ListTypeController method exportShapefile.

@Endpoint(url = "export-shapefile", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF exportShapefile(ClientRequestIF request, @RequestParamter(name = "oid", required = true) String oid, @RequestParamter(name = "criteria") String criteria) throws JSONException {
    JsonObject masterList = this.service.getVersion(request.getSessionId(), oid);
    String code = masterList.get(ListType.TYPE_CODE).getAsString() + "-" + masterList.get(ListTypeVersion.FORDATE).getAsString();
    return new InputStreamResponse(service.exportShapefile(request.getSessionId(), oid, criteria), "application/zip", code + ".zip");
}
Also used : JsonObject(com.google.gson.JsonObject) InputStreamResponse(com.runwaysdk.mvc.InputStreamResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 50 with Endpoint

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

the class RegistryAccountController method getRolesForUser.

@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF getRolesForUser(ClientRequestIF request, @RequestParamter(name = "userOID", required = true) String userOID) throws JSONException {
    RegistryRole[] roles = this.accountService.getRolesForUser(request.getSessionId(), userOID);
    JsonArray rolesJSONArray = this.createRoleMap(roles);
    return new RestBodyResponse(rolesJSONArray);
}
Also used : JsonArray(com.google.gson.JsonArray) RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Aggregations

Endpoint (com.runwaysdk.mvc.Endpoint)68 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)52 CustomSerializer (org.commongeoregistry.adapter.metadata.CustomSerializer)25 Date (java.util.Date)21 JsonObject (com.google.gson.JsonObject)19 JsonArray (com.google.gson.JsonArray)16 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)11 JSONArray (org.json.JSONArray)11 JSONObject (org.json.JSONObject)11 RestResponse (com.runwaysdk.mvc.RestResponse)8 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)8 SimpleDateFormat (java.text.SimpleDateFormat)6 InputStreamResponse (com.runwaysdk.mvc.InputStreamResponse)5 InputStream (java.io.InputStream)5 RegistryRole (org.commongeoregistry.adapter.metadata.RegistryRole)5 GeoObjectOverTime (org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime)4 OrganizationDTO (org.commongeoregistry.adapter.metadata.OrganizationDTO)4 Locale (java.util.Locale)3 ImportStrategy (net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy)3 ParentTreeNode (org.commongeoregistry.adapter.dataaccess.ParentTreeNode)3