Search in sources :

Example 1 with ServerChildTreeNode

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;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) MdEdgeDAOIF(com.runwaysdk.dataaccess.MdEdgeDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) EdgeObject(com.runwaysdk.business.graph.EdgeObject) ServerChildTreeNode(net.geoprism.registry.model.ServerChildTreeNode) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) LineString(com.vividsolutions.jts.geom.LineString) MultiPoint(com.vividsolutions.jts.geom.MultiPoint) Point(com.vividsolutions.jts.geom.Point) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) VertexObject(com.runwaysdk.business.graph.VertexObject) EdgeObject(com.runwaysdk.business.graph.EdgeObject) AbstractServerGeoObject(net.geoprism.registry.model.AbstractServerGeoObject) GraphObject(com.runwaysdk.business.graph.GraphObject) HashedMap(org.apache.commons.collections4.map.HashedMap) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 2 with ServerChildTreeNode

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);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerChildTreeNode(net.geoprism.registry.model.ServerChildTreeNode) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Example 3 with ServerChildTreeNode

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);
    }
}
Also used : GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) ServerChildTreeNode(net.geoprism.registry.model.ServerChildTreeNode)

Aggregations

ServerChildTreeNode (net.geoprism.registry.model.ServerChildTreeNode)3 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)2 EdgeObject (com.runwaysdk.business.graph.EdgeObject)1 GraphObject (com.runwaysdk.business.graph.GraphObject)1 GraphQuery (com.runwaysdk.business.graph.GraphQuery)1 VertexObject (com.runwaysdk.business.graph.VertexObject)1 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)1 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)1 Request (com.runwaysdk.session.Request)1 LineString (com.vividsolutions.jts.geom.LineString)1 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)1 MultiPoint (com.vividsolutions.jts.geom.MultiPoint)1 Point (com.vividsolutions.jts.geom.Point)1 AbstractServerGeoObject (net.geoprism.registry.model.AbstractServerGeoObject)1 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)1 HashedMap (org.apache.commons.collections4.map.HashedMap)1 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)1