in src/main/java/org/apache/sling/serviceuser/webconsole/impl/ServiceUserWebConsolePlugin.java [519:564]
private void printPrincipals(List<Mapping> activeMappings, PrintWriter pw) {
List<Pair<String, Mapping>> mappings = new ArrayList<>();
for (Mapping mapping : activeMappings) {
for (String principal : extractPrincipals(mapping)) {
mappings.add(new ImmutablePair<String, Mapping>(principal, mapping));
}
}
Collections.sort(mappings, new Comparator<Pair<String, Mapping>>() {
@Override
public int compare(Pair<String, Mapping> o1, Pair<String, Mapping> o2) {
if (o1.getKey().equals(o2.getKey())) {
return o1.getValue()
.getServiceName()
.compareTo(o2.getValue().getServiceName());
} else {
return o1.getKey().compareTo(o2.getKey());
}
}
});
for (Pair<String, Mapping> mapping : mappings) {
tableRows(pw);
pw.println("<td><a href=\"/system/console/serviceusers?action=details&user="
+ xss.encodeForHTML(mapping.getKey()) + "\">" + xss.encodeForHTML(mapping.getKey()) + "</a></td>");
Map<String, Bundle> bundles = new HashMap<>();
Bundle bundle = findBundle(mapping.getValue().getServiceName(), bundles);
if (bundle != null) {
bundleContext.getBundle();
pw.println("<td><a href=\"/system/console/bundles/" + bundle.getBundleId() + "\">"
+ xss.encodeForHTML(
bundle.getHeaders().get(Constants.BUNDLE_NAME) + " (" + bundle.getSymbolicName())
+ ")</a></td>");
pw.println("<td>" + xss.encodeForHTML(mapping.getValue().getSubServiceName()) + TD);
} else {
bundleContext.getBundle();
pw.println("<td>" + xss.encodeForHTML(mapping.getValue().getServiceName()) + TD);
pw.println("<td>"
+ xss.encodeForHTML(
mapping.getValue().getSubServiceName() != null
? mapping.getValue().getSubServiceName()
: "")
+ TD);
}
}
}