use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class DHIS2SynchronizationManager method getCount.
private long getCount(ServerGeoObjectType got) {
MdVertexDAOIF mdVertex = got.getMdVertex();
StringBuilder statement = new StringBuilder();
statement.append("SELECT COUNT(*) FROM " + mdVertex.getDBClassName());
return new GraphQuery<Long>(statement.toString()).getSingleResult();
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class DHIS2SynchronizationManager method query.
private List<VertexServerGeoObject> query(ServerGeoObjectType got, long skip, long pageSize) {
MdVertexDAOIF mdVertex = got.getMdVertex();
MdAttributeDAOIF mdAttribute = MdAttributeDAO.getByKey(GeoVertex.CLASS + "." + GeoVertex.LASTUPDATEDATE);
StringBuilder statement = new StringBuilder();
statement.append("SELECT FROM " + mdVertex.getDBClassName());
statement.append(" ORDER BY " + mdAttribute.getColumnName() + ", oid ASC");
statement.append(" SKIP " + skip + " LIMIT " + pageSize);
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(got, vObject);
vSGO.setDate(this.date);
response.add(vSGO);
}
return response;
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class GeoObjectJsonExporter method query.
public List<VertexServerGeoObject> query() {
MdVertexDAOIF mdVertex = got.getMdVertex();
MdAttributeDAOIF mdAttribute = MdAttributeDAO.getByKey(GeoVertex.CLASS + "." + GeoVertex.LASTUPDATEDATE);
StringBuilder statement = new StringBuilder();
statement.append("SELECT FROM " + mdVertex.getDBClassName());
if (this.since != null) {
statement.append(" WHERE " + mdAttribute.getColumnName() + " >= :lastUpdateDate");
}
statement.append(" ORDER BY " + mdAttribute.getColumnName() + ", oid ASC");
if (this.pageSize != null && this.pageNumber != null && this.pageSize != -1 && this.pageNumber != -1) {
statement.append(" SKIP " + ((pageNumber - 1) * pageSize) + " LIMIT " + this.pageSize);
}
GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(statement.toString());
if (this.since != null) {
query.setParameter("lastUpdateDate", this.since);
}
List<VertexObject> vObjects = query.getResults();
List<VertexServerGeoObject> response = new LinkedList<VertexServerGeoObject>();
for (VertexObject vObject : vObjects) {
VertexServerGeoObject vSGO = new VertexServerGeoObject(got, vObject);
vSGO.setDate(ValueOverTime.INFINITY_END_DATE);
response.add(vSGO);
}
return response;
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF in project geoprism-registry by terraframe.
the class BusinessObjectImporter method setTermValue.
protected void setTermValue(BusinessObject entity, AttributeType attributeType, String attributeName, Object value) {
if (!this.configuration.isExclusion(attributeName, value.toString())) {
try {
BusinessType type = this.configuration.getType();
MdVertexDAOIF mdBusiness = type.getMdVertexDAO();
MdAttributeTermDAOIF mdAttribute = (MdAttributeTermDAOIF) mdBusiness.definesAttribute(attributeName);
Classifier classifier = Classifier.findMatchingTerm(value.toString().trim(), mdAttribute);
if (classifier == null) {
Term rootTerm = ((AttributeTermType) attributeType).getRootTerm();
TermReferenceProblem trp = new TermReferenceProblem(value.toString(), rootTerm.getCode(), mdAttribute.getOid(), attributeName, attributeType.getLabel().getValue());
trp.addAffectedRowNumber(this.progressListener.getWorkProgress() + 1);
trp.setHistoryId(this.configuration.getHistoryId());
this.progressListener.addReferenceProblem(trp);
} else {
entity.setValue(attributeName, classifier.getOid());
}
} catch (UnknownTermException e) {
TermValueException ex = new TermValueException();
ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
ex.setCode(e.getCode());
throw e;
}
}
}
use of com.runwaysdk.dataaccess.MdVertexDAOIF 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;
}
Aggregations