ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
}
public void dateTimeIsAfterTest() {
StringBuilder sb = new StringBuilder();
View threadsByDate = null;
Document firstDoc = null;
Document secondDoc = null;
DateTime firstDate = null;
DateTime secondDate = null;
try {
Session s = ExtLibUtil.getCurrentSession();
Database currDb = s.getCurrentDatabase();
threadsByDate = currDb.getView("AllThreadsByDate");
threadsByDate.setAutoUpdate(false);
ViewNavigator vNav = threadsByDate.createViewNav();
vNav.setEntryOptions(lotus.domino.ViewNavigator.VN_ENTRYOPT_NOCOLUMNVALUES);
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(20);
ViewEntry firstEnt = vNav.getNth(randomInt);
while (!firstEnt.isDocument()) {
ViewEntry tmpEnt = vNav.getNext();
firstEnt.recycle();
firstEnt = tmpEnt;
}
randomInt = randomGenerator.nextInt(20);
ViewEntry secondEnt = vNav.getNth(randomInt);
while (!secondEnt.isDocument()) {
ViewEntry tmpEnt = vNav.getNext();
secondEnt.recycle();
secondEnt = tmpEnt;
}
firstDoc = firstEnt.getDocument();
secondDoc = secondEnt.getDocument();
String firstDt = firstDoc.getFirstItem("Date").getText();
String secondDt = secondDoc.getFirstItem("Date").getText();
firstDate = s.createDateTime(firstDt);
secondDate = s.createDateTime(secondDt);
Date firstDateJ = firstDate.toJavaDate();
Date secondDateJ = secondDate.toJavaDate();
sb.append("Comparing " + firstDt + " (" + firstDoc.getUniversalID() + ") with " + secondDt + " ("
+ secondDoc.getUniversalID() + ")...");
if (firstDateJ.after(secondDateJ)) {
sb.append("first after second");
} else {
sb.append("first NOT after second");
}
sb.append("..........................................................................................");
sb.append("Comparing " + secondDt + " (" + secondDoc.getUniversalID() + ") with " + firstDt + " ("
+ firstDoc.getUniversalID() + ")...");
if (secondDateJ.after(firstDateJ)) {
sb.append("second after first");
} else {
sb.append("second NOT after first");
}
} catch (NotesException e) {
// doSomething
} finally {
try {
threadsByDate.recycle();
firstDoc.recycle();
secondDoc.recycle();
firstDate.recycle();
secondDate.recycle();
} catch (NotesException e) {