uk.ac.ebi.intact.business
Class IntactHelper

java.lang.Object
  |
  +--uk.ac.ebi.intact.business.IntactHelper
All Implemented Interfaces:
java.io.Externalizable, SearchI, java.io.Serializable

public class IntactHelper
extends java.lang.Object
implements SearchI, java.io.Externalizable

This class implements the business logic for intact. The requests to be processed are usually obtained (in a webapp environment) from a struts action class and then the business operations are carried out, via the DAO interface to the data source.

Author:
Chris Lewington
See Also:
Serialized Form

Constructor Summary
IntactHelper()
          Shortcut constructor
IntactHelper(DAOSource source)
          Constructor - requires a datasource to be provided.
IntactHelper(DAOSource source, java.lang.String user, java.lang.String password)
          Constructor allowing a helper instance to be created with a given username and password.
IntactHelper(java.util.Map classInfo, DAOSource source)
           This constructor allows creation of an IntactHelper with a Map of java classnames to PropertyDescriptor information.
 
Method Summary
 void addCachedClass(java.lang.Class clazz)
          cache to be used for caching by shortLabel.
 void cancelUpdate(java.lang.Object obj)
          Cancels the update for the given object.
 void clearCache()
          Wipe the whole cache.
 void closeData(java.util.Iterator items)
          Closes result data.
 void closeStore()
          close the data source.
 void create(java.util.Collection objects)
          This method provides a create operation for intact objects.
 void create(java.lang.Object obj)
          Convenience method to create a single object in persistent store.
 void delete(java.lang.Object obj)
          This method provides a delete operation.
 void deleteAllElements(java.util.Collection aCollection)
          Delete all elements in a collection.
 void finishTransaction()
          ends a busines transaction.
 BioSource getBioSourceByName(java.lang.String name)
          This method is used for searching by scientific name (provided that name is unique).
 BioSource getBioSourceByTaxId(java.lang.String taxId)
          Searches for a BioSource given a tax ID.
 java.util.Iterator getColumnData(java.lang.String type, java.lang.String[] cols)
          Allows access to column data rather than whole objects.
 java.util.Collection getComponentsByRole(CvComponentRole role)
          Search for components given a role.
 java.lang.String getDbName()
          Provides the database name that is being connected to.
 java.lang.String getDbUserName()
          Provides the user name that is connecting to the DB.
static java.lang.String getDisplayableClassName(java.lang.Class clazz)
          From the real className of className, gets a displayable name.
static java.lang.String getDisplayableClassName(java.lang.Object obj)
          From the real className of an object, gets a displayable name.
static java.lang.String getDisplayableClassName(java.lang.String name)
          From the real className of className, gets a displayable name.
 Experiment getExperimentBySource(BioSource source)
          Search for an experiment given a specific BioSource.
 java.util.Collection getExperimentsByInstitution(Institution institution)
          Search for Experiments given an Institution.
 Institution getInstitution()
          Allow the user not to know about the it's Institution, it has to be configured once in the properties file: ${INTACTCORE_HOME}/config/Institution.properties and then when calling that method, the Institution is either retreived or created according to its shortlabel.
 java.util.Collection getInteractionsByType(CvInteractionType type)
          Search for interactions given a type.
 java.util.Collection getInteractorBySource(java.lang.Class clazz, BioSource source)
          This method is used for obtaining an interactor given a specific BioSource and the subclass of Interactor that is to be searched for.
 java.sql.Connection getJDBCConnection()
          Gets the underlying JDBC connection.
 org.apache.log4j.Logger getLogger()
           
 java.lang.Object getObjectByAc(java.lang.Class clazz, java.lang.String ac)
          Return an Object by classname and ac.
 java.lang.Object getObjectByLabel(java.lang.Class clazz, java.lang.String label)
          Return an Object by classname and shortLabel.
 java.lang.Object getObjectByName(java.lang.Class clazz, java.lang.String name)
          This method retrieves an intact object, given a class and the object's full name (provided that name is unique).
 java.lang.Object getObjectByXref(java.lang.Class clazz, java.lang.String aPrimaryId)
          Searches for a unique Object by classname and Xref.
 java.util.Collection getObjectsByAlias(java.lang.Class clazz, java.lang.String aliasName)
          Search for objects by any alias with the specified name.
 java.util.Collection getObjectsByAlias(java.lang.Class clazz, java.lang.String aliasName, CvAliasType cvAliasType)
          Search for objects by any alias with the specified name.
 java.util.Collection getObjectsByAlias(java.lang.Class clazz, java.lang.String aliasName, java.lang.String aliasTypeShortLabel)
          Search for objects by any alias with the specified name.
 java.util.Collection getObjectsByXref(java.lang.Class clazz, java.lang.String aPrimaryId)
          Searches for objects by classname and Xref.
 Protein getProteinByXref(Xref xref)
          Search for Protein given a cross reference.
static java.lang.Class getRealClassName(java.lang.Object obj)
          Gives the Object classname, give the real object class name if this is a VirtualProxy class
static IntactObject getRealIntactObject(IntactObject obj)
          Returns the real object wrapped around the proxy for given object of IntactObjectProxy type.
 java.util.Collection getRelatedExperiments(java.lang.Object item)
          Used to obtain the Experiments related to a search object.
 java.util.Collection getRelations(BasicObject base)
          This method obtains the nearest neighbours (ie the next level of related objects) to a given intact object.
 java.util.Collection getSpliceProteinsByXref(java.lang.String primaryId)
          Searches for splice objects by primaryId.
 boolean isInTransaction()
           
 boolean isPersistent(java.lang.Object obj)
          Wrapper for uk.ac.ebi.intact.persistence#DAO(Object)
 boolean isUserVerified(java.lang.String user, java.lang.String password)
          validates a user's credentials against the data store.
 java.util.Iterator iterSearch(java.lang.String objectType, java.lang.String searchParam, java.lang.String searchValue)
          Search which provides an Iterator rather than a Collection.
 void lock(CvObject cvobj)
          Locks the given object for write access.
 java.util.Collection paramSearch(java.lang.String objectType, java.lang.String searchParam, java.lang.String searchValue, boolean includeSubClass, boolean matchSubString)
          This method provides a means of searching intact objects, within the constraints provided by the parameters to the method.
 void readExternal(java.io.ObjectInput in)
          Used for serialization via Externalizable.
 void removeFromCache(java.lang.Object obj)
          Removes given object from the cache.
 java.util.Collection search(java.lang.Object obj)
          Deprecated. This should not be used with the new model, as applications should not use no-arg constructors.
 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.
 java.util.Collection searchBySQL(java.lang.String type, java.lang.String sqlString)
          Allows search by raw SQL String.
 void startTransaction(int transactionType)
          starts a business level transaction.
 java.util.List stringSearch(java.lang.String objectType, java.lang.String searchString, boolean includeSubClass, boolean matchSubString)
          Not Yet Fully Implemented.
 Graph subGraph(Interactor startNode, int graphDepth, java.util.Collection experiments, int complexExpansion, Graph graph)
          Returns a subgraph centered on startNode.
 void undoTransaction()
          unwraps a transaction.
 void update(java.lang.Object obj)
          This method provides an update operation.
 void writeExternal(java.io.ObjectOutput out)
          Method required for writing to disk via Serializable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntactHelper

public IntactHelper(DAOSource source)
             throws IntactException
Constructor - requires a datasource to be provided.

Parameters:
source - - a datasource object from which a connection could be obtained. Note that use of this constructor prevents optimisation of reflection and may result in slower response times for eg initial searches.
Throws:
IntactException - - thrown if either the type map or source are invalid

IntactHelper

public IntactHelper()
             throws IntactException
Shortcut constructor

Throws:
IntactException - - thrown if either the type map or source are invalid

IntactHelper

public IntactHelper(DAOSource source,
                    java.lang.String user,
                    java.lang.String password)
             throws IntactException
Constructor allowing a helper instance to be created with a given username and password.

Parameters:
source - - the data source to be connected to
user - - the username to make a connection with
password - - the user's password (null values allowed)

IntactHelper

public IntactHelper(java.util.Map classInfo,
                    DAOSource source)
             throws IntactException

This constructor allows creation of an IntactHelper with a Map of java classnames to PropertyDescriptor information. Supplying the Map allows for performance improvements since it reduces the reflection operations needed. The format of the Map should be as follows:

Parameters:
source - the data source to be used
classInfo - the Map containing reflection information for classes
Throws:
IntactException - thrown if no data source is supplied
Method Detail

addCachedClass

public void addCachedClass(java.lang.Class clazz)
cache to be used for caching by shortLabel. shortLabel is not a primary key, therefore the caching by OJB does not work.


clearCache

public void clearCache()
Wipe the whole cache.


removeFromCache

public void removeFromCache(java.lang.Object obj)
Removes given object from the cache.

Parameters:
obj - the object to clear from the OJB cache.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Method required for writing to disk via Serializable. Needed because basic serialization does not work due to the use of the Log4J logger.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The object output stream.
Throws:
java.io.IOException - thrown if there were problems writing to disk.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Used for serialization via Externalizable. Needed because basic serialization does not work with the Log4J logger.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The object input stream.
Throws:
java.io.IOException - Thrwon if there were problems reading from disk.
java.lang.ClassNotFoundException - thrown if the class definition needed to create an instance is not available.

getLogger

public org.apache.log4j.Logger getLogger()

isUserVerified

public boolean isUserVerified(java.lang.String user,
                              java.lang.String password)
validates a user's credentials against the data store.

Parameters:
user - the username
password - the user password (may be null)
Returns:
boolean true if valid details, false if not (including a null username).

closeStore

public void closeStore()
                throws IntactException
close the data source. NOTE: performing this operation will invalidate any outstanding transactions, and a call to open() must be made before further store access can be made. Do not use this method if you wish to continue data store operations in the same connection! Note that any previous data may be lost, and a subsequent call to open() will result in a new connection being established to the persitent store.

Throws:
IntactException - if the store was unable to be closed.

isInTransaction

public boolean isInTransaction()
Returns:
boolean true if a client-initiated transaction is in progress, false if not or if there is no valid connection to the datastore.

isPersistent

public boolean isPersistent(java.lang.Object obj)
Wrapper for uk.ac.ebi.intact.persistence#DAO(Object)

Parameters:
obj - the object to check for.
Returns:
true if obj is persisted or it has non null primary key value (shouldn't do it).

startTransaction

public void startTransaction(int transactionType)
                      throws IntactException
starts a business level transaction. This allows finer grained transaction management of business operations (eg for performing a number of creates/deletes within one unit of work). You can choose, by specifying the appropriate parameter, which level of transaction you want: either object level or JDBC (ie relational) level. If an unkown type is supplied then the transaction type defaults to JDBC.

Parameters:
transactionType - The type of transaction you want (relational or object). Use either BusinessConstants.OBJECT_TX or BusinessConstants.JDBC_TX.
Throws:
IntactException - thrown usually if a transaction is already running

lock

public void lock(CvObject cvobj)
Locks the given object for write access. startTransaction(int) must be called to prior to this method.

Parameters:
cvobj - the object to lock for write access.

finishTransaction

public void finishTransaction()
                       throws IntactException
ends a busines transaction. This method should be used if it is required to manage business transactionas across multiple operations (eg for performing a number of creates/deletes in one unit of work).

Throws:
IntactException - thrown usually if there is no transaction in progress

undoTransaction

public void undoTransaction()
                     throws IntactException
unwraps a transaction. This method is of use when a "business unit of work" fails for some reason and the operations within it should not affect the persistent store.

Throws:
IntactException - thrown usually if a transaction is not in progress

getDbName

public java.lang.String getDbName()
                           throws org.apache.ojb.broker.accesslayer.LookupException,
                                  java.sql.SQLException
Provides the database name that is being connected to.

Returns:
String the database name, or an empty String if the query fails
Throws:
org.apache.ojb.broker.accesslayer.LookupException - thrown on error getting the Connection
java.sql.SQLException - thrown if the metatdata can't be obtained

getDbUserName

public java.lang.String getDbUserName()
                               throws org.apache.ojb.broker.accesslayer.LookupException,
                                      java.sql.SQLException
Provides the user name that is connecting to the DB.

Returns:
String the user name, or an empty String if the query fails
Throws:
org.apache.ojb.broker.accesslayer.LookupException - thrown on error getting the Connection
java.sql.SQLException - thrown if the metatdata can't be obtained

create

public void create(java.util.Collection objects)
            throws IntactException
This method provides a create operation for intact objects.

Parameters:
objects - - a collection of intact objects to be created
Throws:
IntactException - - thrown if a problem arises during the creation process

delete

public void delete(java.lang.Object obj)
            throws IntactException
This method provides a delete operation.

Parameters:
obj - -obj to be deleted
Throws:
IntactException - - thrown if a problem arises during the deletion

create

public void create(java.lang.Object obj)
            throws IntactException
Convenience method to create a single object in persistent store.

Parameters:
obj - The object to be created
Throws:
IntactException - thrown if the creation failed

update

public void update(java.lang.Object obj)
            throws IntactException
This method provides an update operation.

Parameters:
obj - -obj to be updated
Throws:
IntactException - - thrown if a problem arises during the update

cancelUpdate

public void cancelUpdate(java.lang.Object obj)
Cancels the update for the given object.

Parameters:
obj - the object to cancel the update for.

paramSearch

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

Specified by:
paramSearch in interface SearchI
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
includeSubClass - - if true, known subclasses of objectType will be searched, too.
matchSubString - - if true, substring matches of searchValue to object properties will also be hits.
Returns:
Collection - the results of the search (empty Collection if no matches found)
Throws:
IntactException - - thrown if problems are encountered during the search process

stringSearch

public java.util.List stringSearch(java.lang.String objectType,
                                   java.lang.String searchString,
                                   boolean includeSubClass,
                                   boolean matchSubString)
                            throws IntactException
Not Yet Fully Implemented.

Specified by:
stringSearch in interface SearchI
Parameters:
objectType - - the object type to be searched
searchString - - the String to search for
includeSubClass - - if true, known subclasses of objectType will be searched, too.
matchSubString - - if true, substring matches of searchValue to object properties will also be hits.
Returns:
List - the results of the search (empty List if no matches found)
Throws:
IntactException - - thrown if problems are encountered during the search process
See Also:
SearchI

iterSearch

public java.util.Iterator iterSearch(java.lang.String objectType,
                                     java.lang.String searchParam,
                                     java.lang.String searchValue)
                              throws IntactException
Search which provides an Iterator rather than a Collection. This is particularly useful for applications which may need to close result data for DB resource reasons (the iterator from this method can be passed to closeResults). Note that this will NOT close oracle cursors on the oracle server, as it seems the only guranteed way to do that is to 'cose' the connection (preferably via an oracle connection pool supplied with the driver).

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:
Iterator - a "DB aware" Iterator over the results - null if no match found
Throws:
IntactException - - thrown if problems are encountered during the search process

getColumnData

public java.util.Iterator getColumnData(java.lang.String type,
                                        java.lang.String[] cols)
                                 throws IntactException
Allows access to column data rather than whole objects. This is more of a convenience method if you want to get at some data without retrieving complete objects.

Parameters:
type - The name of the object you want data from (fully qualified java name) - must be specified
cols - The columns (NOT attribute names) that you are interested in - null returns all
Returns:
Iterator an Iterator over all column values, returned as Objects (null if nothing found), NB if you do not exhaust this Iterator you should make sure datastore resources are cleaned up by passing it to the closeData method.
Throws:
IntactException

searchBySQL

public java.util.Collection searchBySQL(java.lang.String type,
                                        java.lang.String sqlString)
                                 throws IntactException
Allows search by raw SQL String. This should only be used if you are confident with SQL syntaxt and you know what you are doing - no gurantees are made on the results (garbage in, garbage out).

Parameters:
type - The object you are interested in - must be specified
sqlString - The SQL string you wish to search with
Returns:
Collection The search results, empty if none found
Throws:
IntactException

closeData

public void closeData(java.util.Iterator items)
Closes result data.

Parameters:
items - The Iterator used to retrieve the data originally.
Throws:
java.lang.IllegalArgumentException - thrown if the Iterator is an invalid type

search

public java.util.Collection search(java.lang.String objectType,
                                   java.lang.String searchParam,
                                   java.lang.String searchValue)
                            throws IntactException
This method provides a means of searching intact objects, within the constraints provided by the parameters to the method. NB this will probably become private, and replaced for public access by paramSearch...

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:
Collection - the results of the search (empty Collection if no matches found)
Throws:
IntactException - - thrown if problems are encountered during the search process

search

public java.util.Collection search(java.lang.Object obj)
                            throws IntactException
Deprecated. This should not be used with the new model, as applications should not use no-arg constructors.

Enables searching by example. This means it is possible to search for matches to a "partial" object where a subset of its fields are complete. Note that unless the field(s) completed in the example are unique, it is possible that there may be more than one match.

NOTES ON USAGE:

Parameters:
obj - - the partial object to search on
Returns:
Collection - the results of the search (empty Collection if no matches found)
Throws:
IntactException - - thrown if problems are encountered during the search process

getRelations

public java.util.Collection getRelations(BasicObject base)
                                  throws IntactException
This method obtains the nearest neighbours (ie the next level of related objects) to a given intact object. Usage of this method will primarily be within a lazy loading environment, since its function is to provide a level of optimisation in that respect.

Parameters:
base - - the object whose relations we are interested in (as an intact Base object)
Returns:
Collection - a collection of the nearest neighbours to the given object
IntactException

getObjectsByXref

public java.util.Collection getObjectsByXref(java.lang.Class clazz,
                                             java.lang.String aPrimaryId)
                                      throws IntactException
Searches for objects by classname and Xref. Currently this searches only by primaryId. Should search by database and primaryId.

IntactException

getSpliceProteinsByXref

public java.util.Collection getSpliceProteinsByXref(java.lang.String primaryId)
                                             throws IntactException
Searches for splice objects by primaryId.

Parameters:
primaryId - Primary Id to search for proteins.
Returns:
a collection of splice proteins for primaryId or an empty collection if none are found.
Throws:
IntactException - if there is more than single protein returned from the search or an error ocurred in searching. This method is a temporary method added to get the splice proteins. This will be removed shortly once the necessary changes are performed to get all the splice proteins. Only the editor uses this method

getObjectByXref

public java.lang.Object getObjectByXref(java.lang.Class clazz,
                                        java.lang.String aPrimaryId)
                                 throws IntactException
Searches for a unique Object by classname and Xref. Currently this searches only by primaryId. Should search by database and primaryId.

IntactException

getObjectsByAlias

public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
                                              java.lang.String aliasName)
                                       throws IntactException
Search for objects by any alias with the specified name.

Parameters:
clazz - the class filter. All objects in the returned collection will be instance of that class.
aliasName - the name of the alias to look for.
Returns:
the collection of objects of type clazz who have an alias named aliasName
Throws:
IntactException - when an error occurs when searching.
java.lang.IllegalArgumentException - if the name of the Alias is not specified or empty.
See Also:
Alias

getObjectsByAlias

public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
                                              java.lang.String aliasName,
                                              java.lang.String aliasTypeShortLabel)
                                       throws IntactException
Search for objects by any alias with the specified name.

Parameters:
clazz - the class filter. All objects in the returned collection will be instance of that class.
aliasName - the name of the alias to look for.
aliasTypeShortLabel - the shortLabel of the alias type we are interrested in.
Returns:
the collection of objects of type clazz who have an alias named aliasName
Throws:
IntactException - When the requested aliasType is not found or an error occurs when searching.
java.lang.IllegalArgumentException - if the name of the Alias is not specified or empty.
See Also:
Alias

getObjectsByAlias

public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
                                              java.lang.String aliasName,
                                              CvAliasType cvAliasType)
                                       throws IntactException
Search for objects by any alias with the specified name.

Parameters:
clazz - the class filter. All objects in the returned collection will be instance of that class.
aliasName - the name of the alias to look for.
cvAliasType - the type of the alias we are interrested in.
Returns:
the collection of objects of type clazz who have an alias named aliasName
Throws:
IntactException - When the requested aliasType is not found or an error occurs when searching.
java.lang.IllegalArgumentException - if the name of the Alias is not specified or empty.
See Also:
Alias

getObjectByLabel

public java.lang.Object getObjectByLabel(java.lang.Class clazz,
                                         java.lang.String label)
                                  throws IntactException
Return an Object by classname and shortLabel. For efficiency, classes which are subclasses of CvObject are cached if the label is unique.

IntactException

getObjectByAc

public java.lang.Object getObjectByAc(java.lang.Class clazz,
                                      java.lang.String ac)
                               throws IntactException
Return an Object by classname and ac.

IntactException

getObjectByName

public java.lang.Object getObjectByName(java.lang.Class clazz,
                                        java.lang.String name)
                                 throws IntactException
This method retrieves an intact object, given a class and the object's full name (provided that name is unique).

Parameters:
clazz - the class to search on
name - the name of the object required
Returns:
Object the result of the search, or null if not found
Throws:
IntactException - thrown if a search problem occurs

getBioSourceByName

public BioSource getBioSourceByName(java.lang.String name)
                             throws IntactException
This method is used for searching by scientific name (provided that name is unique). The BioSource object is the only intact object with this attribute.

Parameters:
name - the name of the BioSource required
Returns:
BioSource the result of the search, or null if not found
Throws:
IntactException - thrown if a search problem occurs, or more than one BioSource found NB Not tested yet - requires BioSource data in DB

getBioSourceByTaxId

public BioSource getBioSourceByTaxId(java.lang.String taxId)
                              throws IntactException
Searches for a BioSource given a tax ID. The taxt ID must be unique and therefore if a match is found only a single BioSource should be returned.

Parameters:
taxId - The tax ID to search on - should be unique
Returns:
BioSource The matching BioSource object, or null if none found
Throws:
IntactException - thronw if there was a search problem, or if more than one BioSource was found

getInteractorBySource

public java.util.Collection getInteractorBySource(java.lang.Class clazz,
                                                  BioSource source)
                                           throws IntactException
This method is used for obtaining an interactor given a specific BioSource and the subclass of Interactor that is to be searched for. NB is it true that a match would be unique??

Parameters:
clazz - the subclass of Interactor to search on
source - the BioSource to search with - must be fully defined or at least AC set
Returns:
Collection the list of Interactors that have the given BioSource, or empty if none found
Throws:
IntactException - thrown if a search problem occurs
java.lang.NullPointerException - if source or class is null
java.lang.IllegalArgumentException - if the class parameter is not assignable from Interactor NB Not tested yet - BioSource data in DB required

getExperimentBySource

public Experiment getExperimentBySource(BioSource source)
                                 throws IntactException
Search for an experiment given a specific BioSource. NB is it true that a match would be unique?? Object model suggests a 1-1 match...

Parameters:
source - the BioSource to search with - must be fully defined or at least AC set
Returns:
Experiment the result of the search, or empty if none found
Throws:
IntactException - thrown if a search problem occurs NB not tested yet!! (requires data in the DB)

getComponentsByRole

public java.util.Collection getComponentsByRole(CvComponentRole role)
                                         throws IntactException
Search for components given a role. Assumed this is unlikely to be unique.

Parameters:
role - the role to search with - must be fully defined or at least AC set
Returns:
Collection the result of the search, or an empty Collection if not found
Throws:
IntactException - thrown if a search problem occurs NB Not tested yet!!

getInteractionsByType

public java.util.Collection getInteractionsByType(CvInteractionType type)
                                           throws IntactException
Search for interactions given a type. Assumed this is unlikely to be unique.

Parameters:
type - the type to search with - must be fully defined or at least AC set
Returns:
Collection the result of the search, or an empty Collection if not found
Throws:
IntactException - thrown if a search problem occurs NB Not tested yet!!

getExperimentsByInstitution

public java.util.Collection getExperimentsByInstitution(Institution institution)
                                                 throws IntactException
Search for Experiments given an Institution. Assumed this is unlikely to be unique. Note: If the Institution AC is not set, a search will first be carried out for it using its shortLabel - thus only Institutions that are persistent will provide a non-empty search result. If more than one Institution is returned, the first one's AC will be used.

Parameters:
institution - the institution to search with
Returns:
Collection the result of the search, or an empty Collection if not found
Throws:
IntactException - thrown if a search problem occurs

getProteinByXref

public Protein getProteinByXref(Xref xref)
                         throws IntactException
Search for Protein given a cross reference. Assumed this is unique.

Parameters:
xref - the cross reference to search with - must be fully defined, or at least have its parent AC field set
Returns:
Protein the result of the search, or null if not found
Throws:
IntactException - thrown if a search problem occurs, the Xref does not match a Protein, or we get more than one Protein back NB not yet tested....

deleteAllElements

public void deleteAllElements(java.util.Collection aCollection)
                       throws IntactException
Delete all elements in a collection.

IntactException

subGraph

public Graph subGraph(Interactor startNode,
                      int graphDepth,
                      java.util.Collection experiments,
                      int complexExpansion,
                      Graph graph)
               throws IntactException
Returns a subgraph centered on startNode. The subgraph will contain all nodes which are up to graphDepth interactions away from startNode. Only Interactions which belong to one of the Experiments in experiments will be taken into account. If experiments is empty, all Interactions are taken into account. Graph depth: This parameter limits the size of the returned interaction graph. All baits are shown with all the interacting preys, even if they would normally be on the "rim" of the graph. Therefore the actual diameter of the graph may be 2*(graphDepth+1). Expansion: If an Interaction has more than two interactors, it has to be defined how pairwise interactions are generated from the complex data. The possible values are defined in the beginning of this file.

Specified by:
subGraph in interface SearchI
Parameters:
startNode - - the start node of the subgraph.
graphDepth - - depth of the graph
experiments - - Experiments which should be taken into account
complexExpansion - - Mode of expansion of complexes into pairwise interactions
graph - - the graph we have to fill with interaction data
Returns:
a GraphI object.
Throws:
IntactException - - thrown if problems are encountered

getRelatedExperiments

public java.util.Collection getRelatedExperiments(java.lang.Object item)
Used to obtain the Experiments related to a search object. For example, if the object is a Protein then we are interested in the Interactions and also the Experiments that the Protein is related to. In practice this therefore means that we only need the Experiments, since the Interactions can be obtained from those.

Parameters:
item - A search result item (though anything can be tried!)
Returns:
Collection The Experiments related to the parameter item (empty if none found)

getJDBCConnection

public java.sql.Connection getJDBCConnection()
                                      throws IntactException
Gets the underlying JDBC connection. This is a 'useful method' rather than a good practice one as it returns the underlying DB connection (and assumes there is one). No guarantees - if you screw up the Connection you are in trouble!.

Returns:
Connection a JDBC Connection, or null if the DAO you are using is not an OJB one.
Throws:
IntactException - thrown if there was a problem getting the connection

getInstitution

public Institution getInstitution()
                           throws IntactException
Allow the user not to know about the it's Institution, it has to be configured once in the properties file: ${INTACTCORE_HOME}/config/Institution.properties and then when calling that method, the Institution is either retreived or created according to its shortlabel.

Returns:
the Institution to which all created object will be linked.
IntactException

getRealIntactObject

public static IntactObject getRealIntactObject(IntactObject obj)
Returns the real object wrapped around the proxy for given object of IntactObjectProxy type.

Parameters:
obj - the object to return the real object from.
Returns:
the real object wrapped around the proxy for given object of IntactObjectProxy type; otherwise, obj is returned.

getRealClassName

public static java.lang.Class getRealClassName(java.lang.Object obj)
Gives the Object classname, give the real object class name if this is a VirtualProxy class

Parameters:
obj - the object for which we request the real class name.
Returns:
the real class name.
See Also:
VirtualProxy

getDisplayableClassName

public static java.lang.String getDisplayableClassName(java.lang.Object obj)
From the real className of an object, gets a displayable name.

Parameters:
obj - the object for which we want the class name to display - the object must not be null
Returns:
the classname to display in the view.

getDisplayableClassName

public static java.lang.String getDisplayableClassName(java.lang.Class clazz)
From the real className of className, gets a displayable name.

Parameters:
clazz - the class for which we want the class name to display - the class must not be null
Returns:
the classname to display in the view.

getDisplayableClassName

public static java.lang.String getDisplayableClassName(java.lang.String name)
From the real className of className, gets a displayable name.
1. get the real class name. 2. Removes the package name 3. try to remove an eventual Impl suffix

Parameters:
name - the class name for which we want the class name to display - the class must not be null
Returns:
the classname to display in the view.


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