use of net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy 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 net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy 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 net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy 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