Search in sources :

Example 31 with Endpoint

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);
    }
}
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 32 with Endpoint

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);
}
Also used : JSONObject(org.json.JSONObject) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 33 with Endpoint

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);
}
Also used : JsonObject(com.google.gson.JsonObject) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) Date(java.util.Date) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 34 with Endpoint

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();
}
Also used : RestResponse(com.runwaysdk.mvc.RestResponse) Date(java.util.Date) Endpoint(com.runwaysdk.mvc.Endpoint)

Example 35 with Endpoint

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);
}
Also used : Locale(java.util.Locale) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) 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