public class MailreaderSupport extends com.opensymphony.xwork2.ActionSupport implements SessionAware, ApplicationAware
Base Action for MailreaderSupport application.
Note that this class does NOT implement model driven because of the way the pre-existing model is designed. The MailReader DAO includes immutable fields that can only be set on construction, and some objects do not have a default construction. One approach would be to mirror all the DAO properties on the Actions. As an alternative, this implementations uses the DAO properties where possible, and uses local Action properties only as needed. To create new objects, a blank temporary object is constructed, and the page uses a mix of local Action properties and DAO properties. When the new object is to be saved, the local Action properties are used to create the object using the DAO factory methods, the input values are copied from the temporary object, and the new object is saved. It's kludge, but it avoids creating unnecessary local properties. Pick your poison.
| Modifier and Type | Field and Description |
|---|---|
protected com.opensymphony.xwork2.util.logging.Logger |
log
Log instance for this application. |
| Constructor and Description |
|---|
MailreaderSupport() |
| Modifier and Type | Method and Description |
|---|---|
String |
cancel()
Return CANCEL so apropriate result can be selected.
|
void |
copySubscription(String host)
Create a new Subscription from the current Subscription object,
making the new Subscription the current Subscription.
|
protected void |
copySubscription(org.apache.struts.apps.mailreader.dao.Subscription source,
org.apache.struts.apps.mailreader.dao.Subscription target)
Convenience method to copy Subscription properties.
|
void |
copyUser(String _username,
String _password)
Use the current User object to create a new User object, and make
the new User object the authenticated user.
|
protected void |
copyUser(org.apache.struts.apps.mailreader.dao.User source,
org.apache.struts.apps.mailreader.dao.User target)
Convenience method to copy User properties.
|
void |
createInputSubscription()
Provide a "temporary" User Subscription object that can be used to
capture input values.
|
void |
createInputUser() |
org.apache.struts.apps.mailreader.dao.Subscription |
createSubscription(String host)
Provide new User Subscription object for the given host, or null if
the host is not unique.
|
org.apache.struts.apps.mailreader.dao.User |
createUser(String username,
String password)
Verify input for creating a new user, create the user, and process
the login.
|
org.apache.struts.apps.mailreader.dao.Subscription |
findSubscription()
Obtain uSER Subscription for the local Host property.
|
org.apache.struts.apps.mailreader.dao.Subscription |
findSubscription(String host)
Obtain User Subscription object for the given host, or return null
if not found.
|
org.apache.struts.apps.mailreader.dao.User |
findUser(String username,
String password)
Obtain User object from database, or return null if the credentials
are not found or invalid.
|
Map |
getApplication()
Provide application context.
|
org.apache.struts.apps.mailreader.dao.UserDatabase |
getDatabase()
Provide reference to UserDatabase, or null if the database is not
available.
|
String |
getHost()
Provide tSubscription host.
|
String |
getPassword()
Provide User password
|
String |
getPassword2()
Provide the User password confirmation.
|
Map |
getSession()
Provide session context.
|
org.apache.struts.apps.mailreader.dao.Subscription |
getSubscription()
Obtain the cached Subscription object, if any.
|
String |
getSubscriptionHost()
Provide MailServer Host for current User Subscription.
|
String |
getTask()
Provide worklow task.
|
String |
getToken()
Provide Token.
|
org.apache.struts.apps.mailreader.dao.User |
getUser()
Provide reference to User object for authenticated user.
|
String |
getUsername()
Provide User username.
|
void |
removeSubscription()
Delete the current Subscription object from the database.
|
void |
saveUser()
Persist the User object, including subscriptions, to the database.
|
void |
setApplication(Map value)
Store a new application context.
|
void |
setDatabase(org.apache.struts.apps.mailreader.dao.UserDatabase database)
Store a new reference to UserDatabase
|
void |
setHost(String value)
Store new Subscription host.
|
void |
setPassword(String value)
Store new User Password
|
void |
setPassword2(String value)
Store a new User password confirmation.
|
void |
setSession(Map value)
Store a new session context.
|
void |
setSubscription(org.apache.struts.apps.mailreader.dao.Subscription subscription)
Store new User Subscription.
|
void |
setTask(String value)
Store new workflow task.
|
void |
setToken(String value)
Store new Token.
|
void |
setUser(org.apache.struts.apps.mailreader.dao.User user)
Store new reference to User Object.
|
void |
setUsername(String value)
Store new User username
|
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, execute, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getFormatted, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, validateprotected com.opensymphony.xwork2.util.logging.Logger log
Log instance for this application.
public String cancel()
protected void copyUser(org.apache.struts.apps.mailreader.dao.User source,
org.apache.struts.apps.mailreader.dao.User target)
protected void copySubscription(org.apache.struts.apps.mailreader.dao.Subscription source,
org.apache.struts.apps.mailreader.dao.Subscription target)
public void setApplication(Map value)
Store a new application context.
setApplication in interface ApplicationAwarevalue - A Map representing application statepublic Map getApplication()
Provide application context.
public void setSession(Map value)
Store a new session context.
setSession in interface SessionAwarevalue - A Map representing session statepublic Map getSession()
Provide session context.
public String getTask()
Provide worklow task.
public void setTask(String value)
Store new workflow task.
value - The task to set.public String getToken()
Provide Token.
public void setToken(String value)
Store new Token.
value - The token to set.public String getHost()
Provide tSubscription host.
public void setHost(String value)
Store new Subscription host.
value - public String getPassword()
Provide User password
public void setPassword(String value)
Store new User Password
value - The password to set.public String getPassword2()
Provide the User password confirmation.
public void setPassword2(String value)
Store a new User password confirmation.
value - The confirmation password to set.public String getUsername()
Provide User username.
public void setUsername(String value)
Store new User username
value - The username to set.public org.apache.struts.apps.mailreader.dao.UserDatabase getDatabase()
Provide reference to UserDatabase, or null if the database is not available.
public void setDatabase(org.apache.struts.apps.mailreader.dao.UserDatabase database)
Store a new reference to UserDatabase
database - public org.apache.struts.apps.mailreader.dao.User getUser()
Provide reference to User object for authenticated user.
public void setUser(org.apache.struts.apps.mailreader.dao.User user)
Store new reference to User Object.
user - User object for authenticated userpublic org.apache.struts.apps.mailreader.dao.User findUser(String username, String password) throws org.apache.struts.apps.mailreader.dao.ExpiredPasswordException
Obtain User object from database, or return null if the credentials are not found or invalid.
username - User usernamepassword - User passwordorg.apache.struts.apps.mailreader.dao.ExpiredPasswordExceptionpublic void saveUser()
throws Exception
Persist the User object, including subscriptions, to the database.
Exception - on database errorpublic void createInputUser()
public org.apache.struts.apps.mailreader.dao.User createUser(String username, String password)
Verify input for creating a new user, create the user, and process the login.
public void copyUser(String _username, String _password)
Use the current User object to create a new User object, and make the new User object the authenticated user.
The "current" User object is usually a temporary object being used to capture input.
_username - User username_password - User passwordpublic org.apache.struts.apps.mailreader.dao.Subscription getSubscription()
Obtain the cached Subscription object, if any.
public void setSubscription(org.apache.struts.apps.mailreader.dao.Subscription subscription)
Store new User Subscription.
subscription - public org.apache.struts.apps.mailreader.dao.Subscription findSubscription(String host)
Obtain User Subscription object for the given host, or return null if not found.
It would be possible for this code to throw a NullPointerException, but the ExceptionHandler in the xwork.xml will catch that for us.
public org.apache.struts.apps.mailreader.dao.Subscription findSubscription()
Obtain uSER Subscription for the local Host property.
Usually, the host property will be set from the client request, because it was embedded in a link to the Subcription action.
public void createInputSubscription()
Provide a "temporary" User Subscription object that can be used to capture input values.
public org.apache.struts.apps.mailreader.dao.Subscription createSubscription(String host)
Provide new User Subscription object for the given host, or null if the host is not unique.
host - public void copySubscription(String host)
Create a new Subscription from the current Subscription object, making the new Subscription the current Subscription.
Usually, the "current" Subscription is a temporary object being used to capture input values.
host - public void removeSubscription()
Delete the current Subscription object from the database.
public String getSubscriptionHost()
Provide MailServer Host for current User Subscription.
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.