use of com.runwaysdk.mvc.RestBodyResponse 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.RestBodyResponse 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.RestBodyResponse 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());
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class HierarchyController method setInheritedHierarchy.
/**
* Modifies a hierarchy to inherit from another hierarchy at the given
* GeoObjectType
*
* @param request
* Session Request
* @param hierarchyTypeCode
* code of the {@link HierarchyType} being modified.
* @param inheritedHierarchyTypeCode
* code of the {@link HierarchyType} being inherited.
* @param geoObjectTypeCode
* code of the root {@link GeoObjectType}.
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "setInherited")
public ResponseIF setInheritedHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyTypeCode", required = true) String hierarchyTypeCode, @RequestParamter(name = "inheritedHierarchyTypeCode", required = true) String inheritedHierarchyTypeCode, @RequestParamter(name = "geoObjectTypeCode", required = true) String geoObjectTypeCode) {
HierarchyType ht = ServiceFactory.getHierarchyService().setInheritedHierarchy(request.getSessionId(), hierarchyTypeCode, inheritedHierarchyTypeCode, geoObjectTypeCode);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(ht.toJSON(serializer));
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getChildGeoObjects.
/**
* Get children of the given GeoObject
*
* @pre @post
*
* @param parentUid
* UID of the parent object for which the call fetches
* children. @param childrentTypes An array of GeoObjectType names of
* the types of children GeoObjects to fetch. If blank then return
* children of all types. @param recursive TRUE if recursive children
* of the given parent with the given types should be returned, FALSE
* if only single level children should be returned.
*
* @returns @throws
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_GET_CHILDREN)
public ResponseIF getChildGeoObjects(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_PARENTCODE, required = true) String parentCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CHILDREN_PARAM_PARENT_TYPE_CODE, required = true) String parentTypeCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CHILDREN_PARAM_DATE, required = true) String date, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CHILDREN_PARAM_CHILDREN_TYPES) String childrenTypes, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CHILDREN_PARAM_RECURSIVE, required = true) Boolean recursive) {
String[] aChildTypes = null;
if (childrenTypes != null) {
JSONArray jaChildTypes = new JSONArray(childrenTypes);
aChildTypes = new String[jaChildTypes.length()];
for (int i = 0; i < jaChildTypes.length(); i++) {
aChildTypes[i] = jaChildTypes.getString(i);
}
}
TreeNode tn = this.registryService.getChildGeoObjects(request.getSessionId(), parentCode, parentTypeCode, aChildTypes, recursive, GeoRegistryUtil.parseDate(date, true));
return new RestBodyResponse(tn.toJSON());
}
Aggregations