uk.ac.ebi.intact.application.hierarchView.struts.framework
Class IntactBaseAction

java.lang.Object
  |
  +--org.apache.struts.action.Action
        |
        +--uk.ac.ebi.intact.application.hierarchView.struts.framework.IntactBaseAction
Direct Known Subclasses:
ClickAction, ClickBehaviourAction, DisplayAction, DisplaySourceAction, HighlightmentAction, InitAction, InteractionNetworkAction, SearchAction, SourceAction

public abstract class IntactBaseAction
extends org.apache.struts.action.Action

Super class for all hierarchView related action classes.

Version:
$Id: IntactBaseAction.java,v 1.24 2004/01/31 11:39:23 skerrien Exp $
Author:
Samuel Kerrien (skerrien@ebi.ac.uk)

Field Summary
static java.lang.String INTACT_ERROR
          The global Intact error key.
static java.lang.String INTACT_MESSAGE
          The global Intact message key.
static org.apache.log4j.Logger logger
           
 
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
 
Constructor Summary
IntactBaseAction()
           
 
Method Summary
protected  void addError(java.lang.String key)
          Adds an error with given key.
protected  void addError(java.lang.String key, java.lang.String value)
          Adds an error with given key and value.
protected  void addMessage(java.lang.String key)
          Adds an Message with given key.
protected  void addMessage(java.lang.String key, java.lang.String value)
          Adds an Message with given key and value.
protected  void clearErrors()
          Clear error container.
protected  void clearMessages()
          Clear Message container.
protected  IntactUser createIntactUser(javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest aRequest)
          Create a new IntactUser and store it in the session.
A datasource is also initialised inside the IntactUser.
protected  IntactUserI getIntactUser(javax.servlet.http.HttpSession session)
          Returns the Intact User instance saved in a session.
protected  javax.servlet.http.HttpSession getNewSession(javax.servlet.http.HttpServletRequest request)
          Returns a session and create a new one if necessary.
protected  javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
          Returns the session from given request.
protected  boolean intactUserExists(javax.servlet.http.HttpSession session)
          Says if an IntactUser object is currently available in the session.
protected  boolean isErrorsEmpty()
          Specify if an the error set is empty.
protected  boolean isMessagesEmpty()
          Specify if an the Message set is empty.
protected  void produceImage(IntactUserI user)
          Produces image accordingly to the interaction network stored in the user : Any errors are stored in the ActionErrors object.
protected  void saveErrors(javax.servlet.http.HttpServletRequest request)
          Saves the errors in given request for tag.
protected  void saveMessages(javax.servlet.http.HttpServletRequest request)
          Saves the Messages in given request for tag.
 void updateInteractionNetwork(IntactUserI user, int action)
          Update the interaction network according to the specified action type: StrutsConstants.CREATE_INTERACTION_NETWORK : create a new interaction network StrutsConstants.ADD_INTERACTION_NETWORK : add a new interaction network to the existing's one StrutsConstants.UPDATE_INTERACTION_NETWORK : rebuild the current interaction network by taking into account any depth change Any errors are stored in the ActionErrors object.
 
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

logger

public static org.apache.log4j.Logger logger

INTACT_ERROR

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

See Also:
Constant Field Values

INTACT_MESSAGE

public static final java.lang.String INTACT_MESSAGE
The global Intact message key.

See Also:
Constant Field Values
Constructor Detail

IntactBaseAction

public IntactBaseAction()
Method Detail

intactUserExists

protected boolean intactUserExists(javax.servlet.http.HttpSession session)
Says if an IntactUser object is currently available in the session.

Parameters:
session - the session to look into.
Returns:
true is the IntactUser exists, else false.

getIntactUser

protected IntactUserI 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 IntactUserImpl stored in session
SessionExpiredException

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. Null is returned if there is no session associated with request.
SessionExpiredException

getNewSession

protected javax.servlet.http.HttpSession getNewSession(javax.servlet.http.HttpServletRequest request)
Returns a session and create a new one if necessary.

Parameters:
request - the request to get the session from.
Returns:
session associated with given request.

clearErrors

protected void clearErrors()
Clear error container.


addError

protected void addError(java.lang.String key)
Adds an error with given key.

Parameters:
key - the error key. This value is looked up in the IntactResources.properties bundle.

addError

protected void addError(java.lang.String key,
                        java.lang.String value)
Adds an error with given key and value.

Parameters:
key - the error key. This value is looked up in the IntactResources.properties bundle.
value - the value to substitute for the first place holder in the IntactResources.properties bundle.

saveErrors

protected void saveErrors(javax.servlet.http.HttpServletRequest request)
Saves the errors in given request for tag.

Parameters:
request - the request to save errors.

isErrorsEmpty

protected boolean isErrorsEmpty()
Specify if an the error set is empty.

Returns:
boolean false is there are any error registered, else true

clearMessages

protected void clearMessages()
Clear Message container.


addMessage

protected void addMessage(java.lang.String key)
Adds an Message with given key.

Parameters:
key - the Message key. This value is looked up in the Struts.properties bundle.

addMessage

protected void addMessage(java.lang.String key,
                          java.lang.String value)
Adds an Message with given key and value.

Parameters:
key - the Message key. This value is looked up in the Struts.properties bundle.
value - the value to substitute for the first place holder in the Struts.properties bundle.

saveMessages

protected void saveMessages(javax.servlet.http.HttpServletRequest request)
Saves the Messages in given request for tag.

Parameters:
request - the request to save errors.

isMessagesEmpty

protected boolean isMessagesEmpty()
Specify if an the Message set is empty.

Returns:
boolean false is there are any Message registered, else true

createIntactUser

protected IntactUser createIntactUser(javax.servlet.http.HttpSession session,
                                      javax.servlet.http.HttpServletRequest aRequest)
Create a new IntactUser and store it in the session.
A datasource is also initialised inside the IntactUser.

Parameters:
session - the user session where to store the IntactUser
Returns:
a brand new IntactUser or null is something goes wrong. check is the errorsAction is empty, any errors are reported in there.

produceImage

protected void produceImage(IntactUserI user)
Produces image accordingly to the interaction network stored in the user : Any errors are stored in the ActionErrors object. A test need to be done afterward to check if any errors have occured.
nothing is done if there is no existing interaction network.

Parameters:
user - where are saved produced data

updateInteractionNetwork

public void updateInteractionNetwork(IntactUserI user,
                                     int action)
                              throws MultipleResultException
Update the interaction network according to the specified action type:
  • StrutsConstants.CREATE_INTERACTION_NETWORK : create a new interaction network
  • StrutsConstants.ADD_INTERACTION_NETWORK : add a new interaction network to the existing's one
  • StrutsConstants.UPDATE_INTERACTION_NETWORK : rebuild the current interaction network by taking into account any depth change
  • Any errors are stored in the ActionErrors object. A test need to be done afterward to check if any errors have occured.

    Parameters:
    user - where are saved produced data
    action - to perform
    Throws:
    MultipleResultException - in case your query gives multiple results
    See Also:
    StrutsConstants


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