Search in sources :

Example 86 with XmlBuilder

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);
}
Also used : XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Example 87 with XmlBuilder

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;
}
Also used : DecimalFormat(java.text.DecimalFormat) Iterator(java.util.Iterator) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Example 88 with XmlBuilder

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;
}
Also used : XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Example 89 with XmlBuilder

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();
}
Also used : ArrayList(java.util.ArrayList) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Example 90 with XmlBuilder

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;
}
Also used : Configuration(nl.nn.adapterframework.configuration.Configuration) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Aggregations

XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)108 IOException (java.io.IOException)18 Iterator (java.util.Iterator)17 ArrayList (java.util.ArrayList)12 Date (java.util.Date)12 SenderException (nl.nn.adapterframework.core.SenderException)12 DomBuilderException (nl.nn.adapterframework.util.DomBuilderException)10 Configuration (nl.nn.adapterframework.configuration.Configuration)9 SchedulerException (org.quartz.SchedulerException)8 ServletException (javax.servlet.ServletException)7 TransformerException (javax.xml.transform.TransformerException)7 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)6 PipeRunException (nl.nn.adapterframework.core.PipeRunException)6 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)6 JmsException (nl.nn.adapterframework.jms.JmsException)6 HashMap (java.util.HashMap)5 List (java.util.List)5 Adapter (nl.nn.adapterframework.core.Adapter)5 SimpleDateFormat (java.text.SimpleDateFormat)4 Map (java.util.Map)4