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());
}
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());
}
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;
}
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();
}
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();
}
Aggregations