Search in sources :

Example 36 with XmlBuilder

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

Example 37 with XmlBuilder

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

Example 38 with XmlBuilder

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

Example 39 with XmlBuilder

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

Example 40 with XmlBuilder

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

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