uk.ac.ebi.intact.application.predict.business
Class PredictUser

java.lang.Object
  |
  +--uk.ac.ebi.intact.application.predict.business.PredictUser
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, IntactUserI, java.io.Serializable
Direct Known Subclasses:
PredictUserOra, PredictUserPg

public abstract class PredictUser
extends java.lang.Object
implements IntactUserI, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

The super class for a predict user.

Version:
$Id: PredictUser.java,v 1.3 2004/02/13 10:04:07 smudali Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)
See Also:
Serialized Form

Field Summary
static java.lang.String SELECTED_SPECIE
           
 
Constructor Summary
PredictUser()
          Default constructor.
 
Method Summary
 void closeConnection()
          Closes the connection to the database.
static PredictUser create(java.lang.String mapping, java.lang.String dsClass)
          Factory method to create different instances of Predict user instances depending on the JDBC subprotocol.
 java.lang.String getDatabaseName()
          The name of the database connected to.
 java.util.List getDbInfo(java.lang.String specie)
          Returns a list of beans created from ia_payg database.
protected abstract  java.lang.String getDbInfoSQL(java.lang.String taxid)
           
 java.lang.String getDefaultChoice()
           
 java.lang.String getSpecieLink()
           
 java.util.List getSpecies()
          Returns a list of tax ids for species from the database.
protected abstract  java.lang.String getSpeciesSQL()
           
 java.lang.String getUserName()
          Returns the Intact user.
 java.util.Collection search(java.lang.String objectType, java.lang.String searchParam, java.lang.String searchValue)
          This method provides a means of searching intact objects, within the constraints provided by the parameters to the method.
 void setSpecie(java.lang.String specie)
           
 void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
          Will call this method when an object is bound to a session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
          Will call this method when an object is unbound from a session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTED_SPECIE

public static final java.lang.String SELECTED_SPECIE
See Also:
Constant Field Values
Constructor Detail

PredictUser

public PredictUser()
Default constructor. Loads the resources file.

Method Detail

create

public static PredictUser create(java.lang.String mapping,
                                 java.lang.String dsClass)
                          throws DataSourceException,
                                 IntactException
Factory method to create different instances of Predict user instances depending on the JDBC subprotocol.

Parameters:
mapping - the name of the mapping file.
dsClass - the class name of the Data Source.
Returns:
an instance of this class created using the JDBC subprotocol. A null object is returned for an unknown JDBC subprotocol. Currently oracle and postgres are known types.
Throws:
DataSourceException - for error in getting the data source; probably due to missing mapping file.
IntactException - for errors in creating IntactHelper; problem with reading the repository file.

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
Will call this method when an object is bound to a session. Not doing anything.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
Will call this method when an object is unbound from a session.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

getUserName

public java.lang.String getUserName()
Description copied from interface: IntactUserI
Returns the Intact user.

Specified by:
getUserName in interface IntactUserI
Returns:
the Intact user currently logged in. This methods could return null if there is no user associated with the current session (e.g., Editor) or for errors in retrieving user information from the database.

getDatabaseName

public java.lang.String getDatabaseName()
Description copied from interface: IntactUserI
The name of the database connected to.

Specified by:
getDatabaseName in interface IntactUserI
Returns:
the name of the database. Could be null for an error in getting the information from the database.

search

public java.util.Collection search(java.lang.String objectType,
                                   java.lang.String searchParam,
                                   java.lang.String searchValue)
                            throws IntactException
Description copied from interface: IntactUserI
This method provides a means of searching intact objects, within the constraints provided by the parameters to the method.

Specified by:
search in interface IntactUserI
Parameters:
objectType - the object type to be searched
searchParam - the parameter to search on (eg field)
searchValue - the search value to match with the parameter
Returns:
the results of the search (empty if no matches were found).
Throws:
IntactException - thrown if problems are encountered during the search process.

getSpecies

public java.util.List getSpecies()
                          throws IntactException,
                                 java.sql.SQLException
Returns a list of tax ids for species from the database.

Returns:
a list species as tax ids; no duplicates.
Throws:
IntactException - for accessing the datastore
java.sql.SQLException - thrown by the underlying database.
 pre: results->forall(obj: Object | obj.oclIsTypeOf(String))
 

getDefaultChoice

public java.lang.String getDefaultChoice()

getDbInfo

public java.util.List getDbInfo(java.lang.String specie)
                         throws IntactException,
                                java.sql.SQLException
Returns a list of beans created from ia_payg database.

Parameters:
specie - the species to get information from ia_payg database. The database is queried with this value.
Returns:
a list of ResultBean objects ready to display.
Throws:
IntactException - for accessing the datastore
java.sql.SQLException - thrown by the underlying database.
 pre: results->forall(obj: Object | obj.oclIsTypeOf(ResultBean))
 

closeConnection

public void closeConnection()
Closes the connection to the database.


getSpecieLink

public java.lang.String getSpecieLink()

setSpecie

public void setSpecie(java.lang.String specie)

getSpeciesSQL

protected abstract java.lang.String getSpeciesSQL()

getDbInfoSQL

protected abstract java.lang.String getDbInfoSQL(java.lang.String taxid)


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