Search in sources :

Example 16 with VertexServerGeoObject

use of net.geoprism.registry.model.graph.VertexServerGeoObject in project geoprism-registry by terraframe.

the class BusinessObject method getGeoObject.

public VertexServerGeoObject getGeoObject() {
    String oid = this.vertex.getObjectValue(BusinessType.GEO_OBJECT);
    if (oid != null) {
        VertexObject geoVertex = VertexObject.get(GeoVertex.CLASS, oid);
        MdVertexDAOIF mdVertex = (MdVertexDAOIF) geoVertex.getMdClass();
        ServerGeoObjectType vertexType = ServerGeoObjectType.get(mdVertex);
        return new VertexServerGeoObject(vertexType, geoVertex);
    }
    return null;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 17 with VertexServerGeoObject

use of net.geoprism.registry.model.graph.VertexServerGeoObject in project geoprism-registry by terraframe.

the class VertexGeoObjectQuery method getResults.

public List<ServerGeoObjectIF> getResults() {
    List<ServerGeoObjectIF> list = new LinkedList<ServerGeoObjectIF>();
    GraphQuery<VertexObject> query = this.getQuery();
    List<VertexObject> results = query.getResults();
    for (VertexObject result : results) {
        list.add(new VertexServerGeoObject(type, result, this.date));
    }
    return list;
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) LinkedList(java.util.LinkedList)

Example 18 with VertexServerGeoObject

use of net.geoprism.registry.model.graph.VertexServerGeoObject in project geoprism-registry by terraframe.

the class VertexSelectGeoObjectQuery method getSingleResult.

public ServerGeoObjectIF getSingleResult() {
    GraphQuery<VertexObject> query = this.getQuery();
    VertexObject vertex = query.getSingleResult();
    if (vertex != null) {
        return new VertexServerGeoObject(type, vertex, this.date);
    }
    return null;
}
Also used : VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 19 with VertexServerGeoObject

use of net.geoprism.registry.model.graph.VertexServerGeoObject in project geoprism-registry by terraframe.

the class VertexSelectGeoObjectQuery method getResults.

public List<VertexServerGeoObject> getResults() {
    List<VertexServerGeoObject> list = new LinkedList<VertexServerGeoObject>();
    GraphQuery<VertexObject> query = this.getQuery();
    List<VertexObject> results = query.getResults();
    for (VertexObject result : results) {
        list.add(new VertexServerGeoObject(type, result, this.date));
    }
    return list;
}
Also used : VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) LinkedList(java.util.LinkedList)

Example 20 with VertexServerGeoObject

use of net.geoprism.registry.model.graph.VertexServerGeoObject in project geoprism-registry by terraframe.

the class LocationService method getGeoObjects.

// @Request(RequestType.SESSION)
// public LocationInformation getLocationInformation(String sessionId, String code, String typeCode, Date date, String childTypeCode, String hierarchyCode)
// {
// LocationInformation information = new LocationInformation();
// 
// ServerGeoObjectIF go = this.service.getGeoObjectByCode(code, typeCode);
// go.setDate(date);
// 
// ServerGeoObjectType type = go.getType();
// List<ServerHierarchyType> hierarchies = type.getHierarchies();
// 
// ServerHierarchyType hierarchy = null;
// 
// if (hierarchyCode == null || hierarchyCode.length() == 0)
// {
// hierarchy = hierarchies.get(0);
// }
// else
// {
// hierarchy = ServerHierarchyType.get(hierarchyCode);
// }
// 
// List<ServerGeoObjectType> childTypes = type.getChildren(hierarchy);
// ServerGeoObjectType childType = null;
// 
// if (childTypes.size() > 0)
// {
// /*
// * If a typeCode is given and it is an option based on the hierarchy than
// * use that type otherwise use the first type code
// */
// childType = childTypes.get(0);
// 
// if (childTypeCode != null && childTypeCode.length() > 0)
// {
// for (ServerGeoObjectType child : childTypes)
// {
// if (child.getCode().equals(childTypeCode))
// {
// childType = child;
// }
// }
// }
// }
// 
// if (childType != null)
// {
// information.setChildType(childType.getType());
// 
// List<VertexServerGeoObject> children = this.getGeoObjects(go.getCode(), childType.getCode(), hierarchy.getCode(), date);
// 
// for (VertexServerGeoObject child : children)
// {
// information.addChild(child.toGeoObject());
// }
// }
// 
// information.setChildTypes(childTypes);
// information.setHierarchies(hierarchies);
// information.setHierarchy(hierarchy.getCode());
// information.setEntity(go.toGeoObject());
// 
// return information;
// }
// @Request(RequestType.SESSION)
// public JsonObject getChildrenGeoJson(String sessionId, String typeCode,
// String parentId, String hierarchyCode)
// {
// List<VertexServerGeoObject> children = parentId != null ?
// this.getGeoObjects(typeCode, parentId, hierarchyCode) :
// this.getGeoObjects(typeCode);
// 
// return children;
// }
private List<VertexServerGeoObject> getGeoObjects(String typeCode, Date date) {
    ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    MdVertexDAOIF mdVertex = type.getMdVertex();
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FROM " + mdVertex.getDBClassName());
    statement.append(" ORDER BY code");
    GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(statement.toString());
    List<VertexObject> vObjects = query.getResults();
    List<VertexServerGeoObject> response = new LinkedList<VertexServerGeoObject>();
    for (VertexObject vObject : vObjects) {
        VertexServerGeoObject vSGO = new VertexServerGeoObject(type, vObject);
        vSGO.setDate(date);
        response.add(vSGO);
    }
    return response;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphQuery(com.runwaysdk.business.graph.GraphQuery) LinkedList(java.util.LinkedList)

Aggregations

VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)51 VertexObject (com.runwaysdk.business.graph.VertexObject)20 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)19 JsonObject (com.google.gson.JsonObject)18 Request (com.runwaysdk.session.Request)13 Date (java.util.Date)12 LinkedList (java.util.LinkedList)11 ChangeRequest (net.geoprism.registry.action.ChangeRequest)11 JsonArray (com.google.gson.JsonArray)10 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)10 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)10 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)9 GraphQuery (com.runwaysdk.business.graph.GraphQuery)8 UpdateAttributeAction (net.geoprism.registry.action.geoobject.UpdateAttributeAction)8 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)8 QueryFactory (com.runwaysdk.query.QueryFactory)6 SimpleDateFormat (java.text.SimpleDateFormat)6 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)6 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)6 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)5