Search in sources :

Example 6 with VertexObject

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;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphQuery(com.runwaysdk.business.graph.GraphQuery) LinkedList(java.util.LinkedList)

Example 7 with VertexObject

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;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GraphQuery(com.runwaysdk.business.graph.GraphQuery) LinkedList(java.util.LinkedList)

Example 8 with VertexObject

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;
        }
    }
}
Also used : MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) TermValueException(net.geoprism.registry.io.TermValueException) VertexObject(com.runwaysdk.business.graph.VertexObject) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MdAttributeClassificationDAOIF(com.runwaysdk.dataaccess.MdAttributeClassificationDAOIF) UnknownTermException(org.commongeoregistry.adapter.dataaccess.UnknownTermException)

Example 9 with VertexObject

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);
    }
}
Also used : VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Example 10 with VertexObject

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;
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject)

Aggregations

VertexObject (com.runwaysdk.business.graph.VertexObject)53 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)29 GraphQuery (com.runwaysdk.business.graph.GraphQuery)28 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)23 EdgeObject (com.runwaysdk.business.graph.EdgeObject)20 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)18 LinkedList (java.util.LinkedList)10 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)9 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)8 Date (java.util.Date)8 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)7 AbstractClassification (com.runwaysdk.system.AbstractClassification)7 HashedMap (org.apache.commons.collections4.map.HashedMap)7 JsonObject (com.google.gson.JsonObject)6 List (java.util.List)6 AttributeClassificationType (org.commongeoregistry.adapter.metadata.AttributeClassificationType)6 JsonArray (com.google.gson.JsonArray)5 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)5 LineString (com.vividsolutions.jts.geom.LineString)5 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)5