+ private final Certificate root;
+
+ private final CACertificate[] cs;
+
+ private final OutputableCertificate rootP;
+
+ private class OutputableCertificate implements Outputable {
+
+ private final CACertificate target;
+
+ private final OutputableCertificate[] children;
+
+ public OutputableCertificate(CACertificate c) {
+ target = c;
+ LinkedList<OutputableCertificate> children = new LinkedList<>();
+ for (CACertificate c0 : cs) {
+ if (c0.getParent() == c && c0 != c) {
+ children.add(new OutputableCertificate(c0));
+ }
+ }
+
+ Collections.sort(children, new Comparator<OutputableCertificate>() {
+
+ @Override
+ public int compare(OutputableCertificate o1, OutputableCertificate o2) {
+ return o1.target.getKeyname().compareTo(o2.target.getKeyname());
+ }
+ });
+ this.children = children.toArray(new OutputableCertificate[children.size()]);
+ }
+
+ @Override
+ public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+ out.println("<a href='" + HTMLEncoder.encodeHTML(target.getLink()) + "'>");
+ out.println(HTMLEncoder.encodeHTML(target.getKeyname()));
+ out.println("</a>");
+ out.println(HTMLEncoder.encodeHTML(target.getCertificate().getSubjectX500Principal().toString()));
+ out.println("<ul>");
+ for (OutputableCertificate c : children) {
+ out.print("<li>");
+ c.output(out, l, vars);
+ out.print("</li>");
+ }
+ out.println("</ul>");
+ }
+
+ }