use of org.commongeoregistry.adapter.metadata.CustomSerializer in project geoprism-registry by terraframe.
the class RegistryController method updateGeoObjectOverTime.
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_TIME_UPDATE)
public ResponseIF updateGeoObjectOverTime(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_TIME_UPDATE_PARAM_GEOOBJECT) String jGeoObj) {
GeoObjectOverTime goTime = this.registryService.updateGeoObjectOverTime(request.getSessionId(), jGeoObj);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(goTime.toJSON(serializer));
}
use of org.commongeoregistry.adapter.metadata.CustomSerializer in project geoprism-registry by terraframe.
the class RegistryController method getGeoObjectByCode.
/**
* Returns a GeoObject with the given code.
*
* @pre @post
*
* @param uid
* The UID of the GeoObject.
*
* @returns a GeoObject in GeoJSON format with the given uid. @throws
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = RegistryUrls.GEO_OBJECT_GET_CODE)
public ResponseIF getGeoObjectByCode(ClientRequestIF request, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_CODE) String code, @RequestParamter(name = RegistryUrls.GEO_OBJECT_GET_CODE_PARAM_TYPE_CODE) String typeCode, @RequestParamter(name = "date") String date) throws JSONException {
GeoObject geoObject = this.registryService.getGeoObjectByCode(request.getSessionId(), code, typeCode, GeoRegistryUtil.parseDate(date, true));
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(geoObject.toJSON(serializer));
}
use of org.commongeoregistry.adapter.metadata.CustomSerializer in project geoprism-registry by terraframe.
the class RegistryLocationController method search.
@Endpoint(error = ErrorSerialization.JSON)
public ResponseIF search(ClientRequestIF request, @RequestParamter(name = "text") String text, @RequestParamter(name = "date") String date) throws JSONException, ParseException {
List<GeoObject> results = service.search(request.getSessionId(), text, parseDate(date));
CustomSerializer serializer = ServiceFactory.getRegistryService().serializer(request.getSessionId());
JsonArray features = results.stream().collect(() -> new JsonArray(), (array, element) -> array.add(element.toJSON(serializer)), (listA, listB) -> {
});
JsonObject featureCollection = new JsonObject();
featureCollection.addProperty("type", "FeatureCollection");
featureCollection.add("features", features);
return new RestBodyResponse(featureCollection);
}
use of org.commongeoregistry.adapter.metadata.CustomSerializer in project geoprism-registry by terraframe.
the class HierarchyController method insertBetweenTypes.
/**
* Inserts the {@link GeoObjectType} 'middleGeoObjectTypeCode' into the
* hierarchy as the child of 'parentGeoObjectTypeCode' and the new parent for
* 'youngestGeoObjectTypeCode'. If an existing parent/child relationship
* already exists between 'youngestGeoObjectTypeCode' and
* 'parentgeoObjectTypeCode', it will first be removed.
*
* @param sessionId
* @param hierarchyTypeCode
* code of the {@link HierarchyType}
* @param parentGeoObjectTypeCode
* parent {@link GeoObjectType}.
* @param middleGeoObjectTypeCode
* middle child {@link GeoObjectType} after this method returns
* @param youngestGeoObjectTypeCode
* youngest child {@link GeoObjectType} after this method returns
*/
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "insertBetweenTypes")
public ResponseIF insertBetweenTypes(ClientRequestIF request, @RequestParamter(name = "hierarchyCode", required = true) String hierarchyCode, @RequestParamter(name = "parentGeoObjectTypeCode", required = true) String parentGeoObjectTypeCode, @RequestParamter(name = "middleGeoObjectTypeCode", required = true) String middleGeoObjectTypeCode, @RequestParamter(name = "youngestGeoObjectTypeCode", required = true) String youngestGeoObjectTypeCode) {
HierarchyType ht = ServiceFactory.getHierarchyService().insertBetweenTypes(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, middleGeoObjectTypeCode, youngestGeoObjectTypeCode);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(ht.toJSON(serializer));
}
use of org.commongeoregistry.adapter.metadata.CustomSerializer in project geoprism-registry by terraframe.
the class HierarchyController method addToHierarchy.
/**
* Adds the {@link GeoObjectType} with the given child code to 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.POST, error = ErrorSerialization.JSON, url = "add")
public ResponseIF addToHierarchy(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().addToHierarchy(request.getSessionId(), hierarchyCode, parentGeoObjectTypeCode, childGeoObjectTypeCode);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(ht.toJSON(serializer));
}
Aggregations