public KSessionConverter() {
super(KSessionModel.class);
}
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
KSessionModel kSession = (KSessionModel) value;
writer.addAttribute("name", kSession.getName());
writer.addAttribute("type", kSession.getType());
writer.addAttribute("default", Boolean.toString(kSession.isDefault()));
if (kSession.getClockType() != null) {
writer.addAttribute("clockType", kSession.getClockType().getClockTypeAsString());
}
if (kSession.getScope() != null) {
writer.addAttribute("scope", kSession.getScope().toString());
}
writeObjectList(writer, context, "workItemHandlers", "workItemHandler", kSession.getWorkItemHandelerModels());
// if (kSession.getLogger() instanceof ConsoleLogger) {
// writeObject(writer, context, "consoleLogger", kSession.getLogger());
// } else if (kSession.getLogger() instanceof FileLogger) {
// writeObject(writer, context, "fileLogger", kSession.getLogger());
// }
if (!kSession.getListeners().isEmpty()) {
writer.startNode("listeners");
for (ListenerModel listener : kSession.getListeners()) {
writeObject(writer, context, listener.getKind().toString(), listener);
}
writer.endNode();
}