use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class Transition method getVertex.
private VertexServerGeoObject getVertex(String attributeName) {
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(Transition.CLASS);
MdAttributeDAOIF mdAttribute = mdVertex.definesAttribute(attributeName);
StringBuilder statement = new StringBuilder();
statement.append("SELECT expand(" + mdAttribute.getColumnName() + ")");
statement.append(" FROM :parent");
GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(statement.toString());
query.setParameter("parent", this.getRID());
VertexObject vertex = query.getSingleResult();
MdVertexDAOIF geoVertex = (MdVertexDAOIF) vertex.getMdClass();
ServerGeoObjectType type = ServerGeoObjectType.get(geoVertex);
return new VertexServerGeoObject(type, vertex);
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class TransitionEvent method removeAll.
@Transaction
public static void removeAll(ServerGeoObjectType type) {
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(TransitionEvent.CLASS);
MdAttributeDAOIF beforeTypeCode = mdVertex.definesAttribute(TransitionEvent.BEFORETYPECODE);
MdAttributeDAOIF afterTypeCode = mdVertex.definesAttribute(TransitionEvent.AFTERTYPECODE);
StringBuilder statement = new StringBuilder();
statement.append("SELECT FROM " + mdVertex.getDBClassName());
statement.append(" WHERE " + beforeTypeCode.getColumnName() + " = :typeCode OR " + afterTypeCode.getColumnName() + " = :typeCode");
GraphQuery<TransitionEvent> query = new GraphQuery<TransitionEvent>(statement.toString());
query.setParameter("typeCode", type.getCode());
List<TransitionEvent> results = query.getResults();
results.forEach(event -> event.delete());
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class TransitionEvent method getCount.
public static Long getCount() {
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(TransitionEvent.CLASS);
StringBuilder statement = new StringBuilder();
statement.append("SELECT COUNT(*) FROM " + mdVertex.getDBClassName());
GraphQuery<Long> query = new GraphQuery<Long>(statement.toString());
return query.getSingleResult();
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class PatchCodeMetadata method transaction.
@Transaction
private void transaction() {
MdAttributeDAOIF mdAttributeGeoId = MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS).definesAttribute("geoId");
if (mdAttributeGeoId != null) {
mdAttributeGeoId.getBusinessDAO().delete();
}
List<ServerGeoObjectType> types = ServiceFactory.getMetadataCache().getAllGeoObjectTypes();
types = types.stream().filter(t -> t.getIsAbstract()).collect(Collectors.toList());
for (ServerGeoObjectType type : types) {
MdVertexDAOIF mdVertex = type.getMdVertex();
if (mdVertex.definesAttribute(DefaultAttribute.CODE.getName()) != null) {
// Remove the code attribute
delete(type);
create(type);
}
}
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class PatchLastUpdateDate method doIt.
@Transaction
private void doIt() {
Date date = new Date();
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS);
MdAttributeDAOIF mdAttribute = mdVertex.definesAttribute(GeoVertex.LASTUPDATEDATE);
MdAttributeDAOIF createDate = mdVertex.definesAttribute(GeoVertex.CREATEDATE);
long pageSize = 1000;
long count = 0;
do {
StringBuilder builder = new StringBuilder();
builder.append("SELECT FROM " + mdVertex.getDBClassName());
builder.append(" WHERE " + mdAttribute.getColumnName() + " IS NULL");
builder.append(" OR " + createDate.getColumnName() + " IS NULL");
builder.append(" ORDER BY oid");
builder.append(" SKIP " + 0 + " LIMIT " + pageSize);
GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(builder.toString());
List<VertexObject> results = query.getResults();
for (VertexObject result : results) {
result.setValue(GeoVertex.LASTUPDATEDATE, date);
result.setValue(GeoVertex.CREATEDATE, date);
result.apply();
}
count = this.getCount();
} while (count > 0);
}
Aggregations