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");
}
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;
}
}
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;
}
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();
}
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;
}
Aggregations