use of com.darwino.domino.napi.struct.SEARCH_MATCH in project org.openntf.nsfodp by OpenNTF.
the class DarwinoNDatabase method eachDesignNote.
@Override
public void eachDesignNote(BiConsumer<Integer, NNote> consumer) {
NSFSEARCHPROC proc = new NSFSEARCHPROC() {
@Override
public short callback(long searchMatchPtr, long summaryBufferPtr) throws DominoException {
SEARCH_MATCH searchMatch = new SEARCH_MATCH();
C.memcpy(searchMatch.getDataPtr(), 0, searchMatchPtr, 0, SEARCH_MATCH.sizeOf);
short noteClass = searchMatch.getNoteClass();
int noteId = searchMatch.getId().getNoteId();
byte retFlags = searchMatch.getSERetFlags();
boolean deleted = (noteClass & DominoAPI.NOTE_CLASS_NOTIFYDELETION) != 0;
// The use of "since" means that non-matching notes will be returned; check this flag to make sure
boolean isSearchMatch = (retFlags & DominoAPI.SE_FMATCH) != 0;
if (isSearchMatch && !deleted) {
try (NNote note = getNoteByID(noteId)) {
consumer.accept(noteId, note);
}
}
return DominoAPI.NOERROR;
}
};
try {
// $NON-NLS-1$
database.search("@All", proc, (short) 0, DominoAPI.NOTE_CLASS_ALLNONDATA, null, null);
} catch (DominoException e) {
throw new NDominoException(e.getStatus(), e);
} catch (FormulaException e) {
throw new NDominoException(0, e);
}
}
Aggregations