XspOpenLogUtil.getXspOpenLogItem().logEvent(null, "Test message", Level.FINE, doc);
}
public static void transactionTest(boolean successOrFail) {
StringBuilder sb = new StringBuilder();
Database db = Factory.getSession().getCurrentDatabase();
Utils.addAllListeners(db);
DatabaseTransaction txn = db.startTransaction();
try {
String selVal = (String) ExtLibUtil.getViewScope().get("selectedState");
boolean toggle = true;
int count = 0;
if ("".equals(selVal)) {
ExtLibUtil.getViewScope().put("javaTest", "First select a value");
return;
}
sb.append("Starting update with " + selVal);
View view = db.getView("allStates");
Document state = view.getFirstDocumentByKey(selVal, true);
state.replaceItemValue("txnTest", new Date());
sb.append("...Updated State pending committal, value is " + state.get("txnTest").toString());
View contacts = db.getView("AllContactsByState");
DocumentCollection dc = contacts.getAllDocumentsByKey(selVal, true);
for (Document doc : dc) {
if (toggle) {
doc.replaceItemValue("txnTest", new Date());
count += 1;