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

java.lang.Object
  |
  +--org.apache.struts.action.Action
        |
        +--uk.ac.ebi.intact.application.intSeq.struts.framework.IntactBaseAction
Direct Known Subclasses:
AccessionSimilarityAction, ProteinSearchAction, SequenceSimilarityAction

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

Super class for all Intact related action classes. completed by shuet (shuet@ebi.ac.uk) with the ManageBlastResult method.

Version:
$Id: IntactBaseAction.java,v 1.4 2003/08/04 10:58:52 skerrien Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)

Field Summary
static java.lang.String INTACT_ERROR
          The global Intact error 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 clearErrors()
          Clear error container.
protected  void doSimilaritySearch(java.lang.String sequence, javax.servlet.http.HttpServletRequest request)
          Perform the similarity search operation.
Check the protein sequence and similarity search program parameters.
protected  java.lang.String getProperty(java.lang.String propName)
          returns a value stored in a properties file.
protected  java.lang.String getProperty(java.lang.String propName, java.lang.String defaultValue)
          eturns a value stored in a properties file, eventually a default value.
protected  java.lang.String getProteinsSrsUrl(java.lang.String searchString)
           
protected  java.lang.String getSequenceSrsUrl(java.lang.String proteinAc)
           
protected  javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
          Returns the session from given request.
protected  boolean isEmptyError()
          answer the question : "is the error set empty ?"
protected  java.util.ArrayList ManageBlastResult(java.lang.String sequence, java.lang.String commLine, java.lang.String perc_base, java.lang.String param)
          ManageBlastResult can be called from different action classes, to manage the execution of the command line provided and to retrieve alignment results from the parsing.
protected  void saveErrors(javax.servlet.http.HttpServletRequest request)
          Saves the errors in given request for tag.
 
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
Constructor Detail

IntactBaseAction

public IntactBaseAction()
Method Detail

getProperty

protected java.lang.String getProperty(java.lang.String propName)
returns a value stored in a properties file.

Parameters:
propName - the property name
Returns:
the associated value or null if not exists or file not loaded.

getProperty

protected java.lang.String getProperty(java.lang.String propName,
                                       java.lang.String defaultValue)
eturns a value stored in a properties file, eventually a default value.

Parameters:
propName - propName the property name
defaultValue - the default value in case the property is not found
Returns:
the associated value or a default value if not found or null if the file is not loaded.

getSession

protected javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
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.

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.

isEmptyError

protected boolean isEmptyError()
answer the question : "is the error set empty ?"


saveErrors

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

Parameters:
request - the request to save errors.

ManageBlastResult

protected java.util.ArrayList ManageBlastResult(java.lang.String sequence,
                                                java.lang.String commLine,
                                                java.lang.String perc_base,
                                                java.lang.String param)
                                         throws IntactException
ManageBlastResult can be called from different action classes, to manage the execution of the command line provided and to retrieve alignment results from the parsing.

Parameters:
sequence - which is aligned against sequences of the whole IntAct Database.
commLine - - the alignment algorithm is run in a server thanks to this command line which is defined in the web.xml file.
perc_base - is the minimum percentage identity required to validate the results.
param - is the maximum E Value allowed to validate the results.
Returns:
the reusulting collection.
IntactException

doSimilaritySearch

protected void doSimilaritySearch(java.lang.String sequence,
                                  javax.servlet.http.HttpServletRequest request)
Perform the similarity search operation.
Check the protein sequence and similarity search program parameters. The result is stored in the session in order to be red by a JSP. CAUTION: After calling that method you MUST check the content of ActionErrors like :
      if (false == isEmptyError()) {
         // FOrward to an error page.
         return mapping.findForward(SeqIdConstants.FORWARD_FAILURE);
      }
 

Parameters:
sequence - the protein sequence to work on.
request - HttpRequest to record Errors and using the session.

getProteinsSrsUrl

protected java.lang.String getProteinsSrsUrl(java.lang.String searchString)

getSequenceSrsUrl

protected java.lang.String getSequenceSrsUrl(java.lang.String proteinAc)


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