use of com.runwaysdk.business.graph.VertexObject 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.business.graph.VertexObject 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.business.graph.VertexObject in project geoprism-registry by terraframe.
the class GeoObjectImporter method setClassificationValue.
protected void setClassificationValue(ServerGeoObjectIF entity, AttributeType attributeType, String attributeName, Object value, Date startDate, Date endDate) {
if (!this.configuration.isExclusion(attributeName, value.toString())) {
try {
ServerGeoObjectType type = this.configuration.getType();
MdBusinessDAOIF mdBusiness = type.getMdBusinessDAO();
MdAttributeClassificationDAOIF mdAttribute = (MdAttributeClassificationDAOIF) mdBusiness.definesAttribute(attributeName);
if (mdAttribute == null && type.getSuperType() != null) {
mdAttribute = (MdAttributeClassificationDAOIF) type.getSuperType().getMdBusinessDAO().definesAttribute(attributeName);
}
VertexObject classifier = AbstractClassification.findMatchingClassification(value.toString().trim(), mdAttribute);
if (classifier == null) {
throw new UnknownTermException(value.toString().trim(), attributeType);
// Term rootClassification = ( (AttributeClassificationType) attributeType ).getRootTerm();
//
// TermReferenceProblem trp = new TermReferenceProblem(value.toString(), rootClassification.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(), startDate, endDate);
}
} catch (UnknownTermException e) {
TermValueException ex = new TermValueException();
ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
ex.setCode(e.getCode());
throw e;
}
}
}
use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class BusinessObject method setGeoObject.
public void setGeoObject(ServerGeoObjectIF geoObject) {
if (geoObject instanceof VertexServerGeoObject) {
VertexObject geoVertex = ((VertexServerGeoObject) geoObject).getVertex();
this.vertex.setValue(BusinessType.GEO_OBJECT, geoVertex);
}
}
use of com.runwaysdk.business.graph.VertexObject 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