Search in sources :

Example 21 with VertexFrame

use of com.tinkerpop.frames.VertexFrame in project org.openntf.domino by OpenNTF.

the class MixedFramedVertexList method applyFilter.

public MixedFramedVertexList applyFilter(final String key, final Object value) {
    DVertexList vertList = new DVertexList((DVertex) sourceVertex_);
    if (this.size() > 0) {
        for (Object raw : this) {
            VertexFrame vertex = (VertexFrame) raw;
            try {
                if ("@type".equals(key)) {
                    if (DGraphUtils.isType(vertex, TypeUtils.toString(value))) {
                        vertList.add((DVertex) vertex.asVertex());
                    }
                } else {
                    Object vertexVal = DGraphUtils.getFramedProperty(getGraph(), vertex, key);
                    if (vertexVal instanceof Collection) {
                        for (Object rawVal : (Collection) vertexVal) {
                            if (value.equals(TypeUtils.toString(rawVal))) {
                                vertList.add((DVertex) vertex.asVertex());
                            }
                        }
                    } else {
                        if (value.equals(TypeUtils.toString(vertexVal))) {
                            vertList.add((DVertex) vertex.asVertex());
                        }
                    }
                }
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    }
    MixedFramedVertexList result = new MixedFramedVertexList(getGraph(), sourceVertex_, vertList);
    return result;
}
Also used : VertexFrame(com.tinkerpop.frames.VertexFrame) Collection(java.util.Collection) DVertexList(org.openntf.domino.graph2.impl.DVertexList)

Example 22 with VertexFrame

use of com.tinkerpop.frames.VertexFrame in project org.openntf.domino by OpenNTF.

the class MixedFramedVertexList method set.

@Override
public Object set(final int arg0, final Object arg1) {
    if (arg1 instanceof VertexFrame) {
        Vertex v = ((VertexFrame) arg1).asVertex();
        list_.set(arg0, v);
        return arg1;
    } else {
        return null;
    }
}
Also used : DVertex(org.openntf.domino.graph2.impl.DVertex) Vertex(com.tinkerpop.blueprints.Vertex) VertexFrame(com.tinkerpop.frames.VertexFrame)

Aggregations

VertexFrame (com.tinkerpop.frames.VertexFrame)22 EdgeFrame (com.tinkerpop.frames.EdgeFrame)14 DVertexFrame (org.openntf.domino.graph2.builtin.DVertexFrame)13 JsonJavaObject (com.ibm.commons.util.io.json.JsonJavaObject)12 CaseInsensitiveString (org.openntf.domino.types.CaseInsensitiveString)12 Vertex (com.tinkerpop.blueprints.Vertex)11 UserAccessException (org.openntf.domino.exceptions.UserAccessException)9 DEdgeFrame (org.openntf.domino.graph2.builtin.DEdgeFrame)9 LinkedHashMap (java.util.LinkedHashMap)8 Edge (com.tinkerpop.blueprints.Edge)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 JsonObject (com.ibm.commons.util.io.json.JsonObject)6 Method (java.lang.reflect.Method)6 NoteCoordinate (org.openntf.domino.big.NoteCoordinate)6 DVertex (org.openntf.domino.graph2.impl.DVertex)6 List (java.util.List)5 DbInfoVertex (org.openntf.domino.graph2.builtin.DbInfoVertex)5 ViewVertex (org.openntf.domino.graph2.builtin.ViewVertex)5 DEdge (org.openntf.domino.graph2.impl.DEdge)5