src/main/java/org/efaps/ui/servlet/HelpServlet.java
private CharSequence getSubMenues(final Instance _instance)
        throws EFapsException
    {
        HelpServlet.LOG.debug("Reading Submenues for OID: {}", _instance.getOid());
        final StringBuilder ret = new StringBuilder();

        final QueryBuilder queryBldr = new QueryBuilder(Type.get("Admin_Help_Menu2Menu"));
        queryBldr.addWhereAttrEqValue("FromLink", _instance.getId());
        final MultiPrintQuery multi = queryBldr.getPrint();
        multi.addSelect("linkto[ToLink].attribute[Name]", "linkto[ToLink].oid");
        multi.execute();
        final Map<Long, String> subs = new TreeMap<Long, String>();

        while (multi.next()) {
            final String name = multi.<String>getSelect("linkto[ToLink].attribute[Name]");
            final String oid = multi.<String>getSelect("linkto[ToLink].oid");
            final PrintQuery print = new PrintQuery(oid);
            print.addSelect("linkfrom[Admin_Help_Menu2Wiki#FromLink].linkto[ToLink].attribute[Name]");
            print.execute();
            String link = "";
            final Object links = print
                            .getSelect("linkfrom[Admin_Help_Menu2Wiki#FromLink].linkto[ToLink].attribute[Name]");
            if (links instanceof List<?>) {
                for (final Object alink : (List<?>) links) {
                    link = link + ":" + alink;
                }
            } else {
                link = (String) links;
            }
            HelpServlet.LOG.debug("  Submenue '{}' with OID: {}", name, print.getCurrentInstance().getOid());
            final StringBuilder menu = new StringBuilder()
                .append("<li><a href=\"").append(link).append("\">")
                .append(DBProperties.getProperty(name + ".Label")).append("</a></li>")
                .append(getSubMenues(print.getCurrentInstance()));
            subs.put(multi.getCurrentInstance().getId(), menu.toString());
        }
        if (!subs.isEmpty()) {
            ret.append("<ul>");
            for (final String sub : subs.values()) {
                ret.append(sub).append("\n");
            }
            ret.append("</ul>");
        }
        return ret;
    }
private CharSequence getSubMenues(final Instance _instance)
        throws EFapsException
    {
        HelpServlet.LOG.debug("Reading Submenues for OID: {}", _instance.getOid());
        final StringBuilder ret = new StringBuilder();

        final QueryBuilder queryBldr = new QueryBuilder(Type.get("Admin_Help_Menu2Menu"));
        queryBldr.addWhereAttrEqValue("FromLink", _instance.getId());
        final MultiPrintQuery multi = queryBldr.getPrint();
        multi.addSelect("linkto[ToLink].attribute[Name]", "linkto[ToLink].oid");
        multi.execute();
        final Map<Long, String> subs = new TreeMap<Long, String>();

        while (multi.next()) {
            final String name = multi.<String>getSelect("linkto[ToLink].attribute[Name]");
            final String oid = multi.<String>getSelect("linkto[ToLink].oid");
            final PrintQuery print = new PrintQuery(oid);
            print.addSelect("linkfrom[Admin_Help_Menu2Wiki#FromLink].linkto[ToLink].attribute[Name]");
            print.execute();
            String link = "";
            final Object links = print
                            .getSelect("linkfrom[Admin_Help_Menu2Wiki#FromLink].linkto[ToLink].attribute[Name]");
            if (links instanceof List<?>) {
                for (final Object alink : (List<?>) links) {
                    link = link + ":" + alink;
                }
            } else {
                link = (String) links;
            }
            HelpServlet.LOG.debug("  Submenue '{}' with OID: {}", name, print.getCurrentInstance().getOid());
            final StringBuilder menu = new StringBuilder()
                .append("<li><a href=\"").append(link).append("\">")
                .append(DBProperties.getProperty(name + ".Label")).append("</a></li>")
                .append(getSubMenues(print.getCurrentInstance()));
            subs.put(multi.getCurrentInstance().getId(), menu.toString());
        }
        if (!subs.isEmpty()) {
            ret.append("<ul>");
            for (final String sub : subs.values()) {
                ret.append(sub).append("\n");
            }
            ret.append("</ul>");
        }
        return ret;
    }
Recursive method to get the CharSequence for the sub menu.

@param _instance Instance of the parent menu
@return the menu
@throws EFapsException on error