org.alltimeflashdreamer.mailwebform
Class JSPBean

java.lang.Object
  extended byorg.alltimeflashdreamer.mailwebform.JSPBean
All Implemented Interfaces:
MailWebFormConstants, Serializable

public class JSPBean
extends Object
implements MailWebFormConstants, Serializable

Title: JSPBean
Description: This simple bean is designed to provide the constant and dynamic values used in the various JSP files. To be able to serve the various different JSP sites appropriately, the class contains a series of constructors that are designed to get the parameters used by the follower site(s).

Version:
0.9
Author:
Copyright (c) 2001-2004 Florian Steinsiepe, Adrian Zaugg
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.alltimeflashdreamer.mailwebform.MailWebFormConstants
ADMIN, ADMINSERVLET, APPNAME, COOKIENAME, CURRENTUSER, ERROR_URL, FILESEPARATOR, JSPBEAN, MAILFORMPROVIDER, MAILFORMPROVIDERLIST, MAILWEBFORM, MAILWEBFORMSERVLET, NEWLINE, PARAM_ADD, PARAM_APPLYGLOBAL, PARAM_APPLYINDIVIDUAL, PARAM_CANCEL, PARAM_CHANGE_CREDENTIALS, PARAM_CONFIGFILE, PARAM_CREDENTIALS_ADMIN, PARAM_EDIT, PARAM_ERRORURL, PARAM_FROMEMAIL, PARAM_FROMNAME, PARAM_LOGIN, PARAM_LOGOUT, PARAM_OVERWRITE, PARAM_PASSWORD, PARAM_PASSWORD_PROVIDER, PARAM_PROVIDER, PARAM_PROVIDERDIRECTORY, PARAM_REMOVE, PARAM_SMTPHOST, PARAM_SMTPPORT, PARAM_SPAMURL, PARAM_STORE, PARAM_SUBJECT, PARAM_SUCCESSURL, PARAM_TEMPLATE, PARAM_TEXT, PARAM_TOADDRESS, PARAM_TONAME, PARAM_USERNAME, PASSWORD, PASSWORDFILE, PLACEHOLDER_END, PLACEHOLDER_START, PROPERTY_CONFIGDIR, PROPERTY_SUFFIX, PROVIDERDIRECTORY, RESOURCENAME, SITE_CHANGE_CREDENTIALS, SITE_DEFAULTFORM, SITE_EDIT, SITE_ERROR, SITE_FOOTER, SITE_HEADER, SITE_LOGIN, SITE_MAIN, SITE_PROVIDER, SMTP_ALLOWOVERWRITE, SMTP_HOST, SMTP_PORT, SPAMERROR_URL, SUCCESS_URL, SYSTEMPROVIDER, TEMPLATE, TEMPLATE_SUFFIX, TOADDRESS, TONAME, USERNAME
 
Constructor Summary
  JSPBean()
          (inactive)
(package private) JSPBean(boolean bAccountWasNewlyCreated, String[] sProviders)
          Constructor simply stores the given boolean value, ready to be used on the main JSP site.
(package private) JSPBean(MailWebFormException mwfe)
          Constructor simply stores the fully rendered error message that consists of the error message of the given exception itself as well as those of the cascaded root cause(s), if any, ready to be shown on the error JSP site.
(package private) JSPBean(String sProviderName, GlobalProperties globalProperties, MailFormProviderList mailFormProviders)
          Constructor simply stores the given values, ready to be used on the one of the add/edit/edit-system-provider JSP sites.
(package private) JSPBean(String sProviderName, String sAdminUserName)
          Constructor simply stores the given string.
 
Method Summary
 String getAdminUserName()
          Returns the user name of the admin account, if set in the relative constructor, or null.
 String getChangeTitle(boolean bPasswordOnly)
          Returns the title to be shown on the change password/credentials pages of the admin tool.
 String getEditTitle()
          Returns the title to be shown on the edit pages of the admin tool.
 String getErrorMessage()
          Returns the error message, as received in the constructor, or an empty string, if not provided.
 String getErrorTitle()
          Returns the title to be shown on the error page of the admin tool.
 GlobalProperties getGlobalProperties()
          Returns the Properties implementation holding the application's global settings.
 String getLoginTitle()
          Returns the title to be shown on the login page of the admin tool.
 MailFormProvider getMailFormProvider(String sProviderName)
          Returns the specified provider instance or null, if the provider list hasn't been passed in the constructor or the specified provider name is not registered.
 MailFormProviderList getMailFormProviders()
          Returns the mail form provider list implementation.
 String getMainTitle()
          Returns the title to be shown on the main page of the admin tool.
 String[] getProviderList()
          Returns the list of providers, as received in the constructor, or an empty list, if another constructor was called.
 String getProviderName()
          Returns the name of the currently active provider or an empty string, if not set or a new one is to be created.
 boolean isAdmin(HttpServletRequest request)
          Returns whether the currently logged in user is the admin user or not.
 boolean isChangingAdminCredentials()
          Returns whether the user is currently changing the admin credentials or not.
 boolean isNewlyCreatedAccount()
          Returns whether the account was newly created or not.
 boolean isNewProvider()
          Returns whether currently a new provider is set up, i.e. whether a provider name is defined in here or not.
 boolean isSystemProvider()
          Returns whether currently the system provider's settings are edited or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSPBean

public JSPBean()
(inactive)


JSPBean

JSPBean(MailWebFormException mwfe)
Constructor simply stores the fully rendered error message that consists of the error message of the given exception itself as well as those of the cascaded root cause(s), if any, ready to be shown on the error JSP site.

Parameters:
mwfe - the error to be rendered

JSPBean

JSPBean(String sProviderName,
        String sAdminUserName)
Constructor simply stores the given string. If it's null, this indicates that not the admin credentials, but the password of a provider shall be changed.

Parameters:
sProviderName - the name of the current provider (empty string in case of the adding of a new one)
sAdminUserName - the user name of the admin account or null

JSPBean

JSPBean(boolean bAccountWasNewlyCreated,
        String[] sProviders)
Constructor simply stores the given boolean value, ready to be used on the main JSP site.

Parameters:
bAccountWasNewlyCreated - whether the account was newly created and the related message box shall be shown or not
sProviders - the list of providers to be shown in the select box

JSPBean

JSPBean(String sProviderName,
        GlobalProperties globalProperties,
        MailFormProviderList mailFormProviders)
Constructor simply stores the given values, ready to be used on the one of the add/edit/edit-system-provider JSP sites.

Parameters:
sProviderName - the name of the current provider (empty string in case of the adding of a new one)
globalProperties - the list of the global app properties
mailFormProviders - the provider list, holding the references to the various providers and their properties
Method Detail

getMailFormProvider

public MailFormProvider getMailFormProvider(String sProviderName)
Returns the specified provider instance or null, if the provider list hasn't been passed in the constructor or the specified provider name is not registered.

Parameters:
sProviderName - the name of the provider to be returned
Returns:
the specified provider instance or null

getErrorMessage

public String getErrorMessage()
Returns the error message, as received in the constructor, or an empty string, if not provided.

Returns:
the error message or an empty string

isNewlyCreatedAccount

public boolean isNewlyCreatedAccount()
Returns whether the account was newly created or not.

Returns:
show "successfully created account" message box?

getLoginTitle

public String getLoginTitle()
Returns the title to be shown on the login page of the admin tool.

Returns:
the (admin) login title

getErrorTitle

public String getErrorTitle()
Returns the title to be shown on the error page of the admin tool.

Returns:
the error title

getMainTitle

public String getMainTitle()
Returns the title to be shown on the main page of the admin tool.

Returns:
the main title

getEditTitle

public String getEditTitle()
Returns the title to be shown on the edit pages of the admin tool.

Returns:
the edit title

getChangeTitle

public String getChangeTitle(boolean bPasswordOnly)
Returns the title to be shown on the change password/credentials pages of the admin tool.

Parameters:
bPasswordOnly - whether only the password shall be changed or not (i.e. the whole [admin] credentials)
Returns:
the change title

getProviderList

public String[] getProviderList()
Returns the list of providers, as received in the constructor, or an empty list, if another constructor was called.

Returns:
the list of elements to be shown in the HTML select box

getProviderName

public String getProviderName()
Returns the name of the currently active provider or an empty string, if not set or a new one is to be created.

Returns:
the current provider's name or an empty string

isNewProvider

public boolean isNewProvider()
Returns whether currently a new provider is set up, i.e. whether a provider name is defined in here or not.

Returns:
adding new provider (on edit page)?

isSystemProvider

public boolean isSystemProvider()
Returns whether currently the system provider's settings are edited or not.

Returns:
current provider is the system provider?

getGlobalProperties

public GlobalProperties getGlobalProperties()
Returns the Properties implementation holding the application's global settings.

Returns:
the list of the global app properties

getMailFormProviders

public MailFormProviderList getMailFormProviders()
Returns the mail form provider list implementation.

Returns:
the provider list, holding the references to the various providers and their properties

isAdmin

public boolean isAdmin(HttpServletRequest request)
Returns whether the currently logged in user is the admin user or not.

Parameters:
request - where to read the current-user session property from
Returns:
whether this user is the application admin or not

isChangingAdminCredentials

public boolean isChangingAdminCredentials()
Returns whether the user is currently changing the admin credentials or not.

Returns:
client is on change-admin-credentials page?

getAdminUserName

public String getAdminUserName()
Returns the user name of the admin account, if set in the relative constructor, or null.

Returns:
the admin user name or null