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);
}
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations