@Nonnull public IMicroElement convertToMicroElement (@Nonnull final NamedSMTPSettings aNamedSMTPSettings, @Nullable final String sNamespaceURI, @Nonnull final String sTagName) { final IMicroElement eSMTPSettings = new MicroElement (sNamespaceURI, sTagName); eSMTPSettings.setAttribute (ATTR_ID, aNamedSMTPSettings.getID ()); eSMTPSettings.appendElement (sNamespaceURI, ELEMENT_NAME).appendText (aNamedSMTPSettings.getName ()); eSMTPSettings.appendChild (MicroTypeConverter.convertToMicroElement (aNamedSMTPSettings.getSMTPSettings (), sNamespaceURI, ELEMENT_SMTPSETTINGS)); return eSMTPSettings; }
@Nonnull public NamedSMTPSettings convertToNative (@Nonnull final IMicroElement eNamedSMTPSettings) { final String sID = eNamedSMTPSettings.getAttributeValue (ATTR_ID); final String sName = MicroHelper.getChildTextContent (eNamedSMTPSettings, ELEMENT_NAME); final IMicroElement eSMTPSettings = eNamedSMTPSettings.getFirstChildElement (ELEMENT_SMTPSETTINGS); final ISMTPSettings aSMTPSettings = MicroTypeConverter.convertToNative (eSMTPSettings, SMTPSettings.class); return new NamedSMTPSettings (sID, sName, aSMTPSettings); } }
NamedSMTPSettings (@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sName, @Nonnull final ISMTPSettings aSMTPSettings) { ValueEnforcer.notEmpty (sID, "ID"); m_sID = sID; setName (sName); setSMTPSettings (aSMTPSettings); }
final ISMTPSettings aSettings = aSelectedObject.getSMTPSettings (); aSelectedObject.getName ()))); .setCtrl (aSelectedObject.getName ()));
eChange = eChange.or (aNamedSettings.setName (sName)); eChange = eChange.or (aNamedSettings.setSMTPSettings (aSettings)); if (eChange.isUnchanged ()) return EChange.UNCHANGED; markAsChanged (); AuditHelper.onAuditModifySuccess (NamedSMTPSettings.OT, aNamedSettings.getID (), aNamedSettings.getName (), aSettings.getHostName (), Integer.valueOf (aSettings.getPort ()),
@Override protected void performDelete (@Nonnull final WPECTYPE aWPEC, @Nonnull final NamedSMTPSettings aSelectedObject) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); if (m_aMgr.removeSettings (aSelectedObject.getID ()).isChanged ()) { aWPEC.postRedirectGetInternal (new BootstrapSuccessBox ().addChild (EText.DELETE_SUCCESS.getDisplayTextWithArgs (aDisplayLocale, aSelectedObject.getName ()))); } else { aWPEC.postRedirectGetInternal (new BootstrapErrorBox ().addChild (EText.DELETE_ERROR.getDisplayTextWithArgs (aDisplayLocale, aSelectedObject.getName ()))); } } });
sPassword = aSelectedObject.getSMTPSettings ().getPassword (); if (m_aMgr.updateSettings (aSelectedObject.getID (), sName, aSMTPSettings).isChanged ()) aWPEC.postRedirectGetInternal (new BootstrapSuccessBox ().addChild (EText.SUCCESS_EDIT.getDisplayText (aDisplayLocale)));
public NamedSMTPSettings addSettings (@Nonnull @Nonempty final String sName, @Nonnull final ISMTPSettings aSettings) final NamedSMTPSettings aNamedSettings = new NamedSMTPSettings (sName, aSettings); aNamedSettings.getID (), aNamedSettings.getName (), aSettings.getHostName (), Integer.valueOf (aSettings.getPort ()),
@Override @Nullable protected String getObjectDisplayName (@Nonnull final WPECTYPE aWPEC, @Nonnull final NamedSMTPSettings aSelectedObject) { return aSelectedObject.getName (); }
private static boolean _canDelete (@Nullable final NamedSMTPSettings aSettings) { return aSettings != null && !aSettings.getID ().equals (CNamedSMTPSettings.NAMED_SMTP_SETTINGS_DEFAULT_ID); }
/** * Get the SMTP settings with the default ID. * * @return <code>null</code> if no such settings are contained. */ @Nullable public ISMTPSettings getDefaultSMTPSettings () { final NamedSMTPSettings aSettings = getDefaultSettings (); return aSettings == null ? null : aSettings.getSMTPSettings (); }
final ISMTPSettings aSettings = aSelectedObject.getSMTPSettings (); aSelectedObject.getName ()))); .setCtrl (aSelectedObject.getName ()));
@Override protected void performDelete (@Nonnull final WPECTYPE aWPEC, @Nonnull final NamedSMTPSettings aSelectedObject) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); if (m_aMgr.removeSettings (aSelectedObject.getID ()).isChanged ()) { aWPEC.postRedirectGetInternal (new BootstrapSuccessBox ().addChild (EText.DELETE_SUCCESS.getDisplayTextWithArgs (aDisplayLocale, aSelectedObject.getName ()))); } else { aWPEC.postRedirectGetInternal (new BootstrapErrorBox ().addChild (EText.DELETE_ERROR.getDisplayTextWithArgs (aDisplayLocale, aSelectedObject.getName ()))); } } });
sPassword = aSelectedObject.getSMTPSettings ().getPassword (); if (m_aMgr.updateSettings (aSelectedObject.getID (), sName, aSMTPSettings).isChanged ()) aWPEC.postRedirectGetInternal (new BootstrapSuccessBox ().addChild (EText.SUCCESS_EDIT.getDisplayText (aDisplayLocale)));
@Override @Nullable protected String getObjectDisplayName (@Nonnull final WPECTYPE aWPEC, @Nonnull final NamedSMTPSettings aSelectedObject) { return aSelectedObject.getName (); }
private static boolean _canDelete (@Nullable final NamedSMTPSettings aSettings) { return aSettings != null && !aSettings.getID ().equals (CNamedSMTPSettings.NAMED_SMTP_SETTINGS_DEFAULT_ID); }
for (final NamedSMTPSettings aCurObject : m_aMgr.getAllSettings ().values ()) final ISMTPSettings aSettings = aCurObject.getSMTPSettings (); final ISimpleURL aViewLink = createViewURL (aWPEC, aCurObject); aRow.addCell (new HCA (aViewLink).addChild (aCurObject.getName ())); aRow.addCell (aSettings.getHostName () + (aSettings.hasPort () ? ":" + aSettings.getPort () : "")); aRow.addCell (aSettings.getUserName ()); aCurObject, EWebPageText.OBJECT_EDIT.getDisplayTextWithArgs (aDisplayLocale, aCurObject.getName ()))); if (_canDelete (aCurObject)) aActionCell.addChild (createDeleteLink (aWPEC, aCurObject, EWebPageText.OBJECT_DELETE.getDisplayTextWithArgs (aDisplayLocale, aCurObject.getName ()))); else aActionCell.addChild (createEmptyAction ()); .add (CPageParam.PARAM_OBJECT, aCurObject.getID ())) .setTitle (EText.MSG_SEND_TEST_MAIL.getDisplayText (aDisplayLocale)) .addChild (getTestMailIcon ()));
final ISMTPSettings aSettings = aSelectedObject == null ? null : aSelectedObject.getSMTPSettings (); aSelectedObject.getName ()) : EText.TITLE_CREATE.getDisplayText (aDisplayLocale))); .setCtrl (new HCEdit (new RequestField (FIELD_NAME, aSelectedObject == null ? null : aSelectedObject.getName ())).setPlaceholder (sName)) .setErrorList (aFormErrors.getListOfField (FIELD_NAME)));
@Override protected void showDeleteQuery (@Nonnull final WPECTYPE aWPEC, @Nonnull final BootstrapForm aForm, @Nonnull final NamedSMTPSettings aSelectedObject) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); aForm.addChild (new BootstrapQuestionBox ().addChild (EText.DELETE_QUERY.getDisplayTextWithArgs (aDisplayLocale, aSelectedObject.getName ()))); }
private void _addItem (@Nonnull final NamedSMTPSettings aNamedSMTPSettings) { final String sUserID = aNamedSMTPSettings.getID (); if (m_aMap.containsKey (sUserID)) throw new IllegalArgumentException ("NamedSMTPSettings ID " + sUserID + " is already in use!"); m_aMap.put (sUserID, aNamedSMTPSettings); }