Search in sources :

Example 6 with ISimpleURL

use of com.helger.commons.url.ISimpleURL 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)

Example 7 with ISimpleURL

use of com.helger.commons.url.ISimpleURL in project phoss-smp by phax.

the class PageSecureEndpointTree method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
    final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr();
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new Endpoint", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
    aToolbar.addButton("List view", aWPEC.getLinkToMenuItem(CMenuSecure.MENU_ENDPOINT_LIST), EDefaultIcon.MAGNIFIER);
    aNodeList.addChild(aToolbar);
    // Create list of service groups
    final ICommonsMap<ISMPServiceGroup, ICommonsList<ISMPServiceInformation>> aMap = new CommonsHashMap<>();
    aServiceInfoMgr.getAllSMPServiceInformation().forEach(x -> aMap.computeIfAbsent(x.getServiceGroup(), k -> new CommonsArrayList<>()).add(x));
    final HCUL aULSG = new HCUL();
    final ICommonsList<ISMPServiceGroup> aServiceGroups = aServiceGroupMgr.getAllSMPServiceGroups().getSortedInline(ISMPServiceGroup.comparator());
    for (final ISMPServiceGroup aServiceGroup : aServiceGroups) {
        // Print service group
        final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
        final HCLI aLISG = aULSG.addAndReturnItem(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aServiceGroup)).addChild(aParticipantID.getURIEncoded()));
        final HCUL aULDT = new HCUL();
        final ICommonsList<ISMPServiceInformation> aServiceInfos = aMap.get(aServiceGroup);
        if (aServiceInfos != null) {
            for (final ISMPServiceInformation aServiceInfo : aServiceInfos.getSortedInline(ISMPServiceInformation.comparator())) {
                final HCUL aULP = new HCUL();
                final IDocumentTypeIdentifier aDocTypeID = aServiceInfo.getDocumentTypeIdentifier();
                final ICommonsList<ISMPProcess> aProcesses = aServiceInfo.getAllProcesses().getSortedInline(ISMPProcess.comparator());
                for (final ISMPProcess aProcess : aProcesses) {
                    final BootstrapTable aEPTable = new BootstrapTable(HCCol.perc(40), HCCol.perc(40), HCCol.perc(20)).setBordered(true);
                    final ICommonsList<ISMPEndpoint> aEndpoints = aProcess.getAllEndpoints().getSortedInline(ISMPEndpoint.comparator());
                    for (final ISMPEndpoint aEndpoint : aEndpoints) {
                        final StringMap aParams = createParamMap(aServiceInfo, aProcess, aEndpoint);
                        final HCRow aBodyRow = aEPTable.addBodyRow();
                        final String sTransportProfile = aEndpoint.getTransportProfile();
                        final ISimpleURL aViewURL = createViewURL(aWPEC, aServiceInfo, aParams);
                        aBodyRow.addCell(new HCA(aViewURL).addChild(NiceNameUI.getTransportProfile(sTransportProfile, false)));
                        aBodyRow.addCell(aEndpoint.getEndpointReference());
                        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());
                        aBodyRow.addAndReturnCell(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())).addClass(CSS_CLASS_RIGHT);
                    }
                    // Show process + endpoints
                    final HCLI aLI = aULP.addItem();
                    final HCDiv aDiv = div(NiceNameUI.getProcessID(aDocTypeID, aProcess.getProcessIdentifier(), false));
                    aLI.addChild(aDiv);
                    if (aEndpoints.isEmpty()) {
                        aDiv.addChild(" ").addChild(new HCA(aWPEC.getSelfHref().addAll(createParamMap(aServiceInfo, aProcess, (ISMPEndpoint) null)).add(CPageParam.PARAM_ACTION, ACTION_DELETE_PROCESS)).setTitle("Delete process").addChild(EDefaultIcon.DELETE.getAsNode()));
                    } else
                        aLI.addChild(aEPTable);
                }
                // Show document types + children
                final HCLI aLI = aULDT.addItem();
                final HCDiv aDiv = div().addChild(NiceNameUI.getDocumentTypeID(aServiceInfo.getDocumentTypeIdentifier(), false)).addChild(" ").addChild(new HCA(LinkHelper.getURLWithServerAndContext(aParticipantID.getURIPercentEncoded() + SMPRestFilter.PATH_SERVICES + aDocTypeID.getURIPercentEncoded())).setTitle("Perform SMP query on document type ").setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
                aLI.addChild(aDiv);
                if (aProcesses.isEmpty()) {
                    aDiv.addChild(" ").addChild(new HCA(aWPEC.getSelfHref().addAll(createParamMap(aServiceInfo, (ISMPProcess) null, (ISMPEndpoint) null)).add(CPageParam.PARAM_ACTION, ACTION_DELETE_DOCUMENT_TYPE)).setTitle("Delete document type").addChild(EDefaultIcon.DELETE.getAsNode()));
                } else
                    aLI.addChild(aULP);
            }
        }
        if (aServiceInfos == null || aServiceInfos.isEmpty() || aULDT.hasNoChildren())
            aLISG.addChild(" ").addChild(badgeInfo("This service group has no assigned endpoints!"));
        else
            aLISG.addChild(aULDT);
    }
    aNodeList.addChild(aULSG);
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) ICommonsList(com.helger.commons.collection.impl.ICommonsList) 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) CommonsHashMap(com.helger.commons.collection.impl.CommonsHashMap) ISimpleURL(com.helger.commons.url.ISimpleURL) HCLI(com.helger.html.hc.html.grouping.HCLI) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) ISMPProcess(com.helger.phoss.smp.domain.serviceinfo.ISMPProcess) 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) HCUL(com.helger.html.hc.html.grouping.HCUL) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) HCTextNode(com.helger.html.hc.impl.HCTextNode) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 8 with ISimpleURL

use of com.helger.commons.url.ISimpleURL in project phoss-smp by phax.

the class PageSecureServiceGroup method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
    final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr();
    final ISMPBusinessCardManager aBCMgr = SMPMetaManager.getBusinessCardMgr();
    final ISMPSettings aSettings = SMPMetaManager.getSettings();
    final ESMPRESTType eRESTType = SMPServerConfiguration.getRESTType();
    final boolean bShowExtensionDetails = SMPWebAppConfiguration.isServiceGroupsExtensionsShow();
    final boolean bShowBusinessCardName = CSMP.ENABLE_ISSUE_56 && aSettings.isDirectoryIntegrationEnabled();
    final ICommonsList<ISMPServiceGroup> aAllServiceGroups = aServiceGroupMgr.getAllSMPServiceGroups();
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new Service group", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
    if (aSettings.isSMLRequired() || aSettings.isSMLEnabled()) {
        // Disable button if no SML URL is configured
        // Disable button if no service group is present
        aToolbar.addAndReturnButton("Check DNS state", aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_CHECK_DNS), EDefaultIcon.MAGNIFIER).setDisabled(aSettings.getSMLDNSZone() == null || aAllServiceGroups.isEmpty() || !aSettings.isSMLEnabled());
    }
    aNodeList.addChild(aToolbar);
    final boolean bShowDetails = aAllServiceGroups.size() <= 1000;
    final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Owner"), bShowBusinessCardName ? new DTCol("Business Card Name") : null, new DTCol(span(bShowExtensionDetails ? "Ext" : "Ext?").setTitle("Is an Extension present?")), bShowDetails ? new DTCol(span("Docs").setTitle("Number of assigned document types")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("Procs").setTitle("Number of assigned processes")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("EPs").setTitle("Number of assigned endpoints")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMPServiceGroup aCurObject : aAllServiceGroups) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final String sDisplayName = aCurObject.getParticipantIdentifier().getURIEncoded();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
        aRow.addCell(SMPCommonUI.getOwnerName(aCurObject.getOwnerID()));
        if (bShowBusinessCardName) {
            IHCNode aName = null;
            final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup(aCurObject);
            if (aBC != null) {
                final SMPBusinessCardEntity aEntity = aBC.getEntityAtIndex(0);
                if (aEntity != null && aEntity.names().isNotEmpty())
                    aName = HCTextNode.createOnDemand(aEntity.names().getFirst().getName());
            }
            aRow.addCell(aName);
        }
        if (bShowExtensionDetails) {
            if (aCurObject.extensions().isNotEmpty())
                aRow.addCell(new HCCode().addChildren(HCExtHelper.nl2divList(aCurObject.getFirstExtensionXML())));
            else
                aRow.addCell();
        } else {
            aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.extensions().isNotEmpty(), aDisplayLocale));
        }
        if (bShowDetails) {
            int nProcesses = 0;
            int nEndpoints = 0;
            final ICommonsList<ISMPServiceInformation> aSIs = aServiceInfoMgr.getAllSMPServiceInformationOfServiceGroup(aCurObject);
            for (final ISMPServiceInformation aSI : aSIs) {
                nProcesses += aSI.getProcessCount();
                nEndpoints += aSI.getTotalEndpointCount();
            }
            aRow.addCell(Integer.toString(aSIs.size()));
            aRow.addCell(Integer.toString(nProcesses));
            aRow.addCell(Integer.toString(nEndpoints));
        }
        final HCNodeList aActions = new HCNodeList();
        aActions.addChildren(createEditLink(aWPEC, aCurObject, "Edit " + sDisplayName), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + sDisplayName), new HCTextNode(" "), createDeleteLink(aWPEC, aCurObject, "Delete " + sDisplayName), new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext(aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
        if (eRESTType.isCompleteServiceGroupSupported()) {
            aActions.addChildren(new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext("complete/" + aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform complete SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_LINK.getAsNode()));
        }
        aRow.addCell(aActions);
    }
    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) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCRow(com.helger.html.hc.html.tabular.HCRow) ISMPBusinessCard(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCard) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) ISMPServiceInformationManager(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager) HCCode(com.helger.html.hc.html.textlevel.HCCode) ESMPRESTType(com.helger.phoss.smp.ESMPRESTType) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) HCA(com.helger.html.hc.html.textlevel.HCA) SMPBusinessCardEntity(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity) ISMPServiceInformation(com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation) ISMPBusinessCardManager(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMPSettings(com.helger.phoss.smp.settings.ISMPSettings) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) HCTextNode(com.helger.html.hc.impl.HCTextNode) IHCNode(com.helger.html.hc.IHCNode)

Example 9 with ISimpleURL

use of com.helger.commons.url.ISimpleURL in project phoss-smp by phax.

the class PageSecureServiceGroupMigrationInbound method _createTable.

@Nonnull
private IHCNode _createTable(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ICommonsIterable<ISMPParticipantMigration> aMigs, @Nonnull final EParticipantMigrationState eState) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCTable aTable = new HCTable(new DTCol("ID").setVisible(false), new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Migration").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Migration Key"), new BootstrapDTColAction(aDisplayLocale)).setID(getID() + eState.getID());
    for (final ISMPParticipantMigration aCurObject : aMigs) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final String sParticipantID = aCurObject.getParticipantIdentifier().getURIEncoded();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aCurObject.getID());
        aRow.addCell(a(aViewLink).addChild(sParticipantID));
        aRow.addCell(PDTToString.getAsString(aCurObject.getInitiationDateTime(), aDisplayLocale));
        aRow.addCell(code(aCurObject.getMigrationKey()));
        final IHCCell<?> aActionCell = aRow.addCell();
        aActionCell.addChild(createDeleteLink(aWPEC, aCurObject, "Delete Participant Migration of '" + sParticipantID + "'"));
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    return new HCNodeList().addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) HCNodeList(com.helger.html.hc.impl.HCNodeList) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) Nonnull(javax.annotation.Nonnull)

Example 10 with ISimpleURL

use of com.helger.commons.url.ISimpleURL in project phoss-smp by phax.

the class PageSecureSMLConfiguration method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMLInfoManager aSMLInfoMgr = SMPMetaManager.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.getAllSMLInfos()) {
        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.phoss.smp.domain.sml.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)

Aggregations

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