Search in sources :

Example 36 with Endpoint

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

the class ChangeRequestController method uploadFileCR.

/**
 * @param request
 * @param crOid
 * @param file
 * @return
 * @throws IOException
 */
@Endpoint(url = "upload-file-cr", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF uploadFileCR(ClientRequestIF request, @RequestParamter(name = "crOid") String crOid, @RequestParamter(name = "file") MultipartFileParameter file) throws IOException {
    try (InputStream stream = file.getInputStream()) {
        String fileName = file.getFilename();
        String vfOid = service.uploadFileCR(request.getSessionId(), crOid, fileName, stream);
        return new RestBodyResponse(vfOid);
    }
}
Also used : InputStream(java.io.InputStream) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 37 with Endpoint

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

the class ClassificationController method apply.

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

Example 38 with Endpoint

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

the class DirectedAcyclicGraphController method getParents.

@Endpoint(url = "get-parents", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF getParents(ClientRequestIF request, @RequestParamter(name = "childCode", required = true) String childCode, @RequestParamter(name = "childTypeCode", required = true) String childTypeCode, @RequestParamter(name = "directedGraphCode", required = true) String directedGraphCode, @RequestParamter(name = "recursive", required = true) Boolean recursive, @RequestParamter(name = "date", required = true) String sDate) {
    Date date = GeoRegistryUtil.parseDate(sDate, true);
    JsonObject response = this.service.getParents(request.getSessionId(), childCode, childTypeCode, directedGraphCode, recursive, date);
    return new RestBodyResponse(response);
}
Also used : JsonObject(com.google.gson.JsonObject) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Date(java.util.Date) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 39 with Endpoint

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

the class ExcelImportController method getConfiguration.

@Endpoint(url = "get-configuration", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF getConfiguration(ClientRequestIF request, @RequestParamter(name = "type", required = true) String type, @RequestParamter(name = "startDate") String startDate, @RequestParamter(name = "endDate") String endDate, @RequestParamter(name = "file", required = true) MultipartFileParameter file, @RequestParamter(name = "strategy", required = true) String sStrategy, @RequestParamter(name = "copyBlank", required = true) Boolean copyBlank) throws IOException, JSONException, ParseException {
    try (InputStream stream = file.getInputStream()) {
        String fileName = file.getFilename();
        SimpleDateFormat format = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
        format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
        Date sDate = startDate != null ? format.parse(startDate) : null;
        Date eDate = endDate != null ? format.parse(endDate) : null;
        ImportStrategy strategy = ImportStrategy.valueOf(sStrategy);
        JSONObject configuration = service.getExcelConfiguration(request.getSessionId(), type, sDate, eDate, fileName, stream, strategy, copyBlank);
        return new RestBodyResponse(configuration);
    }
}
Also used : ImportStrategy(net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy) JSONObject(org.json.JSONObject) InputStream(java.io.InputStream) SimpleDateFormat(java.text.SimpleDateFormat) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Date(java.util.Date) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 40 with Endpoint

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

the class ExcelImportController method getBusinessConfiguration.

@Endpoint(url = "get-business-config", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF getBusinessConfiguration(ClientRequestIF request, @RequestParamter(name = "type") String type, @RequestParamter(name = "date") String date, @RequestParamter(name = "file") MultipartFileParameter file, @RequestParamter(name = "strategy") String sStrategy, @RequestParamter(name = "copyBlank") Boolean copyBlank) throws IOException, JSONException, ParseException {
    try (InputStream stream = file.getInputStream()) {
        String fileName = file.getFilename();
        SimpleDateFormat format = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
        format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
        Date sDate = date != null ? format.parse(date) : null;
        ImportStrategy strategy = ImportStrategy.valueOf(sStrategy);
        JSONObject configuration = service.getBusinessTypeConfiguration(request.getSessionId(), type, sDate, fileName, stream, strategy, copyBlank);
        return new RestBodyResponse(configuration);
    }
}
Also used : ImportStrategy(net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy) JSONObject(org.json.JSONObject) InputStream(java.io.InputStream) SimpleDateFormat(java.text.SimpleDateFormat) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Date(java.util.Date) 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