Search in sources :

Example 1 with VertexObjectDAOIF

use of com.runwaysdk.dataaccess.graph.VertexObjectDAOIF in project geoprism-registry by terraframe.

the class SearchService method insert.

// @Transaction
public void insert(VertexServerGeoObject object) {
    this.remove(object.getCode());
    String suffix = this.getSuffix();
    MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(PACKAGE + "." + VERTEX_PREFIX + suffix);
    MdEdgeDAOIF mdEdge = MdEdgeDAO.getMdEdgeDAO(PACKAGE + "." + EDGE_PREFIX + suffix);
    ValueOverTimeCollection vots = object.getValuesOverTime(DefaultAttribute.DISPLAY_LABEL.getName());
    for (ValueOverTime vot : vots) {
        VertexObjectDAOIF value = (VertexObjectDAOIF) vot.getValue();
        Set<String> attributeNames = LocalizationService.getLocaleNames();
        for (String attributeName : attributeNames) {
            String label = value.getObjectValue(attributeName);
            if (label != null && label.length() > 0) {
                VertexObject vertex = new VertexObject(mdVertex.definesType());
                vertex.setValue(START_DATE, vot.getStartDate());
                vertex.setValue(END_DATE, vot.getEndDate());
                vertex.setValue(CODE, object.getCode());
                vertex.setValue(LABEL, label);
                vertex.setValue(VERTEX_TYPE, object.getType().getCode());
                vertex.apply();
                vertex.addChild(object.getVertex(), mdEdge).apply();
            }
        }
    }
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) MdEdgeDAOIF(com.runwaysdk.dataaccess.MdEdgeDAOIF) VertexObjectDAOIF(com.runwaysdk.dataaccess.graph.VertexObjectDAOIF) VertexObject(com.runwaysdk.business.graph.VertexObject) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)

Aggregations

VertexObject (com.runwaysdk.business.graph.VertexObject)1 MdEdgeDAOIF (com.runwaysdk.dataaccess.MdEdgeDAOIF)1 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)1 VertexObjectDAOIF (com.runwaysdk.dataaccess.graph.VertexObjectDAOIF)1 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)1 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)1