Search in sources :

Example 16 with DGraph

use of org.openntf.domino.graph2.impl.DGraph in project org.openntf.domino by OpenNTF.

the class DFramedTransactionalGraph method getFilteredElementsPartial.

public <F> Iterable<F> getFilteredElementsPartial(final String classname, final List<CharSequence> keys, final List<CaseInsensitiveString> values) {
    // System.out.println("Getting a filtered list of elements of type " + classname);
    org.openntf.domino.graph2.DElementStore store = null;
    DGraph base = (DGraph) this.getBaseGraph();
    Class<?> chkClass = getClassFromName(classname);
    if (chkClass != null) {
        store = base.findElementStore(chkClass);
        if (store != null) {
            List<String> keystrs = CaseInsensitiveString.toStrings(keys);
            List<Object> valobj = new ArrayList<Object>(values);
            String formulaFilter = org.openntf.domino.graph2.DGraph.Utils.getFramedElementPartialFormula(keystrs, valobj, chkClass);
            Iterable<Element> elements = (org.openntf.domino.graph2.impl.DElementIterable) store.getElements(formulaFilter);
            return this.frameElements(elements, null);
        } else {
            return null;
        }
    } else {
        throw new IllegalArgumentException("Class " + classname + " not registered in graph");
    }
}
Also used : Element(com.tinkerpop.blueprints.Element) ArrayList(java.util.ArrayList) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) DElementStore(org.openntf.domino.graph2.DElementStore)

Example 17 with DGraph

use of org.openntf.domino.graph2.impl.DGraph in project org.openntf.domino by OpenNTF.

the class DFramedTransactionalGraph method removeEdge.

// protected <F> F getCachedElement(final Element element, final Class<F> kind) {
// if (element == null)
// return null;
// //		System.out.println("TEMP DEBUG checking cache for element " + element.getId().toString());
// Object chk = getFramedElementCache().get(element);
// if (chk != null) {
// if (kind.isAssignableFrom(chk.getClass())) {
// //				System.out.println("TEMP DEBUG returning from cache for element " + element.getId().toString());
// return (F) chk;
// } else {
// throw new IllegalStateException("Requested id of " + String.valueOf(element) + " is already in cache but is a "
// + chk.getClass().getName());
// }
// }
// return null;
// }
@Override
public void removeEdge(final Edge edge) {
    IndexScanner is = getIndexScanner();
    if (is != null) {
        String mid = String.valueOf(edge.getId());
        is.removeDocument(mid);
    }
    removeCache(edge);
    ((DGraph) getBaseGraph()).removeEdge(edge);
}
Also used : IndexScanner(org.openntf.domino.graph2.builtin.search.IndexScanner) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString)

Example 18 with DGraph

use of org.openntf.domino.graph2.impl.DGraph in project org.openntf.domino by OpenNTF.

the class DFramedTransactionalGraph method getKeyResolver.

public DKeyResolver getKeyResolver(final Class<?> type) {
    DGraph base = (DGraph) this.getBaseGraph();
    DKeyResolver result = base.getKeyResolver(type);
    if (result == null) {
        DConfiguration config = (DConfiguration) getConfig();
        result = base.getKeyResolver(config.getDefaultVertexFrameType());
        if (result == null) {
            result = new DefaultKeyResolver(this);
            base.addKeyResolver(result);
        }
    }
    return result;
}
Also used : DKeyResolver(org.openntf.domino.graph2.DKeyResolver)

Example 19 with DGraph

use of org.openntf.domino.graph2.impl.DGraph in project org.openntf.domino by OpenNTF.

the class DFramedTransactionalGraph method removeVertex.

@Override
public void removeVertex(final Vertex vertex) {
    IndexScanner is = getIndexScanner();
    if (is != null) {
        String mid = String.valueOf(vertex.getId());
        is.removeDocument(mid);
    }
    removeCache(vertex);
    ((DGraph) getBaseGraph()).removeVertex(vertex);
}
Also used : IndexScanner(org.openntf.domino.graph2.builtin.search.IndexScanner) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString)

Example 20 with DGraph

use of org.openntf.domino.graph2.impl.DGraph in project org.openntf.domino by OpenNTF.

the class DFramedTransactionalGraph method getVertex.

public <F> F getVertex(final Class<F> kind, final Object context, final Object... args) {
    DGraph base = (DGraph) this.getBaseGraph();
    org.openntf.domino.graph2.DElementStore store = base.findElementStore(kind);
    Object id = store.getIdentity(kind, context, args);
    return getVertex(id, kind);
}
Also used : DElementStore(org.openntf.domino.graph2.DElementStore)

Aggregations

DGraph (org.openntf.domino.graph2.impl.DGraph)17 DElementStore (org.openntf.domino.graph2.DElementStore)12 CaseInsensitiveString (org.openntf.domino.types.CaseInsensitiveString)12 DConfiguration (org.openntf.domino.graph2.impl.DConfiguration)9 DElementStore (org.openntf.domino.graph2.impl.DElementStore)7 DFramedGraphFactory (org.openntf.domino.graph2.impl.DFramedGraphFactory)7 Element (com.tinkerpop.blueprints.Element)5 ArrayList (java.util.ArrayList)5 Person (org.openntf.domino.graph2.builtin.identity.Person)4 Vertex (com.tinkerpop.blueprints.Vertex)3 List (java.util.List)3 Session (org.openntf.domino.Session)3 DFramedTransactionalGraph (org.openntf.domino.graph2.impl.DFramedTransactionalGraph)3 Edge (com.tinkerpop.blueprints.Edge)2 Module (com.tinkerpop.frames.modules.Module)2 JavaHandlerModule (com.tinkerpop.frames.modules.javahandler.JavaHandlerModule)2 TypedGraphModuleBuilder (com.tinkerpop.frames.modules.typedgraph.TypedGraphModuleBuilder)2 Database (org.openntf.domino.Database)2 NoteCoordinate (org.openntf.domino.big.NoteCoordinate)2 FramedVertexList (org.openntf.domino.graph2.annotations.FramedVertexList)2