@Nonnull
  private BootstrapRow _createSmallQueryBox(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCForm aSmallQueryBox =
        new HCForm().setAction(aWPEC.getSelfHref()).setMethod(EHCFormMethod.GET);
    aSmallQueryBox.addChild(
        new BootstrapInputGroup(_createQueryEdit())
            .addSuffix(new BootstrapSubmitButton().setIcon(EDefaultIcon.MAGNIFIER))
            .addClass(CSS_CLASS_SMALL_QUERY_BOX));

    final BootstrapRow aBodyRow = new BootstrapRow();
    aBodyRow.createColumn(12, 6, 6, 6).addChild(aSmallQueryBox);
    return aBodyRow;
  }
  @Override
  protected void fillContent(final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();

    {
      final BootstrapRow aHeaderRow = aNodeList.addAndReturnChild(new BootstrapRow());
      // The logo
      aHeaderRow.createColumn(12, 12, 1, 2).addClass(CBootstrapCSS.HIDDEN_SM);
      aHeaderRow
          .createColumn(12, 6, 5, 4)
          .addChild(
              new HCExtImg(new SimpleURL("/imgs/pd-logo.png")).addClass(CBootstrapCSS.PULL_LEFT));
      aHeaderRow
          .createColumn(12, 6, 5, 4)
          .addChild(
              new HCExtImg(new SimpleURL("/imgs/peppol.png")).addClass(CBootstrapCSS.PULL_RIGHT));
      aHeaderRow.createColumn(12, 12, 1, 2).addClass(CBootstrapCSS.HIDDEN_SM);
    }

    final String sQuery = aWPEC.getAttributeAsString(FIELD_QUERY);
    final String sParticipantID = aWPEC.getAttributeAsString(FIELD_PARTICIPANT_ID);
    boolean bShowQuery = true;

    if (aWPEC.hasAction(CPageParam.ACTION_VIEW) && StringHelper.hasText(sParticipantID)) {
      final IParticipantIdentifier aParticipantID =
          aIdentifierFactory.parseParticipantIdentifier(sParticipantID);
      if (aParticipantID != null) {
        // Show small query box
        aNodeList.addChild(_createSmallQueryBox(aWPEC));

        // Search document matching participant ID
        final ICommonsList<PDStoredDocument> aResultDocs =
            PDMetaManager.getStorageMgr().getAllDocumentsOfParticipant(aParticipantID);
        // Group by participant ID
        final IMultiMapListBased<IParticipantIdentifier, PDStoredDocument> aGroupedDocs =
            PDStorageManager.getGroupedByParticipantID(aResultDocs);
        if (aGroupedDocs.isEmpty())
          s_aLogger.warn(
              "No stored document matches participant identifier '" + sParticipantID + "'");
        else {
          if (aGroupedDocs.size() > 1)
            s_aLogger.warn(
                "Found "
                    + aGroupedDocs.size()
                    + " entries for participant identifier '"
                    + sParticipantID
                    + "' - weird");
          // Get the first one
          final List<PDStoredDocument> aDocuments =
              CollectionHelper.getFirstElement(aGroupedDocs.values());
          bShowQuery = false;

          aNodeList.addChild(getUIHandler().createPageHeader("Details for " + sParticipantID));

          final BootstrapTabBox aTabBox = aNodeList.addAndReturnChild(new BootstrapTabBox());

          // Business information
          {
            final HCNodeList aOL = new HCNodeList();
            int nIndex = 1;
            for (final PDStoredDocument aStoredDoc : aDocuments) {
              final BootstrapPanel aPanel = aOL.addAndReturnChild(new BootstrapPanel());
              if (aDocuments.size() > 1)
                aPanel.getOrCreateHeader().addChild("Business information entity " + nIndex);
              aPanel
                  .getBody()
                  .addChild(PDCommonUI.showBusinessInfoDetails(aStoredDoc, aDisplayLocale));
              ++nIndex;
            }
            // Add whole list or just the first item?
            final IHCNode aTabLabel =
                new HCSpan()
                    .addChild("Business information ")
                    .addChild(new BootstrapBadge().addChild(Integer.toString(aDocuments.size())));
            aTabBox.addTab("businessinfo", aTabLabel, aOL, true);
          }

          // Document types
          {
            final HCOL aDocTypeCtrl = new HCOL();
            final List<IDocumentTypeIdentifier> aDocTypeIDs =
                CollectionHelper.getSorted(
                    aResultDocs.get(0).getAllDocumentTypeIDs(),
                    IDocumentTypeIdentifier.comparator());
            for (final IDocumentTypeIdentifier aDocTypeID : aDocTypeIDs) {
              final IHCLI<?> aLI = aDocTypeCtrl.addItem();
              aLI.addChild(PDCommonUI.getDocumentTypeID(aDocTypeID));
              try {
                final IPeppolDocumentTypeIdentifierParts aParts =
                    PeppolIdentifierHelper.getDocumentTypeIdentifierParts(aDocTypeID);
                aLI.addChild(PDCommonUI.getDocumentTypeIDDetails(aParts));
              } catch (final IllegalArgumentException ex) {
                // Happens for non-PEPPOL identifiers
              }
            }
            aTabBox.addTab(
                "doctypes",
                new HCSpan()
                    .addChild("Document types ")
                    .addChild(new BootstrapBadge().addChild(Integer.toString(aDocTypeIDs.size()))),
                aDocTypeCtrl.hasChildren()
                    ? aDocTypeCtrl
                    : new BootstrapWarnBox()
                        .addChild("No document types available for this participant"),
                false);
          }
        }
      } else s_aLogger.warn("Failed to parse participant identifier '" + sParticipantID + "'");
    }

    if (bShowQuery) {
      if (StringHelper.hasText(sQuery)) {
        // Show small query box
        aNodeList.addChild(_createSmallQueryBox(aWPEC));

        s_aLogger.info("Searching for '" + sQuery + "'");

        // Build Lucene query
        final Query aLuceneQuery =
            PDQueryManager.convertQueryStringToLuceneQuery(PDMetaManager.getLucene(), sQuery);

        if (s_aLogger.isDebugEnabled())
          s_aLogger.debug("Created query for '" + sQuery + "' is <" + aLuceneQuery + ">");

        // Search all documents
        final ICommonsList<PDStoredDocument> aResultDocs =
            PDMetaManager.getStorageMgr().getAllDocuments(aLuceneQuery);

        s_aLogger.info(
            "  Result for <" + aLuceneQuery + "> are " + aResultDocs.size() + " documents");

        // Group by participant ID
        final IMultiMapListBased<IParticipantIdentifier, PDStoredDocument> aGroupedDocs =
            PDStorageManager.getGroupedByParticipantID(aResultDocs);

        final int nMaxResults = 10;

        // Display results
        if (aGroupedDocs.isEmpty()) {
          aNodeList.addChild(
              new BootstrapInfoBox()
                  .addChild("No search results found for query '" + sQuery + "'"));
        } else {
          final HCOL aOL = new HCOL().setStart(1);
          for (final Map.Entry<IParticipantIdentifier, ICommonsList<PDStoredDocument>> aEntry :
              aGroupedDocs.entrySet()) {
            final IParticipantIdentifier aDocParticipantID = aEntry.getKey();
            final ICommonsList<PDStoredDocument> aDocs = aEntry.getValue();

            // Start result document
            final HCDiv aResultItem = new HCDiv().addClass(CSS_CLASS_RESULT_DOC);
            final HCDiv aHeadRow = aResultItem.addAndReturnChild(new HCDiv());
            aHeadRow.addChild(aDocParticipantID.getURIEncoded());
            if (aDocs.size() > 1) aHeadRow.addChild(" (" + aDocs.size() + " entities)");
            aHeadRow
                .addChild(" ")
                .addChild(
                    new BootstrapButton(EBootstrapButtonType.SUCCESS, EBootstrapButtonSize.MINI)
                        .addChild("Show details")
                        .setIcon(EDefaultIcon.MAGNIFIER)
                        .setOnClick(
                            aWPEC
                                .getSelfHref()
                                .add(FIELD_QUERY, sQuery)
                                .add(CPageParam.PARAM_ACTION, CPageParam.ACTION_VIEW)
                                .add(FIELD_PARTICIPANT_ID, aDocParticipantID.getURIEncoded())));

            // Show all entities of the stored document
            final HCUL aUL = aResultItem.addAndReturnChild(new HCUL());
            for (final PDStoredDocument aStoredDoc : aEntry.getValue()) {
              final IHCLI<?> aLI =
                  aUL.addAndReturnItem(new HCLI().addClass(CSS_CLASS_RESULT_DOC_HEADER));
              final HCDiv aDocHeadRow = new HCDiv();
              if (aStoredDoc.hasCountryCode()) {
                // Add country flag (if available)
                aDocHeadRow.addChild(PDCommonUI.getFlagNode(aStoredDoc.getCountryCode()));
                aDocHeadRow.addChild(
                    new HCSpan()
                        .addChild(aStoredDoc.getCountryCode())
                        .addClass(CSS_CLASS_RESULT_DOC_COUNTRY_CODE));
              }
              if (aStoredDoc.hasName())
                aDocHeadRow.addChild(
                    new HCSpan()
                        .addChild(aStoredDoc.getName())
                        .addClass(CSS_CLASS_RESULT_DOC_NAME));
              if (aDocHeadRow.hasChildren()) aLI.addChild(aDocHeadRow);

              if (aStoredDoc.hasGeoInfo())
                aLI.addChild(
                    new HCDiv()
                        .addChildren(HCExtHelper.nl2divList(aStoredDoc.getGeoInfo()))
                        .addClass(CSS_CLASS_RESULT_DOC_GEOINFO));
              if (aStoredDoc.hasAdditionalInformation())
                aLI.addChild(
                    new HCDiv()
                        .addChildren(HCExtHelper.nl2divList(aStoredDoc.getAdditionalInformation()))
                        .addClass(CSS_CLASS_RESULT_DOC_FREETEXT));
            }

            aOL.addItem(aResultItem);

            // Break at 10 results
            if (aOL.getChildCount() >= nMaxResults) break;
          }
          aNodeList.addChild(aOL);
        }
      } else {
        // Show big query box
        final HCForm aBigQueryBox =
            new HCForm().setAction(aWPEC.getSelfHref()).setMethod(EHCFormMethod.GET);
        aBigQueryBox.addChild(
            new HCDiv().addClass(CSS_CLASS_BIG_QUERY_BOX).addChild(_createQueryEdit()));
        aBigQueryBox.addChild(
            new HCDiv()
                .addClass(CSS_CLASS_BIG_QUERY_BUTTONS)
                .addChild(
                    new BootstrapSubmitButton()
                        .addChild("Search PEPPOL Directory")
                        .setIcon(EDefaultIcon.MAGNIFIER)));

        final BootstrapRow aBodyRow = aNodeList.addAndReturnChild(new BootstrapRow());
        aBodyRow.createColumn(12, 1, 2, 3).addClass(CBootstrapCSS.HIDDEN_XS);
        aBodyRow.createColumn(12, 10, 8, 6).addChild(aBigQueryBox);
        aBodyRow.createColumn(12, 1, 2, 3).addClass(CBootstrapCSS.HIDDEN_XS);
      }
    }
  }