Search in sources :

Example 26 with BootstrapForm

use of com.helger.photon.bootstrap4.form.BootstrapForm in project phoss-smp by phax.

the class SMPCommonUI method createViewLoginForm.

@Nonnull
public static BootstrapForm createViewLoginForm(@Nonnull final ILayoutExecutionContext aLEC, @Nullable final String sPreselectedUserName) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    // Use new IDs for both fields, in case the login stuff is displayed more
    // than once!
    final String sIDUserName = GlobalIDFactory.getNewStringID();
    final String sIDPassword = GlobalIDFactory.getNewStringID();
    final String sIDErrorField = GlobalIDFactory.getNewStringID();
    final BootstrapForm aForm = new BootstrapForm(aLEC).setAction(aLEC.getSelfHref());
    aForm.setLeft(4);
    // User name field
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(EPhotonCoreText.EMAIL_ADDRESS.getDisplayText(aDisplayLocale)).setCtrl(new HCEdit(new RequestField(CLogin.REQUEST_ATTR_USERID, sPreselectedUserName)).setID(sIDUserName)));
    // Password field
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(EPhotonCoreText.LOGIN_FIELD_PASSWORD.getDisplayText(aDisplayLocale)).setCtrl(new HCEditPassword(CLogin.REQUEST_ATTR_PASSWORD).setID(sIDPassword)));
    // Placeholder for error message
    aForm.addChild(new HCDiv().setID(sIDErrorField).addClass(CBootstrapCSS.MX_2));
    // Login button
    final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aLEC));
    {
        final JSPackage aOnClick = new JSPackage();
        final JSAnonymousFunction aJSSuccess = new JSAnonymousFunction();
        final JSVar aJSData = aJSSuccess.param("data");
        aJSSuccess.body()._if(aJSData.ref(AjaxExecutorPublicLogin.JSON_LOGGEDIN), JSHtml.windowLocationReload(), JQuery.idRef(sIDErrorField).empty().append(aJSData.ref(AjaxExecutorPublicLogin.JSON_HTML)));
        aOnClick.add(new JQueryAjaxBuilder().url(CAjax.LOGIN.getInvocationURI(aRequestScope)).method(EHttpMethod.POST).data(new JSAssocArray().add(CLogin.REQUEST_ATTR_USERID, JQuery.idRef(sIDUserName).val()).add(CLogin.REQUEST_ATTR_PASSWORD, JQuery.idRef(sIDPassword).val())).success(aJSSuccess).build());
        aOnClick._return(false);
        aToolbar.addSubmitButton(EPhotonCoreText.LOGIN_BUTTON_SUBMIT.getDisplayText(aDisplayLocale), aOnClick);
    }
    return aForm;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) JSAnonymousFunction(com.helger.html.jscode.JSAnonymousFunction) JSVar(com.helger.html.jscode.JSVar) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCEditPassword(com.helger.html.hc.html.forms.HCEditPassword) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) JQueryAjaxBuilder(com.helger.html.jquery.JQueryAjaxBuilder) JSPackage(com.helger.html.jscode.JSPackage) JSAssocArray(com.helger.html.jscode.JSAssocArray) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) RequestField(com.helger.photon.core.form.RequestField) Nonnull(javax.annotation.Nonnull)

Example 27 with BootstrapForm

use of com.helger.photon.bootstrap4.form.BootstrapForm in project phoss-smp by phax.

the class PageSecureSMPSettings method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPSettings aObject, @Nonnull final BootstrapForm aForm, @Nonnull final EWebPageSimpleFormAction eSimpleFormAction, @Nonnull final FormErrorList aFormErrors) {
    final String sDirectoryName = SMPWebAppConfiguration.getDirectoryName();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    aForm.setLeft(3);
    aForm.addChild(getUIHandler().createDataGroupHeader("REST API"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("REST writable API disabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_REST_WRITABLE_API_DISABLED, aObject.isRESTWritableAPIDisabled()))).setHelpText("If this checkbox is checked, all non-standard writing REST APIs are disabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_REST_WRITABLE_API_DISABLED)));
    aForm.addChild(getUIHandler().createDataGroupHeader("SMK/SML"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_REQUIRED, aObject.isSMLRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the SML connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_ACTIVE, aObject.isSMLEnabled()))).setHelpText("If this checkbox is checked, service group changes are propagated to the SML.").setErrorList(aFormErrors.getListOfField(FIELD_SML_ACTIVE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML configuration").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_INFO, aObject.getSMLInfoID()), aDisplayLocale, null)).setHelpText(new HCTextNode("Select the SML to operate on. The list of available configurations can be "), new HCA(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SML_CONFIGURATION)).addChild("customized"), new HCTextNode(".")).setErrorList(aFormErrors.getListOfField(FIELD_SML_INFO)));
    aForm.addChild(getUIHandler().createDataGroupHeader(sDirectoryName));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED, aObject.isDirectoryIntegrationRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the " + sDirectoryName + " connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED, aObject.isDirectoryIntegrationEnabled()))).setHelpText("If this checkbox is checked, the " + sDirectoryName + " integration is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration automatic update?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_AUTO_UPDATE, aObject.isDirectoryIntegrationAutoUpdate()))).setHelpText("If the " + sDirectoryName + " integration is enabled and this checkbox is checked, all business card creations, modifications and deletions are automatically pushed to the " + sDirectoryName + " server.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " hostname").setCtrl(new HCEdit(new RequestField(FIELD_SMP_DIRECTORY_HOSTNAME, aObject.getDirectoryHostName()))).setHelpText("The " + sDirectoryName + " host where the business cards should be published to. This URL is only used if the " + sDirectoryName + " integration (see above) is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_HOSTNAME)));
}
Also used : Locale(java.util.Locale) HCSMLSelect(com.helger.phoss.smp.ui.secure.hc.HCSMLSelect) RequestFieldBoolean(com.helger.photon.core.form.RequestFieldBoolean) HCA(com.helger.html.hc.html.textlevel.HCA) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCCheckBox(com.helger.html.hc.html.forms.HCCheckBox) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) HCTextNode(com.helger.html.hc.impl.HCTextNode) RequestField(com.helger.photon.core.form.RequestField)

Example 28 with BootstrapForm

use of com.helger.photon.bootstrap4.form.BootstrapForm in project phoss-smp by phax.

the class PageSecureServiceGroup method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMPServiceGroup aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final boolean bEdit = eFormAction.isEdit();
    final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
    aForm.setLeft(2);
    aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit service group '" + aSelectedObject.getID() + "'" : "Create new service group"));
    {
        final String sDefaultScheme = aIdentifierFactory.getDefaultParticipantIdentifierScheme();
        final BootstrapRow aRow = new BootstrapRow();
        aRow.createColumn(GS_IDENTIFIER_SCHEME).addChild(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_SCHEME, aSelectedObject != null ? aSelectedObject.getParticipantIdentifier().getScheme() : sDefaultScheme)).setPlaceholder("Identifier scheme").setReadOnly(bEdit));
        aRow.createColumn(GS_IDENTIFIER_VALUE).addChild(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_VALUE, aSelectedObject != null ? aSelectedObject.getParticipantIdentifier().getValue() : null)).setPlaceholder("Identifier value").setReadOnly(bEdit));
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Participant ID").setCtrl(aRow).setHelpText("The participant identifier for which the service group should be created. The left part is the identifier scheme" + (sDefaultScheme == null ? "" : " (default: " + sDefaultScheme + ")") + ", the right part is the identifier value (e.g. 9915:test)").setErrorList(aFormErrors.getListOfFields(FIELD_PARTICIPANT_ID_SCHEME, FIELD_PARTICIPANT_ID_VALUE)));
    }
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Owning User").setCtrl(new HCUserSelect(new RequestField(FIELD_OWNING_USER_ID, aSelectedObject != null ? aSelectedObject.getOwnerID() : LoggedInUserManager.getInstance().getCurrentUserID()), aDisplayLocale)).setHelpText("The user who owns this entry. Only this user can make changes via the REST API.").setErrorList(aFormErrors.getListOfField(FIELD_OWNING_USER_ID)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Extension").setCtrl(new HCTextArea(new RequestField(FIELD_EXTENSION, aSelectedObject != null ? aSelectedObject.getFirstExtensionXML() : null))).setHelpText("Optional extension to the service group. If present it must be valid XML content!").setErrorList(aFormErrors.getListOfField(FIELD_EXTENSION)));
}
Also used : Locale(java.util.Locale) HCUserSelect(com.helger.phoss.smp.ui.secure.hc.HCUserSelect) BootstrapRow(com.helger.photon.bootstrap4.grid.BootstrapRow) HCTextArea(com.helger.html.hc.html.forms.HCTextArea) HCEdit(com.helger.html.hc.html.forms.HCEdit) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) RequestField(com.helger.photon.core.form.RequestField)

Example 29 with BootstrapForm

use of com.helger.photon.bootstrap4.form.BootstrapForm in project peppol-practical by phax.

the class PagePublicToolsTestEndpoints method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final TestEndpoint aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final BootstrapForm aRealForm = aForm;
    aRealForm.setLeft(3);
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Company name").setCtrl(new HCEdit(new RequestField(FIELD_COMPANY_NAME, aSelectedObject == null ? null : aSelectedObject.getCompanyName()))).setHelpText("The name of the company operating the test AccessPoint").setErrorList(aFormErrors.getListOfField(FIELD_COMPANY_NAME)));
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabel("Contact person").setCtrl(new HCEdit(new RequestField(FIELD_CONTACT_PERSON, aSelectedObject == null ? null : aSelectedObject.getContactPerson()))).setHelpText("The contact person being in charge of the test endpoint. This field is free text and may contain an optional email address.").setErrorList(aFormErrors.getListOfField(FIELD_CONTACT_PERSON)));
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier issuing agency").setCtrl(new ParticipantIdentifierSchemeSelect(new RequestField(FIELD_PARTICIPANT_ID_ISSUER, aSelectedObject == null ? null : aSelectedObject.getParticipantIDIssuer()), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_PARTICIPANT_ID_ISSUER)));
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier value").setCtrl(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_VALUE, aSelectedObject == null ? null : aSelectedObject.getParticipantIDValue()))).setErrorList(aFormErrors.getListOfField(FIELD_PARTICIPANT_ID_VALUE)));
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Transport profile").setCtrl(new SMPTransportProfileSelect(new RequestField(FIELD_TRANSPORT_PROFILE, aSelectedObject == null ? null : aSelectedObject.getTransportProfile().getID()), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_TRANSPORT_PROFILE)));
    aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML, aSelectedObject == null ? null : aSelectedObject.getSML().getID()), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML)));
}
Also used : Locale(java.util.Locale) HCEdit(com.helger.html.hc.html.forms.HCEdit) SMLConfigurationSelect(com.helger.peppol.ui.select.SMLConfigurationSelect) SMPTransportProfileSelect(com.helger.peppol.ui.select.SMPTransportProfileSelect) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) RequestField(com.helger.photon.core.form.RequestField) ParticipantIdentifierSchemeSelect(com.helger.peppol.ui.select.ParticipantIdentifierSchemeSelect)

Example 30 with BootstrapForm

use of com.helger.photon.bootstrap4.form.BootstrapForm in project peppol-practical by phax.

the class PageSecurePeppolSendAS4 method fillContent.

@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final IIdentifierFactory aIF = Phase4PeppolSender.IF;
    final FormErrorList aFormErrors = new FormErrorList();
    if (aWPEC.params().hasStringValue(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM)) {
        final String sSenderID = aWPEC.params().getAsStringTrimmed(FIELD_SENDER_ID);
        final IParticipantIdentifier aSenderID = aIF.parseParticipantIdentifier(sSenderID);
        final String sReceiverID = aWPEC.params().getAsStringTrimmed(FIELD_RECEIVER_ID);
        final IParticipantIdentifier aReceiverID = aIF.parseParticipantIdentifier(sReceiverID);
        final String sDocTypeID = aWPEC.params().getAsStringTrimmed(FIELD_DOCTYPE_ID);
        final IDocumentTypeIdentifier aDocTypeID = aIF.parseDocumentTypeIdentifier(sDocTypeID);
        final String sProcessID = aWPEC.params().getAsStringTrimmed(FIELD_PROCESS_ID);
        final IProcessIdentifier aProcessID = aIF.parseProcessIdentifier(sProcessID);
        final String sPayload = aWPEC.params().getAsStringTrimmed(FIELD_PAYLOAD);
        final Document aPayloadDoc = DOMReader.readXMLDOM(sPayload);
        if (StringHelper.hasNoText(sSenderID))
            aFormErrors.addFieldError(FIELD_SENDER_ID, "A sending participant ID must be provided.");
        else if (aSenderID == null)
            aFormErrors.addFieldError(FIELD_SENDER_ID, "The sending participant ID could not be parsed.");
        if (StringHelper.hasNoText(sReceiverID))
            aFormErrors.addFieldError(FIELD_RECEIVER_ID, "A receiving participant ID must be provided.");
        else if (aReceiverID == null)
            aFormErrors.addFieldError(FIELD_RECEIVER_ID, "The receiving participant ID could not be parsed.");
        if (StringHelper.hasNoText(sDocTypeID))
            aFormErrors.addFieldError(FIELD_DOCTYPE_ID, "A document type ID must be provided.");
        else if (aDocTypeID == null)
            aFormErrors.addFieldError(FIELD_DOCTYPE_ID, "The document type ID could not be parsed.");
        if (StringHelper.hasNoText(sProcessID))
            aFormErrors.addFieldError(FIELD_PROCESS_ID, "A process ID must be provided.");
        else if (aProcessID == null)
            aFormErrors.addFieldError(FIELD_PROCESS_ID, "The process ID could not be parsed.");
        if (StringHelper.hasNoText(sPayload))
            aFormErrors.addFieldError(FIELD_PAYLOAD, "A payload must be provided.");
        else if (aPayloadDoc == null)
            aFormErrors.addFieldError(FIELD_PAYLOAD, "The payload is not wellformed XML.");
        if (aFormErrors.isEmpty()) {
            final HCDiv aNL = new HCDiv().addStyle(CCSSProperties.MAX_WIDTH.newValue("80vw"));
            final String sAS4PayloadDoc = XMLWriter.getNodeAsString(aPayloadDoc);
            final byte[] aAS4PayloadBytes = XMLWriter.getNodeAsBytes(aPayloadDoc);
            aNL.addChild(h3("Sending document"));
            // Show payload
            aNL.addChild(new BootstrapPrismJS(EPrismLanguage.MARKUP).addPlugin(new PrismPluginLineNumbers()).addChild(sAS4PayloadDoc));
            final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

                public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                    final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                    LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
                }
            };
            try {
                final SMPClientReadOnly aSMPClient = new SMPClientReadOnly(Phase4PeppolSender.URL_PROVIDER, aReceiverID, ESML.DIGIT_TEST);
                // What to remember
                final Wrapper<String> aEndpointURL = new Wrapper<>();
                final Wrapper<X509Certificate> aEndpointCert = new Wrapper<>();
                final Wrapper<EPeppolCertificateCheckResult> aEndpointCertCheck = new Wrapper<>();
                final Wrapper<Phase4Exception> aSendEx = new Wrapper<>();
                final Wrapper<byte[]> aResponseBytes = new Wrapper<>();
                final Wrapper<Ebms3SignalMessage> aResponseMsg = new Wrapper<>();
                LOGGER.info("Sending Peppol AS4 message from '" + aSenderID.getURIEncoded() + "' to '" + aReceiverID.getURIEncoded() + "' using document type '" + aDocTypeID.getURIEncoded() + "' and process ID '" + aProcessID.getURIEncoded() + "'");
                // Try to send message
                final ESimpleUserMessageSendResult eResult = Phase4PeppolSender.builder().cryptoFactory(AS4_CF).documentTypeID(aDocTypeID).processID(aProcessID).senderParticipantID(aSenderID).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aAS4PayloadBytes).smpClient(aSMPClient).endpointURLConsumer(aEndpointURL::set).certificateConsumer((cert, dt, res) -> {
                    aEndpointCert.set(cert);
                    aEndpointCertCheck.set(res);
                }).validationConfiguration(null).buildMessageCallback(aBuildMessageCallback).outgoingDumper(new AS4OutgoingDumperFileBased()).incomingDumper(new AS4IncomingDumperFileBased()).rawResponseConsumer(r -> aResponseBytes.set(r.getResponse())).signalMsgConsumer(aResponseMsg::set).sendMessageAndCheckForReceipt(aSendEx::set);
                LOGGER.info("Sending Peppol AS4 message resulted in " + eResult);
                if (aEndpointURL.isSet())
                    aNL.addChild(div("Sending to this endpoint URL: ").addChild(code(aEndpointURL.get())));
                if (aEndpointCert.isSet())
                    aNL.addChild(div("The message is encrypted for the following receiver: ").addChild(code(aEndpointCert.get().getSubjectX500Principal().getName())));
                if (aEndpointCertCheck.isSet())
                    aNL.addChild(div("The certificate verification resulted in: ").addChild(code(aEndpointCertCheck.get().name())));
                if (eResult.isSuccess())
                    aNL.addChild(success("Successfully send AS4 message to Peppol receiver ").addChild(code(aReceiverID.getURIEncoded())));
                else
                    aNL.addChild(error().addChild(div("Failed to send AS4 message to Peppol receiver ").addChild(code(aReceiverID.getURIEncoded())).addChild(" with result ").addChild(code(eResult.name()))).addChild(AppCommonUI.getTechnicalDetailsUI(aSendEx.get(), true)));
                boolean bShowRaw = true;
                if (aResponseMsg.isSet()) {
                    // Don't do XSD validation here because there is no defined
                    // "SignalMessage" element
                    final String sSignalMessage = new GenericJAXBMarshaller<>(Ebms3SignalMessage.class, GenericJAXBMarshaller.createSimpleJAXBElement(new QName(com.helger.phase4.ebms3header.ObjectFactory._Messaging_QNAME.getNamespaceURI(), "SignalMessage"), Ebms3SignalMessage.class)).setFormattedOutput(true).getAsString(aResponseMsg.get());
                    if (StringHelper.hasText(sSignalMessage)) {
                        // Show payload
                        aNL.addChild(div("Response ebMS Signal Message"));
                        aNL.addChild(new BootstrapPrismJS(EPrismLanguage.MARKUP).addPlugin(new PrismPluginLineNumbers()).addChild(sSignalMessage));
                        bShowRaw = false;
                    }
                }
                if (aResponseBytes.isSet()) {
                    if (bShowRaw) {
                        aNL.addChild(div("Response message - NOT a valid response"));
                        aNL.addChild(new BootstrapPrismJS(EPrismLanguage.MARKUP).addPlugin(new PrismPluginLineNumbers()).addChild(new String(aResponseBytes.get(), StandardCharsets.UTF_8)));
                    }
                // Else already shown above
                } else {
                    if (eResult.isSuccess())
                        aNL.addChild(error("Received no response content :("));
                }
            } catch (final SMPDNSResolutionException ex) {
                aNL.addChild(error(div("Error creating the SMP client.")).addChild(AppCommonUI.getTechnicalDetailsUI(ex, false)));
            }
            if (true)
                aNodeList.addChild(aNL);
            else
                aWPEC.postRedirectGetInternal(aNL);
        }
    }
    aNodeList.addChild(h3("Send new Peppol AS4 message (Test network only)"));
    final BootstrapForm aForm = aNodeList.addAndReturnChild(new BootstrapForm(aWPEC));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Sending participant ID").setCtrl(new HCEdit(new RequestField(FIELD_SENDER_ID, DEFAULT_SENDER_ID))).setHelpText(span("The sending Peppol participant identifier. Must include the ").addChild(code(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME)).addChild(" prefix.")).setErrorList(aFormErrors.getListOfField(FIELD_SENDER_ID)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Receiving participant ID").setCtrl(new HCEdit(new RequestField(FIELD_RECEIVER_ID, DEFAULT_RECEIVER_ID))).setHelpText(span("The receiving Peppol participant identifier. Must include the ").addChild(code(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME)).addChild(" prefix.")).setErrorList(aFormErrors.getListOfField(FIELD_RECEIVER_ID)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Document type ID").setCtrl(new HCEdit(new RequestField(FIELD_DOCTYPE_ID, DEFAULT_DOCTYPE_ID))).setHelpText(span("The Peppol document type identifier. Must include the ").addChild(code(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS)).addChild(" prefix.")).setErrorList(aFormErrors.getListOfField(FIELD_DOCTYPE_ID)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Process ID").setCtrl(new HCEdit(new RequestField(FIELD_PROCESS_ID, DEFAULT_PROCESS_ID))).setHelpText(span("The Peppol process identifier. Must include the ").addChild(code(PeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME)).addChild(" prefix.")).setErrorList(aFormErrors.getListOfField(FIELD_PROCESS_ID)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("XML Payload to be send").setCtrl(new HCTextArea(new RequestField(FIELD_PAYLOAD, DEFAULT_PAYLOAD.get())).setRows(8)).setHelpText("This MUST be wellformed XML - e.g. a UBL Invoice or a CII Invoice. NO Schematron validation is performed. The SBDH is added automatically.").setErrorList(aFormErrors.getListOfField(FIELD_PAYLOAD)));
    aForm.addChild(new HCHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM));
    aForm.addChild(new BootstrapSubmitButton().addChild("Send Peppol AS4 message"));
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) Ebms3SignalMessage(com.helger.phase4.ebms3header.Ebms3SignalMessage) X509Certificate(java.security.cert.X509Certificate) AppConfig(com.helger.peppol.app.AppConfig) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) PeppolIdentifierHelper(com.helger.peppolid.peppol.PeppolIdentifierHelper) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) BootstrapSubmitButton(com.helger.photon.bootstrap4.button.BootstrapSubmitButton) LoggerFactory(org.slf4j.LoggerFactory) HCHiddenField(com.helger.html.hc.html.forms.HCHiddenField) CCSSProperties(com.helger.css.property.CCSSProperties) IKeyStoreType(com.helger.security.keystore.IKeyStoreType) FormErrorList(com.helger.photon.core.form.FormErrorList) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) Phase4PeppolSender(com.helger.phase4.peppol.Phase4PeppolSender) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) PrivateKeyEntry(java.security.KeyStore.PrivateKeyEntry) Document(org.w3c.dom.Document) HCTextArea(com.helger.html.hc.html.forms.HCTextArea) CPageParam(com.helger.photon.uicore.css.CPageParam) ESML(com.helger.peppol.sml.ESML) HCDiv(com.helger.html.hc.html.grouping.HCDiv) EPeppolCertificateCheckResult(com.helger.peppol.utils.EPeppolCertificateCheckResult) KeyStoreHelper(com.helger.security.keystore.KeyStoreHelper) LoadedKeyStore(com.helger.security.keystore.LoadedKeyStore) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) StandardCharsets(java.nio.charset.StandardCharsets) EPredefinedProcessIdentifier(com.helger.peppolid.peppol.process.EPredefinedProcessIdentifier) DOMReader(com.helger.xml.serialize.read.DOMReader) EKeyStoreType(com.helger.security.keystore.EKeyStoreType) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) IValidityIndicator(com.helger.commons.state.IValidityIndicator) QName(javax.xml.namespace.QName) AppCommonUI(com.helger.peppol.ui.AppCommonUI) PrismPluginLineNumbers(com.helger.photon.uictrls.prism.PrismPluginLineNumbers) Ebms3SignalMessage(com.helger.phase4.ebms3header.Ebms3SignalMessage) EPredefinedDocumentTypeIdentifier(com.helger.peppolid.peppol.doctype.EPredefinedDocumentTypeIdentifier) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) EValidity(com.helger.commons.state.EValidity) IAS4CryptoFactory(com.helger.phase4.crypto.IAS4CryptoFactory) SMPDNSResolutionException(com.helger.smpclient.url.SMPDNSResolutionException) HCEdit(com.helger.html.hc.html.forms.HCEdit) Supplier(java.util.function.Supplier) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) IConfig(com.helger.config.IConfig) LoadedKey(com.helger.security.keystore.LoadedKey) AS4CryptoFactoryInMemoryKeyStore(com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nonnull(javax.annotation.Nonnull) Phase4Exception(com.helger.phase4.util.Phase4Exception) HCNodeList(com.helger.html.hc.impl.HCNodeList) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AbstractBootstrapWebPage(com.helger.photon.bootstrap4.pages.AbstractBootstrapWebPage) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) Logger(org.slf4j.Logger) StringHelper(com.helger.commons.string.StringHelper) BootstrapPrismJS(com.helger.photon.bootstrap4.uictrls.prism.BootstrapPrismJS) XMLWriter(com.helger.xml.serialize.write.XMLWriter) RequestField(com.helger.photon.core.form.RequestField) IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) Wrapper(com.helger.commons.wrapper.Wrapper) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) EPrismLanguage(com.helger.photon.uictrls.prism.EPrismLanguage) GenericJAXBMarshaller(com.helger.jaxb.GenericJAXBMarshaller) PrismPluginLineNumbers(com.helger.photon.uictrls.prism.PrismPluginLineNumbers) IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) HCNodeList(com.helger.html.hc.impl.HCNodeList) FormErrorList(com.helger.photon.core.form.FormErrorList) BootstrapPrismJS(com.helger.photon.bootstrap4.uictrls.prism.BootstrapPrismJS) HCEdit(com.helger.html.hc.html.forms.HCEdit) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) Document(org.w3c.dom.Document) GenericJAXBMarshaller(com.helger.jaxb.GenericJAXBMarshaller) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) Phase4Exception(com.helger.phase4.util.Phase4Exception) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) RequestField(com.helger.photon.core.form.RequestField) Wrapper(com.helger.commons.wrapper.Wrapper) EPeppolCertificateCheckResult(com.helger.peppol.utils.EPeppolCertificateCheckResult) HCTextArea(com.helger.html.hc.html.forms.HCTextArea) HCHiddenField(com.helger.html.hc.html.forms.HCHiddenField) QName(javax.xml.namespace.QName) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) X509Certificate(java.security.cert.X509Certificate) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) BootstrapSubmitButton(com.helger.photon.bootstrap4.button.BootstrapSubmitButton) SMPDNSResolutionException(com.helger.smpclient.url.SMPDNSResolutionException) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Aggregations

BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)35 RequestField (com.helger.photon.core.form.RequestField)34 HCEdit (com.helger.html.hc.html.forms.HCEdit)29 Locale (java.util.Locale)25 BootstrapForm (com.helger.photon.bootstrap4.form.BootstrapForm)24 HCNodeList (com.helger.html.hc.impl.HCNodeList)20 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)19 FormErrorList (com.helger.photon.core.form.FormErrorList)18 HCCheckBox (com.helger.html.hc.html.forms.HCCheckBox)12 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)12 RequestFieldBoolean (com.helger.photon.core.form.RequestFieldBoolean)10 PDTToString (com.helger.commons.datetime.PDTToString)8 HCTextArea (com.helger.html.hc.html.forms.HCTextArea)8 HCA (com.helger.html.hc.html.textlevel.HCA)7 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)7 HCHiddenField (com.helger.html.hc.html.forms.HCHiddenField)6 HCTextNode (com.helger.html.hc.impl.HCTextNode)6 ICommonsList (com.helger.commons.collection.impl.ICommonsList)5 IHCNode (com.helger.html.hc.IHCNode)5 HCDiv (com.helger.html.hc.html.grouping.HCDiv)5