use of org.glassfish.admin.rest.generator.CommandResourceMetaData in project Payara by payara.
the class ResourceUtil method getResourceLinks.
public static Map<String, String> getResourceLinks(Dom dom, UriInfo uriInfo, boolean canShowDeprecated) {
Map<String, String> links = new TreeMap<String, String>();
for (String elementName : dom.model.getElementNames()) {
// for each element
if (elementName.equals("*")) {
ConfigModel.Node node = (ConfigModel.Node) dom.model.getElement(elementName);
ConfigModel childModel = node.getModel();
List<ConfigModel> lcm = getRealChildConfigModels(childModel, dom.document);
Collections.sort(lcm, new ConfigModelComparator());
if (lcm != null) {
for (ConfigModel cmodel : lcm) {
if ((!isDeprecated(cmodel) || canShowDeprecated)) {
links.put(cmodel.getTagName(), ProviderUtil.getElementLink(uriInfo, cmodel.getTagName()));
}
}
}
} else {
ConfigModel.Property childElement = dom.model.getElement(elementName);
boolean deprec = false;
if (childElement instanceof ConfigModel.Node) {
ConfigModel.Node node = (ConfigModel.Node) childElement;
deprec = isDeprecated(node.getModel());
}
for (String annotation : childElement.getAnnotations()) {
if (annotation.equals(Deprecated.class.getName())) {
deprec = true;
}
}
if ((!deprec || canShowDeprecated)) {
links.put(elementName, ProviderUtil.getElementLink(uriInfo, elementName));
}
}
}
String beanName = getUnqualifiedTypeName(dom.model.targetTypeName);
for (CommandResourceMetaData cmd : CommandResourceMetaData.getCustomResourceMapping(beanName)) {
links.put(cmd.resourcePath, ProviderUtil.getElementLink(uriInfo, cmd.resourcePath));
}
return links;
}
Aggregations