use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class ShapefileController method getShapefileConfiguration.
@Endpoint(url = "get-shapefile-configuration", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF getShapefileConfiguration(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.getShapefileConfiguration(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 TermController method createClassifierSynonym.
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF createClassifierSynonym(ClientRequestIF request, @RequestParamter(name = "classifierId", required = true) String classifierId, @RequestParamter(name = "label", required = true) String label) throws JSONException {
String response = DataUploaderDTO.createClassifierSynonym(request, classifierId, label);
JSONObject object = new JSONObject(response);
return new RestBodyResponse(object);
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class UndirectedGraphController method addChild.
@Endpoint(url = "add-target", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF addChild(ClientRequestIF request, @RequestParamter(name = "sourceCode", required = true) String sourceCode, @RequestParamter(name = "sourceTypeCode", required = true) String sourceTypeCode, @RequestParamter(name = "targetCode", required = true) String targetCode, @RequestParamter(name = "targetTypeCode", required = true) String targetTypeCode, @RequestParamter(name = "undirectedRelationshipCode", required = true) String undirectedRelationshipCode, @RequestParamter(name = "startDate", required = true) String startDateStr, @RequestParamter(name = "endDate", required = true) String endDateStr) {
Date startDate = GeoRegistryUtil.parseDate(startDateStr, true);
Date endDate = GeoRegistryUtil.parseDate(endDateStr, true);
JsonObject response = this.service.addChild(request.getSessionId(), sourceCode, sourceTypeCode, targetCode, targetTypeCode, undirectedRelationshipCode, startDate, endDate);
return new RestBodyResponse(response);
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class UndirectedGraphController method removeChild.
@Endpoint(url = "remove-target", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF removeChild(ClientRequestIF request, @RequestParamter(name = "sourceCode", required = true) String sourceCode, @RequestParamter(name = "sourceTypeCode", required = true) String sourceTypeCode, @RequestParamter(name = "targetCode", required = true) String targetCode, @RequestParamter(name = "targetTypeCode", required = true) String targetTypeCode, @RequestParamter(name = "undirectedRelationshipCode", required = true) String undirectedRelationshipCode, @RequestParamter(name = "startDate", required = true) String startDateStr, @RequestParamter(name = "endDate", required = true) String endDateStr) {
Date startDate = GeoRegistryUtil.parseDate(startDateStr, true);
Date endDate = GeoRegistryUtil.parseDate(endDateStr, true);
this.service.removeChild(request.getSessionId(), sourceCode, sourceTypeCode, targetCode, targetTypeCode, undirectedRelationshipCode, startDate, endDate);
return new RestResponse();
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class RegistryLocalizationController method getNewLocaleInformation.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF getNewLocaleInformation(ClientRequestIF request) throws IOException, ServletException {
JSONObject json = new JSONObject();
JSONArray languages = new JSONArray();
JSONArray countries = new JSONArray();
Locale sessionLocale = LocaleUtils.toLocale(RegistryService.getInstance().getCurrentLocale(request.getSessionId()));
for (Locale locale : LocalizationFacade.getAvailableLanguagesSorted()) {
JSONObject jobj = new JSONObject();
jobj.put("key", locale.getLanguage());
jobj.put("label", locale.getDisplayLanguage(sessionLocale));
languages.put(jobj);
}
for (Locale locale : LocalizationFacade.getAvailableCountriesSorted()) {
JSONObject jobj = new JSONObject();
jobj.put("key", locale.getCountry());
jobj.put("label", locale.getDisplayCountry(sessionLocale));
countries.put(jobj);
}
json.put("languages", languages);
json.put("countries", countries);
return new RestBodyResponse(json);
}
Aggregations