Search in sources :

Example 1 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-directory by phax.

the class PageSecureListIndex method fillContent.

@Override
protected void fillContent(final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    // Add toolbar
    {
        final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
        aToolbar.addChild(new BootstrapButton().addChild("Refresh").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref()));
        aToolbar.addChild(span("Current server time: " + PDTToString.getAsString(PDTFactory.getCurrentLocalTime(), aDisplayLocale)).addClass(PDCommonUI.CSS_CLASS_VERTICAL_PADDED_TEXT));
    }
    final LinkedBlockingQueue<Object> aQueue = PDMetaManager.getIndexerMgr().getIndexerWorkQueue().getQueue();
    final int nLength = aQueue.size();
    if (nLength == 0) {
        aNodeList.addChild(success("The Index Queue is currently empty"));
    } else {
        aNodeList.addChild(info("The Index Queue contains " + nLength + " entries"));
        final BootstrapTable aTable = new BootstrapTable(new DTCol("Queue date time").setDisplayType(EDTColType.DATETIME, aDisplayLocale).setInitialSorting(ESortOrder.DESCENDING), new DTCol("Participant ID"), new DTCol("Action"), new DTCol("Owner"), new DTCol("Requestor")).setID("indexqueue");
        for (final Object o : aQueue) if (o instanceof IIndexerWorkItem) {
            final IIndexerWorkItem aObj = (IIndexerWorkItem) o;
            final HCRow aRow = aTable.addBodyRow();
            aRow.addCell(PDTToString.getAsString(aObj.getCreationDateTime(), aDisplayLocale));
            aRow.addCell(aObj.getParticipantID().getURIEncoded());
            aRow.addCell(aObj.getType().getDisplayName());
            aRow.addCell(aObj.getOwnerID());
            aRow.addCell(aObj.getRequestingHost());
        }
        aNodeList.addChild(aTable).addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
    }
}
Also used : Locale(java.util.Locale) IIndexerWorkItem(com.helger.pd.indexer.index.IIndexerWorkItem) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) HCRow(com.helger.html.hc.html.tabular.HCRow) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)

Example 2 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-directory by phax.

the class PageSecureAdminSMLConfiguration method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMLInfoManager aSMLInfoMgr = PDPMetaManager.getSMLInfoMgr();
    aNodeList.addChild(info("This page lets you create custom SML configurations that can be used for registration."));
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new SML configuration", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("DNS Zone"), new DTCol("Management Service URL"), new DTCol("Client Cert?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMLInfo aCurObject : aSMLInfoMgr.getAll()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
        aRow.addCell(aCurObject.getDNSZone());
        aRow.addCell(aCurObject.getManagementServiceURL());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isClientCertificateRequired(), aDisplayLocale));
        aRow.addCell(createEditLink(aWPEC, aCurObject, "Edit " + aCurObject.getID()), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + aCurObject.getID()), new HCTextNode(" "), isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject) ? createDeleteLink(aWPEC, aCurObject, "Delete " + aCurObject.getDisplayName()) : createEmptyAction());
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) ISMLInfo(com.helger.peppol.sml.ISMLInfo) HCA(com.helger.html.hc.html.textlevel.HCA) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) ISMLInfoManager(com.helger.pd.publisher.app.ISMLInfoManager) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) HCTextNode(com.helger.html.hc.impl.HCTextNode) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 3 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-smp by phax.

the class PageSecureBusinessCard method showBusinessCardEntity.

@Nonnull
public static IHCNode showBusinessCardEntity(@Nonnull final SMPBusinessCardEntity aEntity, final int nIndex, @Nonnull final Locale aDisplayLocale) {
    final BootstrapCard aPanel = new BootstrapCard();
    aPanel.createAndAddHeader().addChild("Business Entity " + nIndex);
    final BootstrapViewForm aForm2 = aPanel.createAndAddBody().addAndReturnChild(new BootstrapViewForm());
    aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Name").setCtrl(aEntity.names().getFirst().getName()));
    {
        final Locale aCountry = CountryCache.getInstance().getCountry(aEntity.getCountryCode());
        final HCNodeList aCtrl = new HCNodeList();
        final EFamFamFlagIcon eIcon = EFamFamFlagIcon.getFromIDOrNull(aCountry.getCountry());
        if (eIcon != null) {
            aCtrl.addChild(eIcon.getAsNode());
            aCtrl.addChild(" ");
        }
        aCtrl.addChild(aCountry.getDisplayCountry(aDisplayLocale) + " [" + aEntity.getCountryCode() + "]");
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Country code").setCtrl(aCtrl));
    }
    if (aEntity.hasGeographicalInformation()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Geographical information").setCtrl(HCExtHelper.nl2divList(aEntity.getGeographicalInformation())));
    }
    if (aEntity.identifiers().isNotEmpty()) {
        final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star());
        aTable.addHeaderRow().addCells("Scheme", "Value");
        for (final SMPBusinessCardIdentifier aIdentifier : aEntity.identifiers()) aTable.addBodyRow().addCells(aIdentifier.getScheme(), aIdentifier.getValue());
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Identifiers").setCtrl(aTable));
    }
    if (aEntity.websiteURIs().isNotEmpty()) {
        final HCNodeList aNL = new HCNodeList();
        for (final String sWebsiteURI : aEntity.websiteURIs()) aNL.addChild(new HCDiv().addChild(HCA.createLinkedWebsite(sWebsiteURI)));
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Website URIs").setCtrl(aNL));
    }
    if (aEntity.contacts().isNotEmpty()) {
        final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star(), HCCol.star(), HCCol.star());
        aTable.addHeaderRow().addCells("Type", "Name", "Phone number", "Email address");
        for (final SMPBusinessCardContact aContact : aEntity.contacts()) {
            final HCRow aBodyRow = aTable.addBodyRow();
            aBodyRow.addCells(aContact.getType(), aContact.getName(), aContact.getPhoneNumber());
            aBodyRow.addCell(HCA_MailTo.createLinkedEmail(aContact.getEmail()));
        }
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Contacts").setCtrl(aTable));
    }
    if (aEntity.hasAdditionalInformation()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Additional information").setCtrl(HCExtHelper.nl2divList(aEntity.getAdditionalInformation())));
    }
    if (aEntity.hasRegistrationDate()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Registration date").setCtrl(PDTToString.getAsString(aEntity.getRegistrationDate(), aDisplayLocale)));
    }
    return aPanel;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) SMPBusinessCardContact(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardContact) BootstrapCard(com.helger.photon.bootstrap4.card.BootstrapCard) HCNodeList(com.helger.html.hc.impl.HCNodeList) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) Nonnull(javax.annotation.Nonnull)

Example 4 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-smp by phax.

the class PageSecureEndpointChangeURL method fillContent.

@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
    final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
    final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr();
    boolean bShowList = true;
    final ICommonsMap<String, ICommonsList<ISMPEndpoint>> aEndpointsGroupedPerURL = new CommonsHashMap<>();
    final ICommonsMap<String, ICommonsSet<ISMPServiceGroup>> aServiceGroupsGroupedPerURL = new CommonsHashMap<>();
    final ICommonsList<ISMPServiceInformation> aAllSIs = aServiceInfoMgr.getAllSMPServiceInformation();
    int nTotalEndpointCount = 0;
    int nTotalEndpointCountWithURL = 0;
    for (final ISMPServiceInformation aSI : aAllSIs) {
        final ISMPServiceGroup aSG = aSI.getServiceGroup();
        for (final ISMPProcess aProcess : aSI.getAllProcesses()) for (final ISMPEndpoint aEndpoint : aProcess.getAllEndpoints()) {
            ++nTotalEndpointCount;
            if (aEndpoint.hasEndpointReference()) {
                aEndpointsGroupedPerURL.computeIfAbsent(aEndpoint.getEndpointReference(), k -> new CommonsArrayList<>()).add(aEndpoint);
                aServiceGroupsGroupedPerURL.computeIfAbsent(aEndpoint.getEndpointReference(), k -> new CommonsHashSet<>()).add(aSG);
                ++nTotalEndpointCountWithURL;
            }
        }
    }
    {
        final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
        aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
        aNodeList.addChild(aToolbar);
        final int nCount = BulkChangeEndpointURL.getRunningJobCount();
        if (nCount > 0) {
            aNodeList.addChild(warn((nCount == 1 ? "1 bulk change is" : nCount + " bulk changes are") + " currently running in the background"));
        }
    }
    if (aWPEC.hasAction(CPageParam.ACTION_EDIT)) {
        bShowList = false;
        final FormErrorList aFormErrors = new FormErrorList();
        final String sOldURL = aWPEC.params().getAsString(FIELD_OLD_URL);
        if (aWPEC.hasSubAction(CPageParam.ACTION_SAVE)) {
            // Find selected service group (if any)
            final String sServiceGroupID = aWPEC.params().getAsString(FIELD_SERVICE_GROUP);
            ISMPServiceGroup aServiceGroup = null;
            if (StringHelper.hasText(sServiceGroupID)) {
                final IParticipantIdentifier aParticipantID = aIdentifierFactory.parseParticipantIdentifier(sServiceGroupID);
                if (aParticipantID != null)
                    aServiceGroup = aServiceGroupMgr.getSMPServiceGroupOfID(aParticipantID);
            }
            final String sNewURL = aWPEC.params().getAsString(FIELD_NEW_URL);
            if (StringHelper.hasNoText(sOldURL))
                aFormErrors.addFieldInfo(FIELD_OLD_URL, "An old URL must be provided");
            else if (!URLValidator.isValid(sOldURL))
                aFormErrors.addFieldInfo(FIELD_OLD_URL, "The old URL is invalid");
            if (StringHelper.hasNoText(sNewURL))
                aFormErrors.addFieldInfo(FIELD_NEW_URL, "A new URL must be provided");
            else if (!URLValidator.isValid(sNewURL))
                aFormErrors.addFieldInfo(FIELD_NEW_URL, "The new URL is invalid");
            else if (sNewURL.equals(sOldURL))
                aFormErrors.addFieldInfo(FIELD_NEW_URL, "The new URL is identical to the old URL");
            // Validate parameters
            if (aFormErrors.isEmpty()) {
                PhotonWorkerPool.getInstance().run("BulkChangeEndpointURL", new BulkChangeEndpointURL(aAllSIs, aServiceGroup, sOldURL, sNewURL));
                aWPEC.postRedirectGetInternal(success("The bulk change of the endpoint URL from '" + sOldURL + "' to '" + sNewURL + "' is now running in the background. Please manually refresh the page to see the update."));
            }
        }
        final ICommonsSet<ISMPServiceGroup> aServiceGroups = aServiceGroupsGroupedPerURL.get(sOldURL);
        final int nSGCount = CollectionHelper.getSize(aServiceGroups);
        final int nEPCount = CollectionHelper.getSize(aEndpointsGroupedPerURL.get(sOldURL));
        aNodeList.addChild(info("The selected old URL '" + sOldURL + "' is currently used in " + nEPCount + " " + (nEPCount == 1 ? "endpoint" : "endpoints") + " of " + nSGCount + " " + (nSGCount == 1 ? "service group" : "service groups") + "."));
        // Show edit screen
        final BootstrapForm aForm = aNodeList.addAndReturnChild(getUIHandler().createFormSelf(aWPEC));
        aForm.addChild(new HCHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_EDIT));
        aForm.addChild(new HCHiddenField(CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE));
        if (nSGCount > 1) {
            // Select the affected service groups if more than one is available
            final HCSelect aSGSelect = new HCSelect(new RequestField(FIELD_SERVICE_GROUP));
            aSGSelect.addOption(SERVICE_GROUP_ALL, "All affected Service Groups");
            if (aServiceGroups != null)
                for (final ISMPServiceGroup aSG : aServiceGroups.getSorted(ISMPServiceGroup.comparator())) aSGSelect.addOption(aSG.getID(), aSG.getParticipantIdentifier().getURIEncoded());
            aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service group").setCtrl(aSGSelect).setHelpText("If a specific service group is selected, the URL change will only happen in the endpoints of the selected service group. Othwerwise the endpoint is changed in ALL service groups with matching endpoints.").setErrorList(aFormErrors.getListOfField(FIELD_OLD_URL)));
        } else {
            // If less than 2 service groups are affected, use the 0/1
            // automatically.
            aForm.addChild(new HCHiddenField(FIELD_SERVICE_GROUP, SERVICE_GROUP_ALL));
        }
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Old endpoint URL").setCtrl(new HCEdit(new RequestField(FIELD_OLD_URL, sOldURL))).setHelpText("The old URL that is to be changed in all matching endpoints").setErrorList(aFormErrors.getListOfField(FIELD_OLD_URL)));
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("New endpoint URL").setCtrl(new HCEdit(new RequestField(FIELD_NEW_URL, sOldURL))).setHelpText("The new URL that is used instead").setErrorList(aFormErrors.getListOfField(FIELD_NEW_URL)));
        final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(getUIHandler().createToolbar(aWPEC));
        aToolbar.addSubmitButton("Save changes", EDefaultIcon.SAVE);
        aToolbar.addButtonCancel(aDisplayLocale);
    }
    if (bShowList) {
        aNodeList.addChild(info().addChildren(div("This page lets you change the URLs of multiple endpoints at once. This is e.g. helpful when the underlying server got a new URL."), div("Currently " + (nTotalEndpointCount == 1 ? "1 endpoint is" : nTotalEndpointCount + " endpoints are") + " registered" + (nTotalEndpointCountWithURL < nTotalEndpointCount ? " of which " + nTotalEndpointCountWithURL + " have an endpoint reference" : "") + ".")));
        final HCTable aTable = new HCTable(new DTCol("Endpoint URL").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Service Group Count").setDisplayType(EDTColType.INT, aDisplayLocale), new DTCol("Endpoint Count").setDisplayType(EDTColType.INT, aDisplayLocale), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
        aEndpointsGroupedPerURL.forEach((sURL, aEndpoints) -> {
            final HCRow aRow = aTable.addBodyRow();
            aRow.addCell(sURL);
            final int nSGCount = CollectionHelper.getSize(aServiceGroupsGroupedPerURL.get(sURL));
            aRow.addCell(Integer.toString(nSGCount));
            aRow.addCell(Integer.toString(aEndpoints.size()));
            final ISimpleURL aEditURL = aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, CPageParam.ACTION_EDIT).add(FIELD_OLD_URL, sURL);
            aRow.addCell(new HCA(aEditURL).setTitle("Change all endpoints pointing to " + sURL).addChild(EDefaultIcon.EDIT.getAsNode()));
        });
        final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
        aNodeList.addChild(aTable).addChild(aDataTables);
    }
}
Also used : Locale(java.util.Locale) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) ICommonsList(com.helger.commons.collection.impl.ICommonsList) HCNodeList(com.helger.html.hc.impl.HCNodeList) FormErrorList(com.helger.photon.core.form.FormErrorList) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCRow(com.helger.html.hc.html.tabular.HCRow) CommonsHashMap(com.helger.commons.collection.impl.CommonsHashMap) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) ISMPProcess(com.helger.phoss.smp.domain.serviceinfo.ISMPProcess) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) RequestField(com.helger.photon.core.form.RequestField) ISMPServiceInformationManager(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager) HCHiddenField(com.helger.html.hc.html.forms.HCHiddenField) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) HCA(com.helger.html.hc.html.textlevel.HCA) ISMPEndpoint(com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint) ISMPServiceInformation(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation) HCSelect(com.helger.html.hc.html.forms.HCSelect) ISMPEndpoint(com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint) SMPEndpoint(com.helger.phoss.smp.domain.serviceinfo.SMPEndpoint) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) HCTable(com.helger.html.hc.html.tabular.HCTable) ICommonsSet(com.helger.commons.collection.impl.ICommonsSet) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 5 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-smp by phax.

the class PageSecureEndpointList method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr();
    final ICommonsList<ISMPServiceInformation> aAllServiceInfos = aServiceInfoMgr.getAllSMPServiceInformation();
    // Count unique service groups
    final ICommonsSet<String> aServiceGroupIDs = new CommonsHashSet<>();
    aAllServiceInfos.findAllMapped(ISMPServiceInformation::getServiceGroupID, aServiceGroupIDs::add);
    final boolean bHideDetails = aServiceGroupIDs.size() > 1000;
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new Endpoint", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
    if (!bHideDetails)
        aToolbar.addButton("Tree view", aWPEC.getLinkToMenuItem(CMenuSecure.MENU_ENDPOINT_TREE), EDefaultIcon.MAGNIFIER);
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("Service group").setInitialSorting(ESortOrder.ASCENDING).setDataSort(0, 1, 2, 3), new DTCol("Document type ID").setDataSort(1, 0, 2, 3), new DTCol("Process ID").setDataSort(2, 0, 1, 3), new DTCol("Transport profile").setDataSort(3, 0, 1, 2), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMPServiceInformation aServiceInfo : aAllServiceInfos) {
        final ISMPServiceGroup aServiceGroup = aServiceInfo.getServiceGroup();
        final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
        final IDocumentTypeIdentifier aDocTypeID = aServiceInfo.getDocumentTypeIdentifier();
        for (final ISMPProcess aProcess : aServiceInfo.getAllProcesses()) {
            final IProcessIdentifier aProcessID = aProcess.getProcessIdentifier();
            for (final ISMPEndpoint aEndpoint : aProcess.getAllEndpoints()) {
                final StringMap aParams = createParamMap(aServiceInfo, aProcess, aEndpoint);
                final HCRow aRow = aTable.addBodyRow();
                final ISimpleURL aViewURL = createViewURL(aWPEC, aServiceInfo, aParams);
                aRow.addCell(new HCA(aViewURL).addChild(aServiceGroup.getID()));
                aRow.addCell(NiceNameUI.getDocumentTypeID(aDocTypeID, false));
                aRow.addCell(NiceNameUI.getProcessID(aDocTypeID, aProcessID, false));
                final String sTransportProfile = aEndpoint.getTransportProfile();
                aRow.addCell(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_TRANSPORT_PROFILES, sTransportProfile)).addChild(NiceNameUI.getTransportProfile(sTransportProfile, false)));
                final ISimpleURL aEditURL = createEditURL(aWPEC, aServiceInfo).addAll(aParams);
                final ISimpleURL aCopyURL = createCopyURL(aWPEC, aServiceInfo).addAll(aParams);
                final ISimpleURL aDeleteURL = createDeleteURL(aWPEC, aServiceInfo).addAll(aParams);
                final ISimpleURL aPreviewURL = LinkHelper.getURLWithServerAndContext(aParticipantID.getURIPercentEncoded() + SMPRestFilter.PATH_SERVICES + aDocTypeID.getURIPercentEncoded());
                aRow.addCell(new HCA(aViewURL).setTitle("View endpoint").addChild(EDefaultIcon.MAGNIFIER.getAsNode()), new HCTextNode(" "), new HCA(aEditURL).setTitle("Edit endpoint").addChild(EDefaultIcon.EDIT.getAsNode()), new HCTextNode(" "), new HCA(aCopyURL).setTitle("Copy endpoint").addChild(EDefaultIcon.COPY.getAsNode()), new HCTextNode(" "), new HCA(aDeleteURL).setTitle("Delete endpoint").addChild(EDefaultIcon.DELETE.getAsNode()), new HCTextNode(" "), new HCA(aPreviewURL).setTitle("Perform SMP query on endpoint").setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
            }
        }
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) StringMap(com.helger.commons.collection.attr.StringMap) HCNodeList(com.helger.html.hc.impl.HCNodeList) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) HCRow(com.helger.html.hc.html.tabular.HCRow) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) CommonsHashSet(com.helger.commons.collection.impl.CommonsHashSet) ISMPProcess(com.helger.phoss.smp.domain.serviceinfo.ISMPProcess) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) ISMPServiceInformationManager(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) HCA(com.helger.html.hc.html.textlevel.HCA) ISMPEndpoint(com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint) ISMPServiceInformation(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) HCTextNode(com.helger.html.hc.impl.HCTextNode) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Aggregations

HCRow (com.helger.html.hc.html.tabular.HCRow)20 Locale (java.util.Locale)19 HCNodeList (com.helger.html.hc.impl.HCNodeList)18 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)16 HCTable (com.helger.html.hc.html.tabular.HCTable)15 ISimpleURL (com.helger.commons.url.ISimpleURL)14 HCA (com.helger.html.hc.html.textlevel.HCA)14 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)14 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)12 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)12 DataTables (com.helger.photon.uictrls.datatables.DataTables)11 PDTToString (com.helger.commons.datetime.PDTToString)7 HCTextNode (com.helger.html.hc.impl.HCTextNode)7 Nonnull (javax.annotation.Nonnull)7 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)6 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)5 ICommonsList (com.helger.commons.collection.impl.ICommonsList)4 PDTFromString (com.helger.commons.datetime.PDTFromString)4 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)4 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)4