try {
NoteList notelist = new NoteList();
marktime = System.nanoTime();
timelog("Beginning first notelist...");
NoteCollection notecoll = db.createNoteCollection(false);
notecoll.setSelectDocuments(true);
notecoll.setSelectionFormula("@Begins(Title; \"B\")");
notecoll.buildCollection();
// DocumentCollection coll = db.search("@Begins(Title; \"B\")");
timelog("Starting note coordinates of " + notecoll.getCount() + " documents");
// for (Document doc : notecoll) {
for (String nid : notecoll) {
NoteCoordinate nc = new NoteCoordinate(notecoll, nid);
notelist.add(nc);
}
// Database eventDb = session.getDatabase("", "events4.nsf");
// NoteCollection eventNotecoll = eventDb.createNoteCollection(false);
// eventNotecoll.setSelectDocuments(true);
// eventNotecoll.buildCollection();
// timelog("Continuing note coordinates of " + eventNotecoll.getCount() + " documents");
// for (String nid : eventNotecoll) {
// NoteCoordinate nc = new NoteCoordinate(eventNotecoll, nid);
// notelist.add(nc);
// }
// Database xspextDb = session.getDatabase("", "openntf/xpagesext.nsf");
// NoteCollection xspextNotecoll = xspextDb.createNoteCollection(false);
// xspextNotecoll.setSelectDocuments(true);
// xspextNotecoll.buildCollection();
// timelog("Continuing note coordinates of " + xspextNotecoll.getCount() + " documents");
// for (String nid : xspextNotecoll) {
// NoteCoordinate nc = new NoteCoordinate(xspextNotecoll, nid);
// notelist.add(nc);
// }
byte[] bytes = notelist.toByteArray();
int byteSize = bytes.length;
timelog("Resulting bytearray is " + bytes.length + " so we expect " + (bytes.length / (2500 * 24)) + " items");
// File file = File.createTempFile("foo", "bar");
// FileOutputStream fos = new FileOutputStream(file);
// fos.write(bytes);
// fos.close();
storeTest.writeBinary("imdbNoteList", bytes, 2500 * 24);
storeTest.save();
String storeId = storeTest.getUniversalID();
storeTest.recycle();
storeTest = null;
// coll.recycle();
// coll = null;
notecoll.recycle();
notecoll = null;
// eventNotecoll.recycle();
// eventNotecoll = null;
// eventDb.recycle();
// eventDb = null;