Search in sources :

Example 1 with ImportStrategy

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);
    }
}
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 2 with ImportStrategy

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);
    }
}
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 3 with ImportStrategy

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);
    }
}
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)3 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)3 InputStream (java.io.InputStream)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Date (java.util.Date)3 ImportStrategy (net.geoprism.registry.etl.upload.ImportConfiguration.ImportStrategy)3 JSONObject (org.json.JSONObject)3