Search in sources :

Example 41 with MdVertexDAOIF

use of com.runwaysdk.dataaccess.MdVertexDAOIF 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 42 with MdVertexDAOIF

use of com.runwaysdk.dataaccess.MdVertexDAOIF 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 43 with MdVertexDAOIF

use of com.runwaysdk.dataaccess.MdVertexDAOIF 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)

Example 44 with MdVertexDAOIF

use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.

the class TransitionEvent method getAll.

public static List<TransitionEvent> getAll(ServerGeoObjectType type) {
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(TransitionEvent.CLASS);
    MdAttributeDAOIF beforeTypeCode = mdVertex.definesAttribute(TransitionEvent.BEFORETYPECODE);
    MdAttributeDAOIF afterTypeCode = mdVertex.definesAttribute(TransitionEvent.AFTERTYPECODE);
    List<ServerGeoObjectType> types = new LinkedList<ServerGeoObjectType>();
    types.add(type);
    types.addAll(type.getSubtypes());
    List<String> codes = types.stream().map(t -> type.getCode()).collect(Collectors.toList());
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FROM " + mdVertex.getDBClassName());
    statement.append(" WHERE (" + beforeTypeCode.getColumnName() + " IN :typeCode");
    statement.append(" OR " + afterTypeCode.getColumnName() + " IN :typeCode )");
    GraphQuery<TransitionEvent> query = new GraphQuery<TransitionEvent>(statement.toString());
    query.setParameter("typeCode", codes);
    return query.getResults();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) JsonObject(com.google.gson.JsonObject) StringUtils(org.apache.commons.lang.StringUtils) TransitionImpact(net.geoprism.registry.graph.transition.Transition.TransitionImpact) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Date(java.util.Date) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonParser(com.google.gson.JsonParser) GeoObjectPermissionService(net.geoprism.registry.permission.GeoObjectPermissionService) GsonBuilder(com.google.gson.GsonBuilder) ServiceFactory(net.geoprism.registry.service.ServiceFactory) ArrayList(java.util.ArrayList) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) GeoObjectTypeRestrictionUtil(net.geoprism.registry.query.graph.GeoObjectTypeRestrictionUtil) Map(java.util.Map) ParseException(java.text.ParseException) LinkedList(java.util.LinkedList) TransitionPermissionService(net.geoprism.registry.transition.TransitionPermissionService) JsonSerializable(net.geoprism.registry.view.JsonSerializable) DateFormat(java.text.DateFormat) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) Optional(org.commongeoregistry.adapter.Optional) GraphQuery(com.runwaysdk.business.graph.GraphQuery) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) RoleDAOIF(com.runwaysdk.business.rbac.RoleDAOIF) GeoRegistryUtil(net.geoprism.registry.GeoRegistryUtil) TransitionType(net.geoprism.registry.graph.transition.Transition.TransitionType) Collectors(java.util.stream.Collectors) MdVertexDAO(com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO) Page(net.geoprism.registry.view.Page) MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) List(java.util.List) JsonArray(com.google.gson.JsonArray) SingleActorDAOIF(com.runwaysdk.business.rbac.SingleActorDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) Session(com.runwaysdk.session.Session) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GraphQuery(com.runwaysdk.business.graph.GraphQuery) LinkedList(java.util.LinkedList)

Example 45 with MdVertexDAOIF

use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.

the class PatchLastUpdateDate method getCount.

public long getCount() {
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS);
    MdAttributeDAOIF mdAttribute = mdVertex.definesAttribute(GeoVertex.LASTUPDATEDATE);
    MdAttributeDAOIF createDate = mdVertex.definesAttribute(GeoVertex.CREATEDATE);
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT COUNT(*) FROM " + mdVertex.getDBClassName());
    builder.append(" WHERE " + mdAttribute.getColumnName() + " IS NULL");
    builder.append(" OR " + createDate.getColumnName() + " IS NULL");
    final GraphQuery<Long> query = new GraphQuery<Long>(builder.toString());
    return query.getSingleResult();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GraphQuery(com.runwaysdk.business.graph.GraphQuery)

Aggregations

MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)62 GraphQuery (com.runwaysdk.business.graph.GraphQuery)34 VertexObject (com.runwaysdk.business.graph.VertexObject)30 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)26 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)24 EdgeObject (com.runwaysdk.business.graph.EdgeObject)16 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)12 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)11 Date (java.util.Date)10 LinkedList (java.util.LinkedList)9 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)8 JsonObject (com.google.gson.JsonObject)7 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)7 HashedMap (org.apache.commons.collections4.map.HashedMap)7 HashMap (java.util.HashMap)5 TreeSet (java.util.TreeSet)5 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)5 GraphObject (com.runwaysdk.business.graph.GraphObject)4 MdVertexDAO (com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO)4 LineString (com.vividsolutions.jts.geom.LineString)4