Search in sources :

Example 11 with ViewNavigator

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

the class DEdgeEntryList method initEntryList.

// public DEdgeEntryList(final DVertex source, final DElementStore store, final List<CharSequence> startkeys) {
// source_ = source;
// store_ = store;
// initEntryList(startkeys);
// }
protected void initEntryList() {
    ViewNavigator nav = null;
    if (org.openntf.domino.View.class.equals(source_.getDelegateType())) {
        nav = source_.getView().createViewNav();
        if (source_.getParent().getConfiguration().isSuppressSingleValueCategories()) {
            while (DCategoryVertex.checkSkipCategory(nav)) {
                // System.out.println("TEMP DEBUG SubNavigator skipping category level...");
                nav = DCategoryVertex.dropSingleValueCategory(source_.getView(), nav);
            }
        }
    } else if (source_ instanceof DCategoryVertex) {
        nav = ((DCategoryVertex) source_).getSubNavigator();
    } else {
        throw new IllegalStateException("Cannot create a DEdgeEntryList from a Vertex backed by a " + source_.getClass().getName());
    }
    entryList_ = new ViewEntryList(nav, isFlat_);
}
Also used : ViewEntryList(org.openntf.domino.big.impl.ViewEntryList) ViewNavigator(org.openntf.domino.ViewNavigator)

Example 12 with ViewNavigator

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

the class MassViewNavigatorTest 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);
        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 13 with ViewNavigator

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

the class RawMessageProviderDBImpl method buildMsgCache.

/*----------------------------------------------------------------------------*/
private void buildMsgCache() {
    iMsgCache = new TreeMap<String, Map<String, Map<String, String>>>();
    /*
		 * To avoid PANIC-s from WrapperFactory.recacheLotusObject (when buildMsgCache is called again),
		 * this was partly modified 
		 */
    try {
        if (iDB == null) {
            if (iDBPath == null)
                return;
            Session s = Factory.getSession_unchecked(SessionType.CURRENT);
            if (s == null || (iDB = s.getDatabase(iDBServer, iDBPath)) == null) {
                System.err.println("RawMessageProviderDBImpl: Can't open DB " + iDBServer + "!!" + iDBPath);
                return;
            }
        }
        View v = iDB.getView(iLookupView);
        if (v == null)
            return;
        v.setAutoUpdate(false);
        ViewNavigator nav = v.createViewNav();
        for (ViewEntry ve = nav.getFirst(); ve != null; ve = nav.getNext()) oneDBMsgText(ve);
    } catch (Throwable t) {
        t.printStackTrace();
    } finally {
        iDB = null;
    }
}
Also used : ViewNavigator(org.openntf.domino.ViewNavigator) ViewEntry(org.openntf.domino.ViewEntry) TreeMap(java.util.TreeMap) Map(java.util.Map) View(org.openntf.domino.View) Session(org.openntf.domino.Session)

Example 14 with ViewNavigator

use of org.openntf.domino.ViewNavigator 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 15 with ViewNavigator

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

the class View method createViewNavFromKey.

@SuppressWarnings("rawtypes")
@Override
public ViewNavigator createViewNavFromKey(final Vector arg0, final boolean arg1) {
    try {
        getDelegate().setAutoUpdate(false);
        getDelegate().setEnableNoteIDsForCategories(true);
        ViewNavigator result = fromLotus(getDelegate().createViewNavFromKey(arg0, arg1), ViewNavigator.SCHEMA, this);
        ((org.openntf.domino.impl.ViewNavigator) result).setType(ViewNavigator.Types.KEYS);
        return result;
    } catch (Exception e) {
        DominoUtils.handleException(e);
    }
    return null;
}
Also used : ViewNavigator(org.openntf.domino.ViewNavigator) InvalidClassException(java.io.InvalidClassException) BackendBridgeSanityCheckException(org.openntf.domino.exceptions.BackendBridgeSanityCheckException) NotesException(lotus.domino.NotesException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

ViewNavigator (org.openntf.domino.ViewNavigator)22 NotesException (lotus.domino.NotesException)14 ViewEntry (org.openntf.domino.ViewEntry)7 View (org.openntf.domino.View)5 Session (org.openntf.domino.Session)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Database (org.openntf.domino.Database)2 ViewEntryList (org.openntf.domino.big.impl.ViewEntryList)2 IOException (java.io.IOException)1 InvalidClassException (java.io.InvalidClassException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Vector (java.util.Vector)1 BackendBridgeSanityCheckException (org.openntf.domino.exceptions.BackendBridgeSanityCheckException)1 CaseInsensitiveString (org.openntf.domino.types.CaseInsensitiveString)1