use of org.openntf.domino.DocumentCollection in project org.openntf.domino by OpenNTF.
the class IndexDatabase method scanDatabase.
// @SuppressWarnings("unused")
// private int sortedDocCount_ = 0;
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#scanDatabase(org.openntf.domino.Database, org.openntf.domino.helpers.DocumentScanner)
*/
@Override
public DocumentScanner scanDatabase(final Database db, final DocumentScanner scanner) {
// System.out.println("Scanning database " + db.getApiPath());
curDocCount_ = 0;
scanner.setCaseSensitive(getCaseSensitive());
scanner.setStateManager(this, db.getReplicaID());
Date last = scanner.getLastScanDate();
if (last == null) {
last = new Date(0);
}
int count = db.getModifiedNoteCount(last);
if (count > 0) {
DocumentCollection rawColl = db.getModifiedDocuments(last);
DocumentSorter sorter = new DocumentSorter(rawColl, MOD_SORT_LIST);
System.out.println("Scanning database " + db.getApiPath() + " with last date of " + last.getTime() + " and found " + rawColl.getCount() + " updates to scan");
scanner.processSorter(sorter);
}
return scanner;
}
use of org.openntf.domino.DocumentCollection 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;
}
use of org.openntf.domino.DocumentCollection in project org.openntf.domino by OpenNTF.
the class View method getAllDocumentsByKey.
/*
* (non-Javadoc)
*
* @see org.openntf.domino.View#getAllDocumentsByKey(java.lang.Object, boolean)
*/
@SuppressWarnings("rawtypes")
@Override
public DocumentCollection getAllDocumentsByKey(final Object key, final boolean exact) {
List<lotus.domino.Base> recycleThis = new ArrayList<lotus.domino.Base>();
try {
Object domKey = toDominoFriendly(key, getAncestorSession(), recycleThis);
lotus.domino.DocumentCollection lotusColl;
if (domKey instanceof java.util.Vector) {
lotusColl = getDelegate().getAllDocumentsByKey((java.util.Vector) domKey, exact);
} else {
lotusColl = getDelegate().getAllDocumentsByKey(domKey, exact);
}
DocumentCollection dc = fromLotus(lotusColl, DocumentCollection.SCHEMA, getAncestorDatabase());
dc.setParentView(this);
return dc;
} catch (NotesException e) {
DominoUtils.handleException(e);
} finally {
s_recycle(recycleThis);
}
return null;
}
Aggregations