use of com.helger.html.hc.html.grouping.HCHR in project phoss-directory by phax.
the class AbstractPagePublicSearch method createParticipantDetails.
@Nonnull
protected HCNodeList createParticipantDetails(@Nonnull final Locale aDisplayLocale, @Nonnull final String sParticipantID, @Nonnull final IParticipantIdentifier aParticipantID, final boolean bIsLoggedInUserAdministrator) {
final HCNodeList aDetails = new HCNodeList();
// Search document matching participant ID
final ICommonsList<PDStoredBusinessEntity> aResultDocs = PDMetaManager.getStorageMgr().getAllDocumentsOfParticipant(aParticipantID);
// Group by participant ID
final ICommonsMap<IParticipantIdentifier, ICommonsList<PDStoredBusinessEntity>> aGroupedDocs = PDStorageManager.getGroupedByParticipantID(aResultDocs);
if (aGroupedDocs.isEmpty())
LOGGER.error("No stored document matches participant identifier '" + sParticipantID + "' - cannot show details");
else {
if (aGroupedDocs.size() > 1)
LOGGER.warn("Found " + aGroupedDocs.size() + " entries for participant identifier '" + sParticipantID + "' - weird");
// Get the first one
final ICommonsList<PDStoredBusinessEntity> aStoredEntities = aGroupedDocs.getFirstValue();
// Details header
{
IHCNode aDetailsHeader = null;
final boolean bIsPeppolDefault = aParticipantID.hasScheme(PeppolIdentifierFactory.INSTANCE.getDefaultParticipantIdentifierScheme());
if (bIsPeppolDefault) {
final IParticipantIdentifierScheme aIIA = ParticipantIdentifierSchemeManager.getSchemeOfIdentifier(aParticipantID);
if (aIIA != null) {
final HCH1 aH1 = h1("Details for: " + aParticipantID.getValue());
if (StringHelper.hasText(aIIA.getSchemeAgency()))
aH1.addChild(small(" (" + aIIA.getSchemeAgency() + ")"));
aDetailsHeader = new BootstrapPageHeader().addChild(aH1);
}
}
if (aDetailsHeader == null) {
// Fallback
aDetailsHeader = BootstrapWebPageUIHandler.INSTANCE.createPageHeader("Details for " + sParticipantID);
}
aDetails.addChild(aDetailsHeader);
}
final BootstrapTabBox aTabBox = new BootstrapTabBox();
// Business information
{
final HCNodeList aOL = new HCNodeList();
int nIndex = 1;
for (final PDStoredBusinessEntity aStoredEntity : aStoredEntities) {
final BootstrapCard aCard = aOL.addAndReturnChild(new BootstrapCard());
aCard.addClass(CSS_CLASS_RESULT_PANEL);
if (aStoredEntities.size() > 1)
aCard.createAndAddHeader().addChild("Business information entity " + nIndex);
final BootstrapViewForm aViewForm = PDCommonUI.showBusinessInfoDetails(aStoredEntity, aDisplayLocale);
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("Full Peppol participant ID").setCtrl(code(sParticipantID)));
if (GlobalDebug.isDebugMode() || bIsLoggedInUserAdministrator) {
aViewForm.addChild(new HCHR());
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Creation DT").setCtrl(PDTToString.getAsString(aStoredEntity.getMetaData().getCreationDT(), aDisplayLocale)));
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Owner ID").setCtrl(code(aStoredEntity.getMetaData().getOwnerID())));
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Requesting Host").setCtrl(code(aStoredEntity.getMetaData().getRequestingHost())));
}
aCard.createAndAddBody().addChild(aViewForm);
++nIndex;
}
// Add whole list or just the first item?
final IHCNode aTabLabel = span("Business information ").addChild(badgePrimary(aStoredEntities.size()));
aTabBox.addTab("businessinfo", aTabLabel, aOL, true);
}
// Document types
{
final HCNodeList aDocTypeCtrl = new HCNodeList();
final ICommonsList<String> aNames = new CommonsArrayList<>();
for (final PDStoredBusinessEntity aStoredEntity : aStoredEntities) aNames.addAllMapped(aStoredEntity.names(), PDStoredMLName::getName);
aDocTypeCtrl.addChild(info("The following document types are supported by " + _getImplodedMapped(", ", " and ", aNames, x -> "'" + x + "'") + ":"));
HCOL aDocTypeOL = null;
final ICommonsList<IDocumentTypeIdentifier> aDocTypeIDs = aResultDocs.getFirst().documentTypeIDs().getSorted(IDocumentTypeIdentifier.comparator());
for (final IDocumentTypeIdentifier aDocTypeID : aDocTypeIDs) {
if (aDocTypeOL == null)
aDocTypeOL = aDocTypeCtrl.addAndReturnChild(new HCOL());
final HCLI aLI = aDocTypeOL.addItem();
aLI.addChild(NiceNameUI.getDocumentTypeID(aDocTypeID));
}
if (aDocTypeOL == null)
aDocTypeCtrl.addChild(warn("This participant does not support any document types!"));
aTabBox.addTab("doctypes", span("Supported document types ").addChild(badgePrimary(aDocTypeIDs.size())), aDocTypeCtrl, false);
}
aDetails.addChild(aTabBox);
}
return aDetails;
}
use of com.helger.html.hc.html.grouping.HCHR in project phoss-smp by phax.
the class SMPCommonUI method getExtensionDisplay.
@Nullable
public static IHCNode getExtensionDisplay(@Nonnull final ISMPHasExtension aHasExtension) {
final ICommonsList<com.helger.xsds.bdxr.smp1.ExtensionType> aExtensions = aHasExtension.extensions();
if (aExtensions.isEmpty())
return null;
final HCNodeList aNL = new HCNodeList();
for (final com.helger.xsds.bdxr.smp1.ExtensionType aExtension : aExtensions) {
if (aNL.hasChildren()) {
// add a separator line
aNL.addChild(new HCHR());
}
// Use only the XML element of the first extension
final Element aAny = (Element) aExtension.getAny();
final String sXML = XMLWriter.getNodeAsString(aAny);
aNL.addChild(new HCPrismJS(EPrismLanguage.MARKUP).addChild(sXML));
}
return aNL;
}
use of com.helger.html.hc.html.grouping.HCHR in project phoss-directory by phax.
the class PageSecureParticipantCount method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope();
final HCNodeList aNodeList = aWPEC.getNodeList();
{
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.MAGNIFIER);
aToolbar.addButton("Delete deleted", AJAX_DELETE_DELETED.getInvocationURL(aRequestScope), EDefaultIcon.DELETE);
aNodeList.addChild(aToolbar);
}
final int nNotDeletedCount = PDMetaManager.getStorageMgr().getContainedParticipantCount(EQueryMode.NON_DELETED_ONLY);
aNodeList.addChild(h3(nNotDeletedCount + " participants (entities) are contained"));
final int nDeletedCount = PDMetaManager.getStorageMgr().getContainedParticipantCount(EQueryMode.DELETED_ONLY);
aNodeList.addChild(h3(nDeletedCount + " deleted participants (entities) are contained"));
final int nReIndexCount = PDMetaManager.getIndexerMgr().getReIndexList().getItemCount();
aNodeList.addChild(h3(nReIndexCount + " re-index items are contained"));
final int nDeadCount = PDMetaManager.getIndexerMgr().getDeadList().getItemCount();
aNodeList.addChild(h3(nDeadCount + " dead items are contained"));
if (false)
try {
final Collector aCollector = new AllDocumentsCollector(PDMetaManager.getLucene(), (aDoc, nIdx) -> {
final BootstrapTable aTable = new BootstrapTable();
for (final IndexableField f : aDoc.getFields()) aTable.addBodyRow().addCells(f.name(), f.fieldType().toString(), f.stringValue());
aNodeList.addChild(aTable);
aNodeList.addChild(new HCHR());
});
PDMetaManager.getStorageMgr().searchAtomic(new MatchAllDocsQuery(), aCollector);
} catch (final IOException ex) {
}
}
Aggregations