Search in sources :

Example 11 with MdVertexDAOIF

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();
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF)

Example 12 with MdVertexDAOIF

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;
}
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 13 with MdVertexDAOIF

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;
}
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 14 with MdVertexDAOIF

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;
        }
    }
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) TermValueException(net.geoprism.registry.io.TermValueException) BusinessType(net.geoprism.registry.BusinessType) MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) Classifier(net.geoprism.ontology.Classifier) Term(org.commongeoregistry.adapter.Term) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) TermReferenceProblem(net.geoprism.registry.etl.TermReferenceProblem) UnknownTermException(org.commongeoregistry.adapter.dataaccess.UnknownTermException)

Example 15 with MdVertexDAOIF

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

Aggregations

MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)62 GraphQuery (com.runwaysdk.business.graph.GraphQuery)34 VertexObject (com.runwaysdk.business.graph.VertexObject)30 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)26 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)24 EdgeObject (com.runwaysdk.business.graph.EdgeObject)16 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)12 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)11 Date (java.util.Date)10 LinkedList (java.util.LinkedList)9 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)8 JsonObject (com.google.gson.JsonObject)7 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)7 HashedMap (org.apache.commons.collections4.map.HashedMap)7 HashMap (java.util.HashMap)5 TreeSet (java.util.TreeSet)5 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)5 GraphObject (com.runwaysdk.business.graph.GraphObject)4 MdVertexDAO (com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO)4 LineString (com.vividsolutions.jts.geom.LineString)4