use of net.geoprism.registry.model.ServerChildTreeNode in project geoprism-registry by terraframe.
the class VertexServerGeoObject method internalGetChildGeoObjects.
private static ServerChildTreeNode internalGetChildGeoObjects(VertexServerGeoObject parent, String[] childrenTypes, Boolean recursive, ServerHierarchyType htIn, Date date) {
ServerChildTreeNode tnRoot = new ServerChildTreeNode(parent, htIn, date, null, null);
Map<String, Object> parameters = new HashedMap<String, Object>();
parameters.put("rid", parent.getVertex().getRID());
StringBuilder statement = new StringBuilder();
statement.append("SELECT EXPAND(outE(");
if (htIn != null) {
statement.append("'" + htIn.getMdEdge().getDBClassName() + "'");
}
statement.append(")");
if (childrenTypes != null && childrenTypes.length > 0) {
statement.append("[");
for (int i = 0; i < childrenTypes.length; i++) {
ServerGeoObjectType type = ServerGeoObjectType.get(childrenTypes[i]);
final String paramName = "p" + Integer.toString(i);
if (i > 0) {
statement.append(" OR ");
}
statement.append("in.@class = :" + paramName);
parameters.put(paramName, type.getMdVertex().getDBClassName());
}
statement.append("]");
}
statement.append(") FROM :rid");
GraphQuery<EdgeObject> query = new GraphQuery<EdgeObject>(statement.toString(), parameters);
List<EdgeObject> edges = query.getResults();
for (EdgeObject edge : edges) {
MdEdgeDAOIF mdEdge = (MdEdgeDAOIF) edge.getMdClass();
if (HierarchicalRelationshipType.isEdgeAHierarchyType(mdEdge)) {
VertexObject childVertex = edge.getChild();
MdVertexDAOIF mdVertex = (MdVertexDAOIF) childVertex.getMdClass();
ServerHierarchyType ht = ServerHierarchyType.get(mdEdge);
ServerGeoObjectType childType = ServerGeoObjectType.get(mdVertex);
VertexServerGeoObject child = new VertexServerGeoObject(childType, childVertex, date);
ServerChildTreeNode tnChild;
if (recursive) {
tnChild = internalGetChildGeoObjects(child, childrenTypes, recursive, ht, date);
} else {
tnChild = new ServerChildTreeNode(child, ht, date, null, edge.getOid());
}
tnRoot.addChild(tnChild);
}
}
return tnRoot;
}
use of net.geoprism.registry.model.ServerChildTreeNode in project geoprism-registry by terraframe.
the class RegistryService method getChildGeoObjects.
@Request(RequestType.SESSION)
public ChildTreeNode getChildGeoObjects(String sessionId, String parentCode, String parentGeoObjectTypeCode, String[] childrenTypes, Boolean recursive, Date date) {
ServerGeoObjectIF object = this.service.getGeoObjectByCode(parentCode, parentGeoObjectTypeCode, true);
if (date != null) {
object.setDate(date);
}
ServerChildTreeNode node = object.getChildGeoObjects(childrenTypes, recursive, date);
return node.toNode(true);
}
use of net.geoprism.registry.model.ServerChildTreeNode in project geoprism-registry by terraframe.
the class LocationInformation method setChildren.
public void setChildren(List<ServerChildTreeNode> nodes, Date date) {
this.children = new LinkedList<GeoObject>();
for (ServerChildTreeNode node : nodes) {
GeoObject geoObject = node.getGeoObject().toGeoObject(date);
this.children.add(geoObject);
}
}
Aggregations