Search in sources :

Example 1 with XmlArray

use of org.glassfish.admin.rest.utils.xml.XmlArray in project Payara by payara.

the class ActionReportXmlProvider method getXml.

protected XmlArray getXml(Collection c) {
    XmlArray result = new XmlArray("list");
    Iterator i = c.iterator();
    while (i.hasNext()) {
        Object item = i.next();
        Object obj = getXmlObject(item);
        if (!(obj instanceof XmlObject)) {
            obj = new XmlObject(obj.getClass().getSimpleName(), obj);
        }
        result.put((XmlObject) obj);
    }
    return result;
}
Also used : XmlArray(org.glassfish.admin.rest.utils.xml.XmlArray) XmlObject(org.glassfish.admin.rest.utils.xml.XmlObject) XmlObject(org.glassfish.admin.rest.utils.xml.XmlObject)

Example 2 with XmlArray

use of org.glassfish.admin.rest.utils.xml.XmlArray in project Payara by payara.

the class ActionReportXmlProvider method processChildren.

protected XmlArray processChildren(List<MessagePart> parts) {
    XmlArray array = new XmlArray("children");
    for (MessagePart part : parts) {
        XmlMap object = new XmlMap("part");
        object.put("message", part.getMessage());
        object.put("properties", new XmlMap("properties", part.getProps()));
        List<MessagePart> children = part.getChildren();
        if (children.size() > 0) {
            object.put("children", processChildren(part.getChildren()));
        }
        array.put(object);
    }
    return array;
}
Also used : XmlArray(org.glassfish.admin.rest.utils.xml.XmlArray) MessagePart(org.glassfish.api.ActionReport.MessagePart) XmlMap(org.glassfish.admin.rest.utils.xml.XmlMap)

Aggregations

XmlArray (org.glassfish.admin.rest.utils.xml.XmlArray)2 XmlMap (org.glassfish.admin.rest.utils.xml.XmlMap)1 XmlObject (org.glassfish.admin.rest.utils.xml.XmlObject)1 MessagePart (org.glassfish.api.ActionReport.MessagePart)1