use of com.helger.html.hc.impl.HCTextNode in project phoss-directory by phax.
the class PageSecureAdminSMLConfiguration method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMLInfo aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
final boolean bEdit = eFormAction.isEdit();
aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit SML configuration '" + aSelectedObject.getDisplayName() + "'" : "Create new SML configuration"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_DISPLAY_NAME, aSelectedObject != null ? aSelectedObject.getDisplayName() : null))).setHelpText("The name of the SML configuration. This is for informational purposes only and has no effect on the functionality.").setErrorList(aFormErrors.getListOfField(FIELD_DISPLAY_NAME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("DNS Zone").setCtrl(new HCEdit(new RequestField(FIELD_DNS_ZONE, aSelectedObject != null ? aSelectedObject.getDNSZone() : null))).setHelpText(new HCTextNode("The name of the DNS Zone that this SML is working upon (e.g. "), new HCCode().addChild("sml.peppolcentral.org"), new HCTextNode("). The value will automatically converted to all-lowercase!")).setErrorList(aFormErrors.getListOfField(FIELD_DNS_ZONE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Management Service URL").setCtrl(new HCEdit(new RequestField(FIELD_MANAGEMENT_ADDRESS_URL, aSelectedObject != null ? aSelectedObject.getManagementServiceURL() : null))).setHelpText("The service URL where the SML management application is running on including the host name. It may not contain the '" + CSMLDefault.MANAGEMENT_SERVICE_METADATA + "' or '" + CSMLDefault.MANAGEMENT_SERVICE_PARTICIPANTIDENTIFIER + "' path elements!").setErrorList(aFormErrors.getListOfField(FIELD_MANAGEMENT_ADDRESS_URL)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Client Certificate required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_CLIENT_CERTIFICATE_REQUIRED, aSelectedObject != null ? aSelectedObject.isClientCertificateRequired() : true))).setHelpText("Check this if this SML requires a client certificate for access. Both Peppol production SML and SMK require a client certificate. Only a locally running SML software may not require a client certificate.").setErrorList(aFormErrors.getListOfField(FIELD_CLIENT_CERTIFICATE_REQUIRED)));
}
use of com.helger.html.hc.impl.HCTextNode 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);
}
use of com.helger.html.hc.impl.HCTextNode in project phoss-smp by phax.
the class SMPCommonUI method createCertificateDetailsTable.
@Nonnull
public static BootstrapTable createCertificateDetailsTable(@Nullable final String sAlias, @Nonnull final X509Certificate aX509Cert, @Nonnull final LocalDateTime aNowLDT, @Nonnull final Locale aDisplayLocale) {
final LocalDateTime aNotBefore = PDTFactory.createLocalDateTime(aX509Cert.getNotBefore());
final LocalDateTime aNotAfter = PDTFactory.createLocalDateTime(aX509Cert.getNotAfter());
final PublicKey aPublicKey = aX509Cert.getPublicKey();
final BootstrapTable aCertDetails = new BootstrapTable(new HCCol().addStyle(CCSSProperties.WIDTH.newValue("12rem")), HCCol.star());
aCertDetails.setResponsive(true);
if (StringHelper.hasText(sAlias))
aCertDetails.addBodyRow().addCell("Alias:").addCell(sAlias);
aCertDetails.addBodyRow().addCell("Version:").addCell(Integer.toString(aX509Cert.getVersion()));
aCertDetails.addBodyRow().addCell("Subject:").addCell(aX509Cert.getSubjectX500Principal().getName());
aCertDetails.addBodyRow().addCell("Issuer:").addCell(aX509Cert.getIssuerX500Principal().getName());
aCertDetails.addBodyRow().addCell("Serial number:").addCell(aX509Cert.getSerialNumber().toString() + " / 0x" + _inGroupsOf(aX509Cert.getSerialNumber().toString(16), 4));
aCertDetails.addBodyRow().addCell("Valid from:").addCell(new HCTextNode(PDTToString.getAsString(aNotBefore, aDisplayLocale) + " "), aNowLDT.isBefore(aNotBefore) ? new BootstrapBadge(EBootstrapBadgeType.DANGER).addChild("!!!NOT YET VALID!!!") : null);
aCertDetails.addBodyRow().addCell("Valid to:").addCell(new HCTextNode(PDTToString.getAsString(aNotAfter, aDisplayLocale) + " "), aNowLDT.isAfter(aNotAfter) ? new BootstrapBadge(EBootstrapBadgeType.DANGER).addChild("!!!NO LONGER VALID!!!") : new HCDiv().addChild("Valid for: " + PDTDisplayHelper.getPeriodTextEN(aNowLDT, aNotAfter)));
if (aPublicKey instanceof RSAPublicKey) {
// Special handling for RSA
aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm() + " (" + ((RSAPublicKey) aPublicKey).getModulus().bitLength() + " bits)");
} else {
// Usually EC or DSA key
aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm());
}
aCertDetails.addBodyRow().addCell("Signature algorithm:").addCell(aX509Cert.getSigAlgName() + " (" + aX509Cert.getSigAlgOID() + ")");
return aCertDetails;
}
use of com.helger.html.hc.impl.HCTextNode 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);
}
use of com.helger.html.hc.impl.HCTextNode 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);
}
Aggregations