public static Map<String, String> iterate(String list, String separator, GlobalSessionObject<Map<String, Object>> globalSessionObject) {
IteratorProcessor iterator = new IteratorProcessor();
Map<String, String> returnResult = new HashMap<String, String>();
returnResult.put("result", "failed");
try {
iterator.init(list, separator, globalSessionObject);
if (iterator.hasNext()) {
returnResult.put("index", Integer.toString(iterator.getIndex()));
returnResult.put("resultString", iterator.getNext(globalSessionObject));
if (iterator.hasNext()) {
returnResult.put("result", "has more");
returnResult.put("returnCode", "0");
} else {
returnResult.put("resultString", "");
returnResult.put("returnCode", "1");
iterator.setStepSessionEnd(globalSessionObject);
returnResult.put("result", "no more");
}
}
} catch (IteratorProcessorException e) {
returnResult.put("result", "failed");
returnResult.put("resultString", e.getMessage());
returnResult.put("returnCode", "-1");
}
return returnResult;
}
}