use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class SMLInfoManagerXML method createSMLInfo.
@Nonnull
public ISMLInfo createSMLInfo(@Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
final SMLInfo aSMLInfo = new SMLInfo(sDisplayName, sDNSZone, sManagementServiceURL, bClientCertificateRequired);
m_aRWLock.writeLocked(() -> {
internalCreateItem(aSMLInfo);
});
AuditHelper.onAuditCreateSuccess(SMLInfo.OT, aSMLInfo.getID(), sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
return aSMLInfo;
}
use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class APIExecutorMigrationInboundFromPathPut method migrationInbound.
public static void migrationInbound(@Nonnull final String sServiceGroupID, @Nonnull final String sMigrationKey, @Nonnull final String sLogPrefix, @Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws SMPServerException, GeneralSecurityException {
LOGGER.info(sLogPrefix + "Starting inbound migration for Service Group ID '" + sServiceGroupID + "' and migration key '" + sMigrationKey + "'");
// Only authenticated user may do so
final BasicAuthClientCredentials aBasicAuth = getMandatoryAuth(aRequestScope.headers());
final IUser aOwningUser = SMPUserManagerPhoton.validateUserCredentials(aBasicAuth);
final ISMPServerAPIDataProvider aDataProvider = new SMPRestDataProvider(aRequestScope, sServiceGroupID);
final ISMPSettings aSettings = SMPMetaManager.getSettings();
final ISMLInfo aSMLInfo = aSettings.getSMLInfo();
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ISMPParticipantMigrationManager aParticipantMigrationMgr = SMPMetaManager.getParticipantMigrationMgr();
if (aSMLInfo == null) {
throw new SMPPreconditionFailedException("Currently no SML is available. Please select it in the UI at the 'SMP Settings' page", aDataProvider.getCurrentURI());
}
if (!aSettings.isSMLEnabled()) {
throw new SMPPreconditionFailedException("SML Connection is not enabled hence no participant can be migrated", aDataProvider.getCurrentURI());
}
final IParticipantIdentifier aParticipantID = aIdentifierFactory.parseParticipantIdentifier(sServiceGroupID);
if (aParticipantID == null) {
// Invalid identifier
throw SMPBadRequestException.failedToParseSG(sServiceGroupID, aDataProvider.getCurrentURI());
}
// Check that service group does not exist yet
if (aServiceGroupMgr.containsSMPServiceGroupWithID(aParticipantID)) {
throw new SMPBadRequestException("The Service Group '" + sServiceGroupID + "' already exists.", aDataProvider.getCurrentURI());
}
if (false) {
// valid
if (aParticipantMigrationMgr.containsInboundMigration(aParticipantID)) {
throw new SMPBadRequestException("The inbound migration of the Service Group '" + sServiceGroupID + "' is already contained.", aDataProvider.getCurrentURI());
}
}
// create the Service Group locally
try {
final ManageParticipantIdentifierServiceCaller aCaller = new ManageParticipantIdentifierServiceCaller(aSettings.getSMLInfo());
aCaller.setSSLSocketFactory(SMPKeyManager.getInstance().createSSLContext().getSocketFactory());
// SML call
aCaller.migrate(aParticipantID, sMigrationKey, SMPServerConfiguration.getSMLSMPID());
LOGGER.info(sLogPrefix + "Successfully migrated '" + aParticipantID.getURIEncoded() + "' in the SML to this SMP using migration key '" + sMigrationKey + "'");
} catch (final BadRequestFault | InternalErrorFault | NotFoundFault | UnauthorizedFault | ClientTransportException ex) {
throw new SMPSMLException("Failed to confirm the migration for participant '" + aParticipantID.getURIEncoded() + "' in SML, hence the migration failed." + " Please check the participant identifier and the migration key.", ex);
}
// Now create the service group locally (it was already checked that the
// PID is available on this SMP)
ISMPServiceGroup aSG = null;
Exception aCaughtEx = null;
try {
// Do not allow any Extension here
// Do NOT create in SMK/SML
aSG = aServiceGroupMgr.createSMPServiceGroup(aOwningUser.getID(), aParticipantID, (String) null, false);
} catch (final Exception ex) {
aCaughtEx = ex;
}
if (aSG != null) {
LOGGER.info(sLogPrefix + "The new SMP Service Group for participant '" + aParticipantID.getURIEncoded() + "' was successfully created.");
} else {
// No exception here
LOGGER.error(sLogPrefix + "Error creating the new SMP Service Group for participant '" + aParticipantID.getURIEncoded() + "'.", aCaughtEx);
}
// Remember internally
final ISMPParticipantMigration aMigration = aParticipantMigrationMgr.createInboundParticipantMigration(aParticipantID, sMigrationKey);
if (aMigration != null) {
LOGGER.info(sLogPrefix + "The participant migration for '" + aParticipantID.getURIEncoded() + "' with migration key '" + sMigrationKey + "' was successfully performed. Please inform the source SMP that the migration was successful.");
} else {
// No exception here
LOGGER.error(sLogPrefix + "Failed to store the participant migration for '" + aParticipantID.getURIEncoded() + "'.");
}
final IMicroDocument aResponseDoc = new MicroDocument();
final IMicroElement eRoot = aResponseDoc.appendElement("migrationInboundResponse");
eRoot.setAttribute("success", aSG != null && aMigration != null);
eRoot.setAttribute("serviceGroupCreated", aSG != null);
eRoot.setAttribute("migrationCreated", aMigration != null);
final XMLWriterSettings aXWS = new XMLWriterSettings().setIndent(EXMLSerializeIndent.INDENT_AND_ALIGN);
aUnifiedResponse.setContentAndCharset(MicroWriter.getNodeAsString(aResponseDoc, aXWS), aXWS.getCharset()).setMimeType(new MimeType(CMimeType.APPLICATION_XML).addParameter(CMimeType.PARAMETER_NAME_CHARSET, aXWS.getCharset().name())).disableCaching();
}
use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class PageSecureSMLCertificateUpdate method _updateSMPCertAtSML.
private void _updateSMPCertAtSML(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final FormErrorList aFormErrors) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final LocalDate aNow = PDTFactory.getCurrentLocalDate();
final String sMigrationDate = aWPEC.params().getAsString(FIELD_PM_MIGRATION_DATE);
final LocalDate aMigrationDate = PDTFromString.getLocalDateFromString(sMigrationDate, aDisplayLocale);
final String sMigrationPublicCert = aWPEC.params().getAsStringTrimmed(FIELD_PM_PUBLIC_CERT);
X509Certificate aMigrationPublicCert = null;
final ISMLInfo aSMLInfo = SMPMetaManager.getSettings().getSMLInfo();
if (StringHelper.hasText(sMigrationDate)) {
if (aMigrationDate == null)
aFormErrors.addFieldError(FIELD_PM_MIGRATION_DATE, "The provided certificate migration date '" + sMigrationDate + "' is invalid!");
else if (aMigrationDate.compareTo(aNow) <= 0)
aFormErrors.addFieldError(FIELD_PM_MIGRATION_DATE, "The certificate migration date must be in the future!");
}
if (StringHelper.hasNoText(sMigrationPublicCert)) {
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "A new public certificate must be provided.");
} else {
try {
aMigrationPublicCert = CertificateHelper.convertStringToCertficate(sMigrationPublicCert);
} catch (final CertificateException ex) {
// Fall through
}
if (aMigrationPublicCert == null)
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "The provided public certificate cannot be parsed as a X.509 certificate.");
else {
try {
aMigrationPublicCert.checkValidity();
} catch (final CertificateExpiredException ex) {
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "The provided public certificate is already expired!");
aMigrationPublicCert = null;
} catch (final CertificateNotYetValidException ex) {
// That's okay
}
if (!sMigrationPublicCert.startsWith(CertificateHelper.BEGIN_CERTIFICATE))
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "The provided public certificate value must start with '" + CertificateHelper.BEGIN_CERTIFICATE + "' (without the quotes)");
if (!sMigrationPublicCert.endsWith(CertificateHelper.END_CERTIFICATE))
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "The provided public certificate value must end with '" + CertificateHelper.END_CERTIFICATE + "' (without the quotes)");
}
}
if (aMigrationPublicCert != null) {
// Using the date only is okay here
final LocalDate aNotBefore = PDTFactory.createLocalDate(aMigrationPublicCert.getNotBefore());
final LocalDate aNotAfter = PDTFactory.createLocalDate(aMigrationPublicCert.getNotAfter());
if (aMigrationDate != null) {
if (aMigrationDate.isBefore(aNotBefore))
aFormErrors.addFieldError(FIELD_PM_MIGRATION_DATE, "The provided certificate migration date " + PDTToString.getAsString(aMigrationDate, aDisplayLocale) + " must not be before the certificate NotBefore date " + PDTToString.getAsString(aNotBefore, aDisplayLocale) + "!");
if (aMigrationDate.isAfter(aNotAfter))
aFormErrors.addFieldError(FIELD_PM_MIGRATION_DATE, "The provided certificate migration date " + PDTToString.getAsString(aMigrationDate, aDisplayLocale) + " must not be after the certificate NotAfter date " + PDTToString.getAsString(aNotAfter, aDisplayLocale) + "!");
} else {
if (aNotBefore.compareTo(aNow) <= 0)
aFormErrors.addFieldError(FIELD_PM_PUBLIC_CERT, "The effective certificate migration date (" + PDTToString.getAsString(aNotBefore, aDisplayLocale) + " - taken from the new public certificate) must be in the future!");
}
}
if (aFormErrors.isEmpty()) {
try {
final BDMSLClient aCaller = new BDMSLClient(aSMLInfo);
aCaller.setSSLSocketFactory(SMPKeyManager.getInstance().createSSLContext().getSocketFactory());
aCaller.prepareChangeCertificate(sMigrationPublicCert, aMigrationDate);
final LocalDateTime aNotBefore = PDTFactory.createLocalDateTime(aMigrationPublicCert.getNotBefore());
final LocalDateTime aNotAfter = PDTFactory.createLocalDateTime(aMigrationPublicCert.getNotAfter());
final LocalDate aEffectiveMigrationDate = aMigrationDate != null ? aMigrationDate : aNotBefore.toLocalDate();
final String sMsg = "Successfully prepared migration of SMP certificate at SML '" + aSMLInfo.getManagementServiceURL() + "'" + " to be exchanged at " + PDTToString.getAsString(aEffectiveMigrationDate, aDisplayLocale) + ".";
LOGGER.info(sMsg);
aNodeList.addChild(success().addChild(div(sMsg)).addChild(div("Issuer: " + aMigrationPublicCert.getIssuerX500Principal().toString())).addChild(div("Subject: " + aMigrationPublicCert.getSubjectX500Principal().toString())).addChild(div("Not before: " + PDTToString.getAsString(aNotBefore, aDisplayLocale))).addChild(div("Not after: " + PDTToString.getAsString(aNotAfter, aDisplayLocale))));
AuditHelper.onAuditExecuteSuccess("smp-sml-update-cert", aSMLInfo.getManagementServiceURL(), sMigrationPublicCert, aMigrationDate);
} catch (final Exception ex) {
final String sMsg = "Error preparing migration of SMP certificate at SML '" + aSMLInfo.getManagementServiceURL() + "'.";
LOGGER.error(sMsg, ex);
aNodeList.addChild(error(sMsg).addChild(SMPCommonUI.getTechnicalDetailsUI(ex)));
AuditHelper.onAuditExecuteFailure("smp-sml-update-cert", aSMLInfo.getManagementServiceURL(), sMigrationPublicCert, aMigrationDate, ex.getClass(), ex.getMessage());
}
} else
aNodeList.addChild(BootstrapWebPageUIHandler.INSTANCE.createIncorrectInputBox(aWPEC));
}
use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class PageSecureSMLRegistration method _updateSMPatSML.
private void _updateSMPatSML(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final FormErrorList aFormErrors) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final ESMPRESTType eRESTType = SMPServerConfiguration.getRESTType();
final boolean bUsePeppolConstraints = eRESTType.isPeppol();
final boolean bUsePathConstraints = eRESTType.isPathConstraint();
final String sSMLID = aWPEC.params().getAsString(FIELD_SML_ID);
final ISMLInfo aSMLInfo = SMPMetaManager.getSMLInfoMgr().getSMLInfoOfID(sSMLID);
final String sPhysicalAddress = aWPEC.params().getAsString(FIELD_PHYSICAL_ADDRESS);
final String sLogicalAddress = aWPEC.params().getAsString(FIELD_LOGICAL_ADDRESS);
if (aSMLInfo == null)
aFormErrors.addFieldError(FIELD_SML_ID, "A valid SML must be selected!");
if (StringHelper.hasNoText(sPhysicalAddress))
aFormErrors.addFieldError(FIELD_PHYSICAL_ADDRESS, "A physical address must be provided!");
else if (!RegExHelper.stringMatchesPattern(IPV4Addr.PATTERN_IPV4, sPhysicalAddress))
aFormErrors.addFieldError(FIELD_PHYSICAL_ADDRESS, "The provided physical address does not seem to be an IPv4 address!");
else {
final String[] aParts = StringHelper.getExplodedArray('.', sPhysicalAddress, 4);
final byte[] aBytes = new byte[] { (byte) StringParser.parseInt(aParts[0], -1), (byte) StringParser.parseInt(aParts[1], -1), (byte) StringParser.parseInt(aParts[2], -1), (byte) StringParser.parseInt(aParts[3], -1) };
try {
InetAddress.getByAddress(aBytes);
} catch (final UnknownHostException ex) {
aFormErrors.addFieldError(FIELD_PHYSICAL_ADDRESS, "The provided IP address does not resolve to a valid host. " + SMPCommonUI.getTechnicalDetailsString(ex));
}
}
if (StringHelper.hasNoText(sLogicalAddress))
aFormErrors.addFieldError(FIELD_LOGICAL_ADDRESS, "A logical address must be provided in the form 'http://smp.example.org'!");
else {
final URL aURL = URLHelper.getAsURL(sLogicalAddress);
if (aURL == null)
aFormErrors.addFieldError(FIELD_LOGICAL_ADDRESS, "The provided logical address seems not be a URL! Please use the form 'http://smp.example.org'");
else {
if (!"http".equals(aURL.getProtocol())) {
if (bUsePeppolConstraints || !"https".equals(aURL.getProtocol()))
aFormErrors.addFieldError(FIELD_LOGICAL_ADDRESS, "The provided logical address must use the 'http'" + (bUsePeppolConstraints ? "" : " or the 'https'") + " protocol and may not use the '" + aURL.getProtocol() + "' protocol." + (bUsePeppolConstraints ? " According to the Peppol SMP specification, no other protocols than 'http' are allowed!" : ""));
}
if (bUsePeppolConstraints) {
// -1 means default port
if (aURL.getPort() != 80 && aURL.getPort() != -1)
aFormErrors.addFieldError(FIELD_LOGICAL_ADDRESS, "The provided logical address must use the default http port 80 and not port " + aURL.getPort() + ". According to the Peppol SMP specification, no other ports are allowed!");
}
if (bUsePathConstraints) {
if (StringHelper.hasText(aURL.getPath()) && !"/".equals(aURL.getPath()))
aFormErrors.addFieldError(FIELD_LOGICAL_ADDRESS, "The provided logical address may not contain a path (" + aURL.getPath() + ") because according to the SMP specifications it must run in the root (/) path!");
}
}
}
if (aFormErrors.isEmpty()) {
final String sSMPID = SMPServerConfiguration.getSMLSMPID();
try {
final SSLSocketFactory aSocketFactory = SMPKeyManager.getInstance().createSSLContext().getSocketFactory();
final ManageServiceMetadataServiceCaller aCaller = _create(aSMLInfo, aSocketFactory);
aCaller.update(sSMPID, sPhysicalAddress, sLogicalAddress);
final String sMsg = "Successfully updated SMP '" + sSMPID + "' with physical address '" + sPhysicalAddress + "' and logical address '" + sLogicalAddress + "' at the SML '" + aSMLInfo.getManagementServiceURL() + "'.";
LOGGER.info(sMsg);
aNodeList.addChild(success(sMsg));
AuditHelper.onAuditExecuteSuccess("smp-sml-update", sSMPID, sPhysicalAddress, sLogicalAddress, aSMLInfo.getManagementServiceURL());
} catch (final Exception ex) {
final String sMsg = "Error updating SMP '" + sSMPID + "' with physical address '" + sPhysicalAddress + "' and logical address '" + sLogicalAddress + "' to the SML '" + aSMLInfo.getManagementServiceURL() + "'.";
aNodeList.addChild(error(sMsg).addChild(SMPCommonUI.getTechnicalDetailsUI(ex)));
AuditHelper.onAuditExecuteFailure("smp-sml-update", sSMPID, sPhysicalAddress, sLogicalAddress, aSMLInfo.getManagementServiceURL(), ex.getClass(), ex.getMessage());
}
} else
aNodeList.addChild(BootstrapWebPageUIHandler.INSTANCE.createIncorrectInputBox(aWPEC));
}
use of com.helger.peppol.sml.ISMLInfo in project phoss-smp by phax.
the class PageSecureSMLRegistration method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
if (!_canShowPage(aWPEC))
return;
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final FormErrorList aFormErrors = new FormErrorList();
final boolean bShowInput = true;
final ISMLInfo aDefaultSML = SMPMetaManager.getSettings().getSMLInfo();
final String sSMPID = SMPServerConfiguration.getSMLSMPID();
if (aDefaultSML != null) {
// Check if this SMP is already registered
final String sPublisherDNSName = sSMPID + "." + aDefaultSML.getPublisherDNSZone();
try {
final InetAddress aIA = InetAddress.getByName(sPublisherDNSName);
aNodeList.addChild(success(div("An SMP is already registered at the configured SML using the DNS name '" + sPublisherDNSName + "'. The determined IP address is " + aIA.getHostAddress())).addChild(div("Note: this can be a different machine than this one, if another SMP uses the same ID as this one (" + sSMPID + ")")));
} catch (final UnknownHostException ex) {
// continue
}
}
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
if (aWPEC.hasSubAction(SUBACTION_SMP_REGISTER))
_registerSMPtoSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_UPDATE))
_updateSMPatSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_DELETE))
_deleteSMPfromSML(aWPEC, aFormErrors);
}
if (bShowInput) {
// Get default from configuration
final String sPhysicalAddress = SMPServerConfiguration.getSMLSMPIP();
final String sLogicalAddress = SMPServerConfiguration.getSMLSMPHostname();
String sDefaultPhysicalAddress = "";
String sDefaultLogicalAddress = "";
try {
final InetAddress aLocalHost = InetAddress.getLocalHost();
sDefaultPhysicalAddress = aLocalHost.getHostAddress();
sDefaultLogicalAddress = "http://" + aLocalHost.getCanonicalHostName();
} catch (final UnknownHostException ex) {
LOGGER.error("Error determining localhost address", ex);
}
final BootstrapTabBox aTabBox = new BootstrapTabBox();
final Predicate<ISMLInfo> aSMLFilter = ISMLInfo::isClientCertificateRequired;
// Register SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Register this SMP to the SML. This must only be done once per SMP!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML != null ? aDefaultSML.getID() : null), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_REGISTER);
aToolbar.addSubmitButton("Register SMP at SML");
aTabBox.addTab("register", "Register SMP to SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_REGISTER));
}
// Update SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Update this SMP at the SML. This must only be done when either the IP address or the host name of the SMP changed!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_UPDATE);
aToolbar.addSubmitButton("Update SMP at SML");
aTabBox.addTab("update", "Update SMP at SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_UPDATE));
}
// Delete SMP from SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Delete this SMP from the SML."));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_DELETE);
aToolbar.addSubmitButton("Delete SMP from SML");
aTabBox.addTab("delete", "Delete SMP from SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_DELETE));
}
aNodeList.addChild(aTabBox);
}
}
Aggregations