use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getGeoObjectBounds.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "geoobject/get-bounds")
public ResponseIF getGeoObjectBounds(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_CODE) String code, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARAM_TYPE_CODE) String typeCode) throws JSONException {
GeoObject geoObject = this.registryService.getGeoObjectByCode(request.getSessionId(), code, typeCode, null);
String bounds = this.registryService.getGeoObjectBounds(request.getSessionId(), geoObject);
return new RestBodyResponse(bounds);
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method getParentGeoObjects.
/**
* Get parents of the given GeoObject
*
* @pre @post
*
* @param childUid
* UID of the child object for which the call fetches parents. @param
* parentTypes An array of GeoObjectType names of the types of parent
* GeoObjects to fetch. If blank then return parents of all
* types. @param recursive TRUE if recursive parents of the given
* parent with the given types should be returned, FALSE if only
* single level parents should be returned.
* @throws ParseException
*
* @returns @throws
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_GET_PARENTS)
public ResponseIF getParentGeoObjects(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARENTS_PARAM_CHILDCODE, required = true) String childCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARENTS_PARAM_CHILD_TYPE_CODE, required = true) String childTypeCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARENTS_PARAM_DATE, required = true) String date, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARENTS_PARAM_PARENT_TYPES) String parentTypes, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_PARENTS_PARAM_RECURSIVE, required = true) Boolean recursive) throws ParseException {
String[] aParentTypes = null;
if (parentTypes != null) {
JSONArray jaParentTypes = new JSONArray(parentTypes);
aParentTypes = new String[jaParentTypes.length()];
for (int i = 0; i < jaParentTypes.length(); i++) {
aParentTypes[i] = jaParentTypes.getString(i);
}
}
TreeNode tn = this.registryService.getParentGeoObjects(request.getSessionId(), childCode, childTypeCode, aParentTypes, recursive, GeoRegistryUtil.parseDate(date, true));
return new RestBodyResponse(tn.toJSON());
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method removeFromHierarchy.
/**
* Removes the {@link GeoObjectType} with the given child code from the parent
* {@link GeoObjectType} with the given code for the given
* {@link HierarchyType} code.
*
* @param sessionId
* @param hierarchyCode
* code of the {@link HierarchyType} the child is being added to.
* @param parentGeoObjectTypeCode
* parent {@link GeoObjectType}.
* @param childGeoObjectTypeCode
* child {@link GeoObjectType}.
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.HIERARCHY_TYPE_REMOVE)
public ResponseIF removeFromHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "parentGeoObjectTypeCode", required = true) String parentGeoObjectTypeCode, @RequestParamter(name = "childGeoObjectTypeCode", required = true) String childGeoObjectTypeCode) {
HierarchyType ht = ServiceFactory.getHierarchyService().removeFromHierarchy(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, childGeoObjectTypeCode, true);
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 addChild.
/**
* Creates a relationship between @parentUid and @childUid.
*
* @pre Both the parent and child have already been persisted / applied
* @post A relationship will exist between @parent and @child
*
* @returns ParentTreeNode The new node which was created with the provided
* parent.
* @param startDate TODO
* @param endDate TODO
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_ADD_CHILD)
public ResponseIF addChild(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_PARENTCODE, required = true) String parentCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_PARENT_TYPE_CODE, required = true) String parentTypeCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_CHILDCODE, required = true) String childCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_CHILD_TYPE_CODE, required = true) String childTypeCode, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_HIERARCHY_CODE, required = true) String hierarchyRef, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_START_DATE) String startDateString, @RequestParamter(name = RegistryUrls.GEO_OBJECT_ADD_CHILD_PARAM_END_DATE) String endDateString) {
Date startDate = (startDateString != null && startDateString.length() > 0) ? GeoRegistryUtil.parseDate(startDateString, true) : null;
Date endDate = (endDateString != null && endDateString.length() > 0) ? GeoRegistryUtil.parseDate(endDateString, true) : null;
ParentTreeNode pn = ServiceFactory.getGeoObjectService().addChild(request.getSessionId(), parentCode, parentTypeCode, childCode, childTypeCode, hierarchyRef, startDate, endDate);
return new RestBodyResponse(pn.toJSON());
}
use of com.runwaysdk.mvc.RestBodyResponse in project geoprism-registry by terraframe.
the class RegistryController method submitNewOrganization.
/**
* Submit new organization.
*
* @param sessionId
* @param json
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "orgainization/create")
public ResponseIF submitNewOrganization(ClientRequestIF request, @RequestParamter(name = "json", required = true) String json) {
OrganizationDTO org = this.registryService.createOrganization(request.getSessionId(), json);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(org.toJSON(serializer));
}
Aggregations