Search in sources :

Example 1 with ConfigModelComparator

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

the class BaseProvider method getResourceLinks.

protected Map<String, String> getResourceLinks(Dom dom) {
    Map<String, String> links = new TreeMap<String, String>();
    Set<String> elementNames = dom.model.getElementNames();
    for (String elementName : elementNames) {
        // for each element
        if (elementName.equals("*")) {
            ConfigModel.Node node = (ConfigModel.Node) dom.model.getElement(elementName);
            ConfigModel childModel = node.getModel();
            List<ConfigModel> lcm = ResourceUtil.getRealChildConfigModels(childModel, dom.document);
            Collections.sort(lcm, new ConfigModelComparator());
            if (lcm != null) {
                Collections.sort(lcm, new ConfigModelComparator());
                for (ConfigModel cmodel : lcm) {
                    links.put(cmodel.getTagName(), ProviderUtil.getElementLink(uriInfo.get(), cmodel.getTagName()));
                }
            }
        } else {
            links.put(elementName, ProviderUtil.getElementLink(uriInfo.get(), elementName));
        }
    }
    return links;
}
Also used : ConfigModel(org.jvnet.hk2.config.ConfigModel) ConfigModelComparator(org.glassfish.admin.rest.utils.ConfigModelComparator) TreeMap(java.util.TreeMap)

Aggregations

TreeMap (java.util.TreeMap)1 ConfigModelComparator (org.glassfish.admin.rest.utils.ConfigModelComparator)1 ConfigModel (org.jvnet.hk2.config.ConfigModel)1