use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class NoteListTest method run2.
public void run2() {
long testStartTime = System.nanoTime();
Session session = this.getSession();
try {
Database db = session.getDatabase("", "imdb/movies.nsf");
// db.setDelayUpdates(true);
marktime = System.nanoTime();
timelog("Beginning view build...");
View byLength = db.getView("byLength");
View btitles = db.createView("BTitles", "@Begins(Title; \"B\")", byLength);
// View btitles = db.createView("BTitles", "@Begins(Title; \"B\")");
ViewColumn length = btitles.createColumn(1, "Title", "Title");
length.setSorted(true);
timelog("View defined.");
btitles.refresh();
timelog("Completed view build.");
ViewEntryCollection vec = btitles.getAllEntries();
int count = vec.getCount();
timelog("Found " + count + " documents in the view");
btitles.remove();
timelog("Removed view.");
btitles.recycle();
db.recycle();
} catch (Throwable t) {
t.printStackTrace();
} finally {
long testEndTime = System.nanoTime();
System.out.println("Completed " + getClass().getSimpleName() + " run in " + ((testEndTime - testStartTime) / 1000000) + " ms");
}
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class RichTextItemReplaceAttachmentText method run.
@Override
public void run() {
Session session = Factory.getSession(SessionType.NATIVE);
Database db = session.getDatabase("", "sarmy/USSBulletins.nsf");
Document doc = db.getDocumentByUNID("5F96214CFE92013D86258027007687FA");
RichTextItem rtItem = (RichTextItem) doc.getFirstItem("BulletinText");
rtItem.replaceAttachment("Feature Requests 2008.ods", "c:/data/Feature Requests 2008.ods");
rtItem.compact();
doc.save(true, true);
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class SortedCollectionTest method run.
@Override
public void run() {
Session session = Factory.getSession(SessionType.CURRENT);
Database db = session.getDatabase("", "CollTest.nsf");
DocumentCollection coll = db.getAllDocuments();
// System.out.println("UNSORTED");
for (Document doc : coll) {
// System.out.println(doc.getItemValueString("MainSortValue") + " " + doc.getLastModifiedDate().getTime());
}
List<String> criteria = new ArrayList<String>();
criteria.add("MainSortValue");
criteria.add("@modifieddate");
try {
DocumentSorter sorter = new DocumentSorter(coll, criteria);
// System.out.println("SORTING...");
long startTime = System.nanoTime();
DocumentCollection sortedColl = sorter.sort();
long endTime = System.nanoTime();
System.out.println("Completed resort in " + ((endTime - startTime) / 1000000) + "ms");
// System.out.println("SORTED");
for (Document doc : sortedColl) {
System.out.println(doc.getItemValueString("MainSortValue") + " " + doc.getLastModifiedDate().getTime() + " " + Integer.valueOf(doc.getNoteID(), 16));
}
DocumentSorter.DocumentData[] dataset = sorter._debugGetDataset();
for (DocumentSorter.DocumentData data : dataset) {
StringBuilder sb = new StringBuilder();
for (Serializable s : data._debugGetValues()) {
sb.append(s);
sb.append(',');
}
System.out.println(sb.toString());
}
} catch (Throwable t) {
t.printStackTrace();
}
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class NameTest method testName.
protected org.openntf.domino.Name testName(final String what, final NotesBug... notesbug) throws NotesException {
Session s = Factory.getSession(SessionType.CURRENT);
lotus.domino.Session ls = s.getFactory().toLotus(s);
org.openntf.domino.Name o = s.createName(what);
lotus.domino.Name n = ls.createName(what);
compareNames(n.getCanonical(), n, o, notesbug);
return o;
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class SerializeTest method testDatabaseReboot.
@Test
public void testDatabaseReboot() throws IOException, ClassNotFoundException {
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getDatabase("log.nsf");
Database ret = test(db, true);
assertFalse(db == ret);
}
Aggregations