use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class StatisticsKeeperXmlBuilder method addNumber.
private void addNumber(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 StatisticsParser method toXml.
public XmlBuilder toXml() {
DecimalFormat df = new DecimalFormat(ItemList.ITEM_FORMAT_TIME);
DecimalFormat pf = new DecimalFormat(ItemList.ITEM_FORMAT_PERC);
XmlBuilder result = new XmlBuilder("overview");
result.addAttribute("instance", getName());
XmlBuilder adaptersXml = new XmlBuilder("adapters");
result.addSubElement(adaptersXml);
if (StringUtils.isNotEmpty(targetAdaptername)) {
adaptersXml.addAttribute("targetAdapter", targetAdaptername);
}
for (Iterator it = adapters.iterator(); it.hasNext(); ) {
String adapter = (String) it.next();
XmlBuilder adapterXml = new XmlBuilder("adapter");
adapterXml.addAttribute("name", adapter);
adaptersXml.addSubElement(adapterXml);
}
XmlBuilder timestampsXml = new XmlBuilder("timestamps");
result.addSubElement(timestampsXml);
if (StringUtils.isNotEmpty(targetTimestamp)) {
timestampsXml.addAttribute("targetTimestamp", targetTimestamp);
}
for (Iterator it = timestamps.iterator(); it.hasNext(); ) {
String timestamp = (String) it.next();
XmlBuilder timestampXml = new XmlBuilder("timestamp");
timestampXml.addAttribute("value", timestamp);
timestampsXml.addSubElement(timestampXml);
}
XmlBuilder dataXml = new XmlBuilder("data");
result.addSubElement(dataXml);
for (Iterator it = data.keySet().iterator(); it.hasNext(); ) {
String name = (String) it.next();
SummaryRecord record = (SummaryRecord) data.get(name);
dataXml.addSubElement(record.toXml(name, df, pf));
}
return result;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class StatisticsKeeper method dumpToXml.
public XmlBuilder dumpToXml() {
XmlBuilder result = new XmlBuilder("StatisticsKeeper");
XmlBuilder items = new XmlBuilder("items");
result.addSubElement(items);
for (int i = 0; i < getItemCount(); i++) {
XmlBuilder item = new XmlBuilder("item");
items.addSubElement(item);
item.addAttribute("index", "" + i);
item.addAttribute("name", XmlUtils.encodeChars(getItemName(i)));
item.addAttribute("type", "" + getItemType(i));
item.addAttribute("value", ItemUtil.getItemValueFormated(this, i));
}
XmlBuilder item = new XmlBuilder("item");
items.addSubElement(item);
item.addAttribute("index", "-1");
item.addAttribute("name", "sumofsquares");
item.addAttribute("value", "" + cumulative.getSumOfSquares());
XmlBuilder samples = new XmlBuilder("samples");
result.addSubElement(samples);
for (int i = 0; i < pest.getSampleCount(getCount(), getMin(), getMax()); i++) {
XmlBuilder sample = pest.getSample(i, getCount(), getMin(), getMax());
samples.addSubElement(sample);
}
return result;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class TestIfsaService method retrieveFormInput.
private String retrieveFormInput(IPipeLineSession session) {
List<String> protocols = new ArrayList<String>();
protocols.add("RR");
protocols.add("FF");
XmlBuilder protocolsXML = new XmlBuilder("protocols");
for (int i = 0; i < protocols.size(); i++) {
XmlBuilder protocolXML = new XmlBuilder("protocol");
protocolXML.setValue(protocols.get(i));
protocolsXML.addSubElement(protocolXML);
}
return protocolsXML.toXML();
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class ConfigurationBase method toConfigurationsXml.
protected XmlBuilder toConfigurationsXml(List<Configuration> configurations) {
XmlBuilder configurationsXml = new XmlBuilder("configurations");
XmlBuilder configurationAllXml = new XmlBuilder("configuration");
configurationAllXml.setValue(CONFIG_ALL);
configurationAllXml.addAttribute("nameUC", "0" + Misc.toSortName(CONFIG_ALL));
configurationsXml.addSubElement(configurationAllXml);
for (Configuration configuration : configurations) {
XmlBuilder configurationXml = new XmlBuilder("configuration");
configurationXml.setValue(configuration.getConfigurationName());
configurationXml.addAttribute("nameUC", "1" + Misc.toSortName(configuration.getConfigurationName()));
configurationsXml.addSubElement(configurationXml);
}
return configurationsXml;
}
Aggregations