use of net.geoprism.registry.conversion.ServerGeoObjectStrategyIF in project geoprism-registry by terraframe.
the class ServerGeoObjectService method getGeoObject.
public ServerGeoObjectIF getGeoObject(String uid, String typeCode) {
ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
this.permissionService.enforceCanRead(type.getOrganization().getCode(), type);
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
ServerGeoObjectIF object = strategy.getGeoObjectByUid(uid);
if (object == null) {
InvalidRegistryIdException ex = new InvalidRegistryIdException();
ex.setRegistryId(uid);
throw ex;
}
return object;
}
use of net.geoprism.registry.conversion.ServerGeoObjectStrategyIF in project geoprism-registry by terraframe.
the class ServerGeoObjectService method apply.
@Transaction
public ServerGeoObjectIF apply(GeoObject object, Date startDate, Date endDate, boolean isNew, boolean isImport) {
ServerGeoObjectType type = ServerGeoObjectType.get(object.getType());
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
if (isNew) {
permissionService.enforceCanCreate(type.getOrganization().getCode(), type);
} else {
permissionService.enforceCanWrite(type.getOrganization().getCode(), type);
}
ServerGeoObjectIF geoObject = strategy.constructFromGeoObject(object, isNew);
geoObject.setDate(startDate);
if (!isNew) {
geoObject.lock();
}
geoObject.populate(object, startDate, endDate);
try {
geoObject.apply(isImport);
// Return the refreshed copy of the geoObject
return this.build(type, geoObject.getRunwayId());
} catch (DuplicateDataException e) {
VertexServerGeoObject.handleDuplicateDataException(type, e);
throw e;
}
}
use of net.geoprism.registry.conversion.ServerGeoObjectStrategyIF in project geoprism-registry by terraframe.
the class ServerGeoObjectService method getGeoObject.
public ServerGeoObjectIF getGeoObject(GeoObject go) {
ServerGeoObjectType type = ServerGeoObjectType.get(go.getType());
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
return strategy.constructFromGeoObject(go, false);
}
use of net.geoprism.registry.conversion.ServerGeoObjectStrategyIF in project geoprism-registry by terraframe.
the class ServerGeoObjectService method getGeoObject.
public ServerGeoObjectIF getGeoObject(GeoObjectOverTime timeGO) {
ServerGeoObjectType type = ServerGeoObjectType.get(timeGO.getType());
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
return strategy.constructFromGeoObjectOverTime(timeGO, false);
}
use of net.geoprism.registry.conversion.ServerGeoObjectStrategyIF in project geoprism-registry by terraframe.
the class ServerParentGraphNode method fromJSON.
public static ServerParentGraphNode fromJSON(JsonObject jo) {
ServerGeoObjectIF goif = null;
if (jo.has(TreeNode.JSON_GEO_OBJECT)) {
GeoObject go = GeoObject.fromJSON(ServiceFactory.getAdapter(), jo.get(TreeNode.JSON_GEO_OBJECT).toString());
ServerGeoObjectType type = ServerGeoObjectType.get(go.getType());
ServerGeoObjectStrategyIF strategy = new ServerGeoObjectService().getStrategy(type);
goif = strategy.constructFromGeoObject(go, false);
}
GraphType graphType = null;
if (jo.has("graphType")) {
String graphCode = jo.get("graphType").getAsString();
String graphTypeClass = jo.get("graphTypeClass").getAsString();
graphType = GraphType.getByCode(graphTypeClass, graphCode);
}
Date startDate = null;
if (jo.has("startDate")) {
startDate = GeoRegistryUtil.parseDate(jo.get("startDate").getAsString());
}
Date endDate = null;
if (jo.has("endDate")) {
endDate = GeoRegistryUtil.parseDate(jo.get("startDate").getAsString());
}
String oid = null;
if (jo.has("oid")) {
oid = jo.get("oid").getAsString();
}
ServerParentGraphNode node = new ServerParentGraphNode(goif, graphType, startDate, endDate, oid);
if (jo.has(ParentTreeNode.JSON_PARENTS)) {
JsonArray jaParents = jo.get(ParentTreeNode.JSON_PARENTS).getAsJsonArray();
for (int i = 0; i < jaParents.size(); ++i) {
node.addParent(ServerParentGraphNode.fromJSON(jaParents.get(i).getAsJsonObject()));
}
}
return node;
}
Aggregations