Search in sources :

Example 16 with ViewEntry

use of org.openntf.domino.ViewEntry in project org.openntf.domino by OpenNTF.

the class MassViewNavigatorSkipTest method run.

@Test
public void run() {
    Session s = Factory.getSession(SessionType.CURRENT);
    Database source = s.getDatabase("", TARGET, true);
    View view = source.getView(VIEW);
    System.out.println("-- START --");
    long start = System.nanoTime();
    if (null != view) {
        view.setAutoUpdate(false);
        System.out.println(view.getEntryCount());
        ViewNavigator nav = view.createViewNav();
        // nav.setCacheSize(400);
        nav.skip(1000000);
        System.out.println("CacheSize: " + nav.getCacheSize());
        view.setAutoUpdate(true);
        ViewEntry entry = null;
        entry = nav.getFirst();
        while (null != entry) {
            entry = nav.getNext(entry);
        }
    }
    long elapsed = System.nanoTime() - start;
    System.out.println("-- STOP --");
    System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
}
Also used : ViewNavigator(org.openntf.domino.ViewNavigator) ViewEntry(org.openntf.domino.ViewEntry) Database(org.openntf.domino.Database) View(org.openntf.domino.View) Session(org.openntf.domino.Session) Test(org.junit.Test)

Example 17 with ViewEntry

use of org.openntf.domino.ViewEntry in project org.openntf.domino by OpenNTF.

the class ViewEntryList method get.

@Override
public ViewEntryCoordinate get(final int arg0) {
    if (navigator_ != null) {
        ViewEntry entry = getNavigator().getNth(arg0);
        ViewEntryCoordinate vec = new org.openntf.domino.big.impl.ViewEntryCoordinate(entry);
        vec.setSourceNav(getNavigator());
        return vec;
    } else {
        ViewEntry entry = getCollection().getNthEntry(arg0);
        ViewEntryCoordinate vec = new org.openntf.domino.big.impl.ViewEntryCoordinate(entry);
        vec.setSourceColl(getCollection());
        return vec;
    }
}
Also used : ViewEntryCoordinate(org.openntf.domino.big.ViewEntryCoordinate) ViewEntry(org.openntf.domino.ViewEntry)

Example 18 with ViewEntry

use of org.openntf.domino.ViewEntry in project org.openntf.domino by OpenNTF.

the class ViewEntryList method contains.

@Override
public boolean contains(final Object arg0) {
    if (arg0 instanceof ViewEntryCoordinate) {
        ViewEntryCoordinate vec = (ViewEntryCoordinate) arg0;
        if (navigator_ != null) {
            ViewEntry current = getNavigator().getCurrent();
            boolean result = getNavigator().gotoPos(vec.getPosition(), org.openntf.domino.ViewNavigator.DEFAULT_SEPARATOR);
            getNavigator().gotoEntry(current);
            return result;
        } else {
        // TODO implement
        }
    }
    if (arg0 instanceof ViewEntry) {
        ViewEntry ve = (ViewEntry) arg0;
        if (navigator_ != null) {
            ViewEntry current = getNavigator().getCurrent();
            boolean result = getNavigator().gotoEntry(ve);
            getNavigator().gotoEntry(current);
            return result;
        } else {
            return getCollection().contains(ve);
        }
    }
    return false;
}
Also used : ViewEntryCoordinate(org.openntf.domino.big.ViewEntryCoordinate) ViewEntry(org.openntf.domino.ViewEntry)

Example 19 with ViewEntry

use of org.openntf.domino.ViewEntry in project org.openntf.domino by OpenNTF.

the class DominoGraph method getVertices.

@Override
public Iterable<Vertex> getVertices() {
    FastSet<Vertex> result = new FastSet<Vertex>();
    ViewEntryCollection vec = getVertexView().getAllEntries();
    for (ViewEntry entry : vec) {
        result.add(getVertex(entry.getUniversalID()));
    }
    return result.unmodifiable();
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) FastSet(javolution.util.FastSet) ViewEntry(org.openntf.domino.ViewEntry) ViewEntryCollection(org.openntf.domino.ViewEntryCollection)

Example 20 with ViewEntry

use of org.openntf.domino.ViewEntry in project org.openntf.domino by OpenNTF.

the class View method getAllDocuments.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.View#getAllDocuments()
	 */
@Override
public DocumentCollection getAllDocuments() {
    Database db = getAncestorDatabase();
    DocumentCollection result = db.createDocumentCollection();
    // When it's a folder, there's no selection formula, so do it the "dumb" way for now
    if (isFolder()) {
        // TODO See if there's a better way
        for (ViewEntry entry : getAllEntries()) {
            if (entry.isDocument()) {
                result.add(entry.getDocument());
            }
        }
    } else {
        // According to Tommy Valand's research, the fastest method is to build a NoteCollection with a matching selection formula
        // http://dontpanic82.blogspot.com/2013/06/benchmark-fetching-noteids-and.html
        NoteCollection nc = getNoteCollection();
        int[] nids = nc.getNoteIDs();
        // TODO due to a bug in 9.0, this is being reverted to highly inefficient behavior...
        for (int nid : nids) {
            Document doc = db.getDocumentByID(Integer.toHexString(nid));
            result.add(doc);
        }
    }
    return result;
}
Also used : ViewEntry(org.openntf.domino.ViewEntry) NoteCollection(org.openntf.domino.NoteCollection) Database(org.openntf.domino.Database) DocumentCollection(org.openntf.domino.DocumentCollection) Document(org.openntf.domino.Document)

Aggregations

ViewEntry (org.openntf.domino.ViewEntry)21 View (org.openntf.domino.View)7 ViewNavigator (org.openntf.domino.ViewNavigator)7 Database (org.openntf.domino.Database)5 Session (org.openntf.domino.Session)5 Test (org.junit.Test)3 ViewEntryCollection (org.openntf.domino.ViewEntryCollection)3 ViewEntryCoordinate (org.openntf.domino.big.ViewEntryCoordinate)3 ArrayList (java.util.ArrayList)2 FastSet (javolution.util.FastSet)2 NotesException (lotus.domino.NotesException)2 Edge (com.tinkerpop.blueprints.Edge)1 Vertex (com.tinkerpop.blueprints.Vertex)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 Vector (java.util.Vector)1 Document (org.openntf.domino.Document)1 DocumentCollection (org.openntf.domino.DocumentCollection)1