Search in sources :

Example 31 with GraphQuery

use of com.runwaysdk.business.graph.GraphQuery in project geoprism-registry by terraframe.

the class ExternalSystem method getReferencedDataCount.

public long getReferencedDataCount() {
    final MdEdgeDAOIF mdEdge = MdEdgeDAO.getMdEdgeDAO(GeoVertex.EXTERNAL_ID);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT COUNT(*) FROM " + mdEdge.getDBClassName());
    builder.append(" WHERE out = :system");
    final GraphQuery<Long> query = new GraphQuery<Long>(builder.toString());
    query.setParameter("system", this.getRID());
    return query.getSingleResult();
}
Also used : MdEdgeDAOIF(com.runwaysdk.dataaccess.MdEdgeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 32 with GraphQuery

use of com.runwaysdk.business.graph.GraphQuery in project geoprism-registry by terraframe.

the class FhirExternalSystem method getAll.

public static List<FhirExternalSystem> getAll() {
    final MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(FhirExternalSystem.CLASS);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT FROM " + mdVertex.getDBClassName());
    final GraphQuery<FhirExternalSystem> query = new GraphQuery<FhirExternalSystem>(builder.toString());
    return query.getResults();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 33 with GraphQuery

use of com.runwaysdk.business.graph.GraphQuery in project geoprism-registry by terraframe.

the class Transition method removeAll.

@Transaction
public static void removeAll(ServerGeoObjectType type) {
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(Transition.CLASS);
    MdAttributeDAOIF sourceAttribute = mdVertex.definesAttribute(Transition.SOURCE);
    MdAttributeDAOIF targetAttribute = mdVertex.definesAttribute(Transition.TARGET);
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FROM " + mdVertex.getDBClassName());
    statement.append(" WHERE " + sourceAttribute.getColumnName() + ".@class = :vertexClass");
    statement.append(" OR " + targetAttribute.getColumnName() + ".@class = :vertexClass");
    GraphQuery<Transition> query = new GraphQuery<Transition>(statement.toString());
    query.setParameter("vertexClass", type.getMdVertex().getDBClassName());
    List<Transition> results = query.getResults();
    results.forEach(event -> event.delete());
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 34 with GraphQuery

use of com.runwaysdk.business.graph.GraphQuery in project geoprism-registry by terraframe.

the class TransitionEvent method page.

public static Page<TransitionEvent> page(Integer pageSize, Integer pageNumber, String attrConditions) {
    Long count = getCount();
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(TransitionEvent.CLASS);
    MdAttributeDAOIF eventDate = mdVertex.definesAttribute(TransitionEvent.EVENTDATE);
    Map<String, Object> parameters = new HashMap<String, Object>();
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FROM " + mdVertex.getDBClassName());
    addPageWhereCriteria(statement, parameters, attrConditions);
    statement.append(" ORDER BY " + eventDate.getColumnName() + " DESC");
    statement.append(" SKIP " + ((pageNumber - 1) * pageSize) + " LIMIT " + pageSize);
    GraphQuery<TransitionEvent> query = new GraphQuery<TransitionEvent>(statement.toString(), parameters);
    return new Page<TransitionEvent>(count, pageNumber, pageSize, query.getResults());
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) HashMap(java.util.HashMap) JsonObject(com.google.gson.JsonObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) Page(net.geoprism.registry.view.Page) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Example 35 with GraphQuery

use of com.runwaysdk.business.graph.GraphQuery in project geoprism-registry by terraframe.

the class TransitionEvent method getTransitions.

public List<Transition> getTransitions() {
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(Transition.CLASS);
    MdAttributeDAOIF mdAttribute = mdVertex.definesAttribute(Transition.EVENT);
    // MdAttributeDAOIF sourceAttribute = mdVertex.definesAttribute(Transition.SOURCE);
    MdAttributeDAOIF targetAttribute = mdVertex.definesAttribute(Transition.TARGET);
    MdAttributeDAOIF orderAttribute = mdVertex.definesAttribute(Transition.ORDER);
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FROM " + mdVertex.getDBClassName());
    statement.append(" WHERE " + mdAttribute.getColumnName() + " = :event");
    statement.append(" ORDER BY " + orderAttribute.getColumnName() + " ASC");
    statement.append(", " + targetAttribute.getColumnName() + ".code");
    GraphQuery<Transition> query = new GraphQuery<Transition>(statement.toString());
    query.setParameter("event", this.getRID());
    List<Transition> results = query.getResults();
    return results;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Aggregations

GraphQuery (com.runwaysdk.business.graph.GraphQuery)55 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)34 VertexObject (com.runwaysdk.business.graph.VertexObject)29 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)23 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)17 EdgeObject (com.runwaysdk.business.graph.EdgeObject)16 LineString (com.vividsolutions.jts.geom.LineString)11 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)11 LinkedList (java.util.LinkedList)11 JsonObject (com.google.gson.JsonObject)10 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)9 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)9 HashedMap (org.apache.commons.collections4.map.HashedMap)8 JsonArray (com.google.gson.JsonArray)7 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)7 List (java.util.List)7 Page (net.geoprism.registry.view.Page)7 AbstractClassification (com.runwaysdk.system.AbstractClassification)6 HashMap (java.util.HashMap)6 Collectors (java.util.stream.Collectors)6