use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class ItemUtil method addItem.
public static void addItem(XmlBuilder xml, String name, String value) {
XmlBuilder item = new XmlBuilder("item");
item.addAttribute("name", name);
item.addAttribute("value", value);
xml.addSubElement(item);
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class ItemUtil method getSummaryContainer.
public static XmlBuilder getSummaryContainer(XmlBuilder parent, String name) {
if (parent == null) {
throw new NullPointerException("parent XmlBuilder cannot be null");
}
if (name != null) {
parent.addAttribute("name", name);
}
XmlBuilder stats = new XmlBuilder("summary");
parent.addSubElement(stats);
return stats;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class ItemUtil method toXml.
public static XmlBuilder toXml(ItemList il, String elementName, String name, DecimalFormat timeFormat, DecimalFormat percentageFormat, DecimalFormat countFormat) {
XmlBuilder container = new XmlBuilder(elementName);
XmlBuilder stats = getSummaryContainer(container, name);
for (int i = 0; i < il.getItemCount(); i++) {
Object item = il.getItemValue(i);
if (item == null) {
addItem(stats, il.getItemName(i), ItemList.ITEM_VALUE_NAN);
} else {
String value = "";
switch(il.getItemType(i)) {
case ItemList.ITEM_TYPE_INTEGER:
if (countFormat == null) {
value = "" + (Long) item;
} else {
value = countFormat.format((Long) item);
}
break;
case ItemList.ITEM_TYPE_TIME:
value = timeFormat.format(item);
break;
case ItemList.ITEM_TYPE_FRACTION:
value = percentageFormat.format(((Double) item).doubleValue() * 100) + "%";
break;
}
addItem(stats, il.getItemName(i), value);
}
}
return container;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SchedulerAdapter method jobDetailToXmlBuilder.
public XmlBuilder jobDetailToXmlBuilder(Scheduler theScheduler, String jobName, String groupName) {
XmlBuilder xbRoot = new XmlBuilder("jobDetail");
try {
JobDetail jd = theScheduler.getJobDetail(jobName, groupName);
xbRoot.addAttribute("fullName", jd.getFullName());
xbRoot.addAttribute("jobName", jd.getName());
xbRoot.addAttribute("groupName", jd.getGroup());
String description = "-";
if (StringUtils.isNotEmpty(jd.getDescription()))
description = jd.getDescription();
xbRoot.addAttribute("description", description);
xbRoot.addAttribute("isStateful", (jd.isStateful() ? "True" : "False"));
xbRoot.addAttribute("isDurable", (jd.isDurable() ? "True" : "False"));
xbRoot.addAttribute("isVolatile", (jd.isVolatile() ? "True" : "False"));
xbRoot.addAttribute("jobClass", jd.getJobClass().getName());
} catch (org.quartz.SchedulerException se) {
log.error(se);
}
return xbRoot;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SchedulerAdapter method getJobRunStatistics.
public XmlBuilder getJobRunStatistics(JobDef jobdef) {
XmlBuilder jobRunStatistics = new XmlBuilder("jobRunStatistics");
if (jobdef != null) {
StatisticsKeeper statsKeeper = jobdef.getStatisticsKeeper();
if (statsKeeper != null) {
XmlBuilder jobRunDuration = statsKeeper.toXml("jobRunDuration", false, tf, pf);
jobRunStatistics.addSubElement(jobRunDuration);
}
}
return jobRunStatistics;
}
Aggregations