use of org.glassfish.admin.rest.results.GetResultList in project Payara by payara.
the class PropertiesBagResource method get.
@GET
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Object get() {
List<Dom> entities = getEntity();
if (entities == null) {
// empty dom list
return new GetResultList(new ArrayList(), "", new String[][] {}, new OptionsResult(Util.getResourceName(uriInfo)));
}
RestActionReporter ar = new RestActionReporter();
ar.setActionExitCode(ActionReport.ExitCode.SUCCESS);
ar.setActionDescription("property");
List properties = new ArrayList();
for (Dom child : entities) {
Map<String, String> entry = new HashMap<String, String>();
entry.put("name", child.attribute("name"));
entry.put("value", child.attribute("value"));
String description = child.attribute("description");
if (description != null) {
entry.put("description", description);
}
properties.add(entry);
}
Properties extraProperties = new Properties();
extraProperties.put("properties", properties);
ar.setExtraProperties(extraProperties);
return new ActionReportResult("properties", ar, new OptionsResult(Util.getResourceName(uriInfo)));
}
Aggregations