Search in sources :

Example 31 with View

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

the class SessionTests method run.

@Override
public void run() {
    Session sess = Factory.getSession(SessionType.NATIVE);
    Database db = sess.getDatabase("names.nsf");
    View vw = db.getView("$Users");
    Document doc = vw.getFirstDocument();
    String metaversalId = doc.getMetaversalID();
    System.out.println(metaversalId);
    Document doc2 = sess.getDocumentByMetaversalID(db.getServer(), metaversalId);
    if (null == doc2) {
        System.out.println("Failed");
    } else {
        System.out.println("Worked");
    }
    Document doc3 = sess.getDocumentByMetaversalID(metaversalId);
    if (null == doc2) {
        System.out.println("Failed");
    } else {
        System.out.println("Worked");
    }
}
Also used : Database(org.openntf.domino.Database) Document(org.openntf.domino.Document) View(org.openntf.domino.View) Session(org.openntf.domino.Session)

Example 32 with View

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

the class MassViewEntryCollectionTest 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();
    int i = 0;
    if (null != view) {
        view.setAutoUpdate(false);
        System.out.println(view.getEntryCount());
        for (ViewEntry entry : view.getAllEntries()) {
            i++;
        }
        /* */
        view.setAutoUpdate(true);
    }
    System.out.println(i);
    long elapsed = System.nanoTime() - start;
    System.out.println("-- STOP --");
    System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
}
Also used : 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 33 with View

use of org.openntf.domino.View 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)

Aggregations

View (org.openntf.domino.View)33 Session (org.openntf.domino.Session)20 Database (org.openntf.domino.Database)19 Document (org.openntf.domino.Document)9 ViewEntry (org.openntf.domino.ViewEntry)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 ViewNavigator (org.openntf.domino.ViewNavigator)5 HashMap (java.util.HashMap)4 ViewColumn (org.openntf.domino.ViewColumn)4 Map (java.util.Map)3 Vector (java.util.Vector)3 DocumentCollection (org.openntf.domino.DocumentCollection)3 ViewEntryCollection (org.openntf.domino.ViewEntryCollection)3 JsonJavaObject (com.ibm.commons.util.io.json.JsonJavaObject)2 JsonObject (com.ibm.commons.util.io.json.JsonObject)2 Edge (com.tinkerpop.blueprints.Edge)2 Vertex (com.tinkerpop.blueprints.Vertex)2 EdgeFrame (com.tinkerpop.frames.EdgeFrame)2