use of org.glassfish.admin.rest.utils.xml.XmlMap in project Payara by payara.
the class ActionReportXmlProvider method processReport.
protected XmlObject processReport(ActionReporter ar) {
XmlMap result = new XmlMap("map");
result.put("message", (ar instanceof RestActionReporter) ? ((RestActionReporter) ar).getCombinedMessage() : ar.getMessage());
result.put("command", ar.getActionDescription());
result.put("exit_code", ar.getActionExitCode().toString());
Properties properties = ar.getTopMessagePart().getProps();
if ((properties != null) && (!properties.isEmpty())) {
result.put("properties", new XmlMap("properties", properties));
}
Properties extraProperties = ar.getExtraProperties();
if ((extraProperties != null) && (!extraProperties.isEmpty())) {
result.put("extraProperties", getExtraProperties(result, extraProperties));
}
List<MessagePart> children = ar.getTopMessagePart().getChildren();
if ((children != null) && (!children.isEmpty())) {
result.put("children", processChildren(children));
}
List<ActionReporter> subReports = ar.getSubActionsReport();
if ((subReports != null) && (!subReports.isEmpty())) {
result.put("subReports", processSubReports(subReports));
}
return result;
}
use of org.glassfish.admin.rest.utils.xml.XmlMap in project Payara by payara.
the class ActionReportXmlProvider method getExtraProperties.
protected XmlMap getExtraProperties(XmlObject object, Properties props) {
XmlMap extraProperties = new XmlMap("extraProperties");
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key = entry.getKey().toString();
Object value = getXmlObject(entry.getValue());
if (value != null) {
extraProperties.put(key, value);
}
}
return extraProperties;
}
use of org.glassfish.admin.rest.utils.xml.XmlMap 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;
}
Aggregations