use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class ETLController method importEdgeJson.
@Endpoint(url = "import-edge-json", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF importEdgeJson(ClientRequestIF request, @RequestParamter(name = "relationshipType") String relationshipType, @RequestParamter(name = "graphTypeCode") String graphTypeCode, @RequestParamter(name = "startDate") String startDate, @RequestParamter(name = "endDate") String endDate, @RequestParamter(name = "file") MultipartFileParameter file) throws IOException, JSONException, ParseException {
try (InputStream stream = file.getInputStream()) {
Date sDate = startDate != null ? GeoRegistryUtil.parseDate(startDate) : null;
Date eDate = endDate != null ? GeoRegistryUtil.parseDate(endDate) : null;
service.importEdgeJson(request.getSessionId(), relationshipType, graphTypeCode, sDate, eDate, stream);
return new RestResponse();
}
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphController method removeChild.
@Endpoint(url = "remove-child", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF removeChild(ClientRequestIF request, @RequestParamter(name = "parentCode", required = true) String parentCode, @RequestParamter(name = "parentTypeCode", required = true) String parentTypeCode, @RequestParamter(name = "childCode", required = true) String childCode, @RequestParamter(name = "childTypeCode", required = true) String childTypeCode, @RequestParamter(name = "directedGraphCode", required = true) String directedGraphCode, @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(), parentCode, parentTypeCode, childCode, childTypeCode, directedGraphCode, startDate, endDate);
return new RestResponse();
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphController method addChild.
@Endpoint(url = "add-child", method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF addChild(ClientRequestIF request, @RequestParamter(name = "parentCode", required = true) String parentCode, @RequestParamter(name = "parentTypeCode", required = true) String parentTypeCode, @RequestParamter(name = "childCode", required = true) String childCode, @RequestParamter(name = "childTypeCode", required = true) String childTypeCode, @RequestParamter(name = "directedGraphCode", required = true) String directedGraphCode, @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(), parentCode, parentTypeCode, childCode, childTypeCode, directedGraphCode, startDate, endDate);
return new RestBodyResponse(response);
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphController method getChildren.
@Endpoint(url = "get-children", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF getChildren(ClientRequestIF request, @RequestParamter(name = "parentCode", required = true) String parentCode, @RequestParamter(name = "parentTypeCode", required = true) String parentTypeCode, @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.getChildren(request.getSessionId(), parentCode, parentTypeCode, directedGraphCode, recursive, date);
return new RestBodyResponse(response);
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class GeoObjectController method doesGeoObjectExistAtRange.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "exists-at-range")
public ResponseIF doesGeoObjectExistAtRange(ClientRequestIF request, @RequestParamter(name = "startDate") String startDate, @RequestParamter(name = "endDate") String endDate, @RequestParamter(name = "typeCode") String typeCode, @RequestParamter(name = "code") String code) throws ParseException {
Date dStartDate = null;
if (startDate != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
dStartDate = format.parse(startDate);
}
Date dEndDate = null;
if (endDate != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
dEndDate = format.parse(endDate);
}
JsonObject stats = ServiceFactory.getGeoObjectService().doesGeoObjectExistAtRange(request.getSessionId(), dStartDate, dEndDate, typeCode, code);
return new RestBodyResponse(stats.toString());
}
Aggregations