uk.ac.ebi.intact.application.editor.struts.framework
Class AbstractEditorAction

java.lang.Object
  |
  +--org.apache.struts.action.Action
        |
        +--uk.ac.ebi.intact.application.editor.struts.framework.AbstractEditorAction
All Implemented Interfaces:
ForwardConstants
Direct Known Subclasses:
AnnotationDispatchAction, CancelFormAction, DeleteFormAction, EditorChoiceAction, ExperimentAction, ExperimentHoldAction, FillCvFormAction, FillResultFormAction, InteractionAction, InteractionHoldAction, LoginAction, LogoutAction, ProteinDispatchAction, ProteinSearchAction, ResultAction, SubmitFormAction, XrefDispatchAction

public abstract class AbstractEditorAction
extends org.apache.struts.action.Action
implements ForwardConstants

Super class for all Editor related action classes.

Version:
$Id: AbstractEditorAction.java,v 1.23 2004/03/30 21:31:05 smudali Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)

Field Summary
static java.lang.String EDITOR_ERROR
          The global Intact error key.
protected static org.apache.log4j.Logger LOGGER
          The logger for Editor.
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Fields inherited from interface uk.ac.ebi.intact.application.editor.struts.framework.util.ForwardConstants
EXP, FAILURE, MATCH, NO_MATCH, RESULT, SEARCH, SUCCESS
 
Constructor Summary
AbstractEditorAction()
           
 
Method Summary
protected  EditUserI getIntactUser(javax.servlet.http.HttpServletRequest request)
          Returns the Intact User instance saved in a session for given Http request.
protected  EditUserI getIntactUser(javax.servlet.http.HttpSession session)
          Returns the Intact User instance saved in a session.
protected  EditorService getService()
          Returns the only instance of Intact Service instance.
protected  javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
          Returns the session from given request.
protected  boolean hasErrors(javax.servlet.http.HttpServletRequest request)
          Returns true if errors in stored in the request
protected  boolean isPropertyEmpty(org.apache.struts.action.DynaActionForm form, java.lang.String name)
          Returns true if given property is empty.
static boolean isPropertyEmpty(java.lang.String value)
          Returns true if given value is empty.
protected  boolean isPropertyNull(org.apache.struts.action.DynaActionForm form, java.lang.String name)
          Returns true if the property for given name is null.
protected  boolean isPropertyNullOrEmpty(org.apache.struts.action.DynaActionForm form, java.lang.String name)
          Returns true if the property for given name is empty.
protected  void removeFormBean(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Removes the obsolete form bean.
protected  boolean returnToExperiment(javax.servlet.http.HttpServletRequest request)
          Returns true if the next forward action is back to the experiment editor.
protected  void setDestinationExperiment(javax.servlet.http.HttpServletRequest request)
          Sets the destination experiment to edit.
 
Methods inherited from class org.apache.struts.action.Action
execute, execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDITOR_ERROR

public static final java.lang.String EDITOR_ERROR
The global Intact error key.

See Also:
Constant Field Values

LOGGER

protected static final org.apache.log4j.Logger LOGGER
The logger for Editor. Allow access from the subclasses.

Constructor Detail

AbstractEditorAction

public AbstractEditorAction()
Method Detail

isPropertyEmpty

public static boolean isPropertyEmpty(java.lang.String value)
Returns true if given value is empty.

Parameters:
value - the value to check for empty.
Returns:
true if value is empty; any excess spaces are removed before checking for empty.

getService

protected EditorService getService()
Returns the only instance of Intact Service instance.

Returns:
only instance of the EditorService class.

getIntactUser

protected EditUserI getIntactUser(javax.servlet.http.HttpServletRequest request)
                           throws SessionExpiredException
Returns the Intact User instance saved in a session for given Http request.

Parameters:
request - the Http request to access the Intact user object.
Returns:
an instance of EditUser stored in a session. No new session is created.
Throws:
SessionExpiredException - for an expired session.
 post: return <> Undefined
 

getIntactUser

protected EditUserI getIntactUser(javax.servlet.http.HttpSession session)
                           throws SessionExpiredException
Returns the Intact User instance saved in a session.

Parameters:
session - the session to access the Intact user object.
Returns:
an instance of EditUser stored in session
Throws:
SessionExpiredException - for an expired session.
 post: return <> Undefined
 

getSession

protected javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
                                             throws SessionExpiredException
Returns the session from given request. No new session is created.

Parameters:
request - the request to get the session from.
Returns:
session associated with given request.
Throws:
SessionExpiredException - for an expired session.
 post: return <> Undefined
 

removeFormBean

protected void removeFormBean(org.apache.struts.action.ActionMapping mapping,
                              javax.servlet.http.HttpServletRequest request)
Removes the obsolete form bean.

Parameters:
mapping - the ActionMapping used to select this instance.
request - the HTTP request we are processing.

hasErrors

protected boolean hasErrors(javax.servlet.http.HttpServletRequest request)
Returns true if errors in stored in the request

Parameters:
request - Http request to search errors for.
Returns:
true if strut's error is found in request and it is not null. For all instances, false is returned.

isPropertyNullOrEmpty

protected boolean isPropertyNullOrEmpty(org.apache.struts.action.DynaActionForm form,
                                        java.lang.String name)
Returns true if the property for given name is empty. This assumes the property value for given name is a String object.

Parameters:
form - the form to check.
name - the name of the property to check.
Returns:
true if name is empty in form.
 pre: form.get(name).class.getName() == java.lang.String
 

isPropertyNull

protected boolean isPropertyNull(org.apache.struts.action.DynaActionForm form,
                                 java.lang.String name)
Returns true if the property for given name is null.

Parameters:
form - the form to check.
name - the name of the property to check.
Returns:
true if name is null in form.

isPropertyEmpty

protected boolean isPropertyEmpty(org.apache.struts.action.DynaActionForm form,
                                  java.lang.String name)
Returns true if given property is empty.

Parameters:
form - the form to check.
name - the name of the property; the value stored under this property must be a String type.
Returns:
true if property name is empty; any excess spaces are removed before checking for empty.

returnToExperiment

protected boolean returnToExperiment(javax.servlet.http.HttpServletRequest request)
                              throws SessionExpiredException
Returns true if the next forward action is back to the experiment editor. This is applicable to the InteractionView bean only.

Parameters:
request - the Http request to access the user.
Returns:
true if the next action path is back to the experiment editor.
Throws:
SessionExpiredException - if the session is expired.

setDestinationExperiment

protected void setDestinationExperiment(javax.servlet.http.HttpServletRequest request)
                                 throws SessionExpiredException,
                                        SearchException
Sets the destination experiment to edit. As a pre requisite returnToExperiment(HttpServletRequest) must be true.

Parameters:
request - the Http request to access the user.
Throws:
SessionExpiredException - if the session is expired.
SearchException - unable to access the experiment to go back to.
 pre: returnToExperiment(request) == true
 


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk