|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uk.ac.ebi.intact.business.IntactHelper
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.
| 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 |
public IntactHelper(DAOSource source)
throws IntactException
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.
IntactException - - thrown if either the type map or source are invalid
public IntactHelper()
throws IntactException
IntactException - - thrown if either the type map or source are invalid
public IntactHelper(DAOSource source,
java.lang.String user,
java.lang.String password)
throws IntactException
source - - the data source to be connected touser - - the username to make a connection withpassword - - the user's password (null values allowed)
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:
PropertyDescriptor objects
source - the data source to be usedclassInfo - the Map containing reflection information for classes
IntactException - thrown if no data source is supplied| Method Detail |
public void addCachedClass(java.lang.Class clazz)
public void clearCache()
public void removeFromCache(java.lang.Object obj)
obj - the object to clear from the OJB cache.
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizableout - The object output stream.
java.io.IOException - thrown if there were problems writing to disk.
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablein - The object input stream.
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.public org.apache.log4j.Logger getLogger()
public boolean isUserVerified(java.lang.String user,
java.lang.String password)
user - the usernamepassword - the user password (may be null)
public void closeStore()
throws IntactException
IntactException - if the store was unable to be closed.public boolean isInTransaction()
public boolean isPersistent(java.lang.Object obj)
obj - the object to check for.
true if obj is persisted or it has non
null primary key value (shouldn't do it).
public void startTransaction(int transactionType)
throws IntactException
transactionType - The type of transaction you want (relational or object).
Use either BusinessConstants.OBJECT_TX or BusinessConstants.JDBC_TX.
IntactException - thrown usually if a transaction is already runningpublic void lock(CvObject cvobj)
startTransaction(int) must be called to prior to this method.
cvobj - the object to lock for write access.
public void finishTransaction()
throws IntactException
IntactException - thrown usually if there is no transaction in progress
public void undoTransaction()
throws IntactException
IntactException - thrown usually if a transaction is not in progress
public java.lang.String getDbName()
throws org.apache.ojb.broker.accesslayer.LookupException,
java.sql.SQLException
org.apache.ojb.broker.accesslayer.LookupException - thrown on error
getting the Connection
java.sql.SQLException - thrown if the metatdata can't be obtained
public java.lang.String getDbUserName()
throws org.apache.ojb.broker.accesslayer.LookupException,
java.sql.SQLException
org.apache.ojb.broker.accesslayer.LookupException - thrown on error
getting the Connection
java.sql.SQLException - thrown if the metatdata can't be obtained
public void create(java.util.Collection objects)
throws IntactException
objects - - a collection of intact objects to be created
IntactException - - thrown if a problem arises during the creation process
public void delete(java.lang.Object obj)
throws IntactException
obj - -obj to be deleted
IntactException - - thrown if a problem arises during the deletion
public void create(java.lang.Object obj)
throws IntactException
obj - The object to be created
IntactException - thrown if the creation failed
public void update(java.lang.Object obj)
throws IntactException
obj - -obj to be updated
IntactException - - thrown if a problem arises during the updatepublic void cancelUpdate(java.lang.Object obj)
obj - the object to cancel the update for.
public java.util.Collection paramSearch(java.lang.String objectType,
java.lang.String searchParam,
java.lang.String searchValue,
boolean includeSubClass,
boolean matchSubString)
throws IntactException
SearchI
paramSearch in interface SearchIobjectType - - the object type to be searchedsearchParam - - the parameter to search on (eg field)searchValue - - the search value to match with the parameterincludeSubClass - - if true, known subclasses of objectType will be searched, too.matchSubString - - if true, substring matches of searchValue to object properties will also be hits.
IntactException - - thrown if problems are encountered during the search process
public java.util.List stringSearch(java.lang.String objectType,
java.lang.String searchString,
boolean includeSubClass,
boolean matchSubString)
throws IntactException
stringSearch in interface SearchIobjectType - - the object type to be searchedsearchString - - the String to search forincludeSubClass - - if true, known subclasses of objectType will be searched, too.matchSubString - - if true, substring matches of searchValue to object properties will also be hits.
IntactException - - thrown if problems are encountered during the search processSearchI
public java.util.Iterator iterSearch(java.lang.String objectType,
java.lang.String searchParam,
java.lang.String searchValue)
throws IntactException
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).
objectType - - the object type to be searchedsearchParam - - the parameter to search on (eg field)searchValue - - the search value to match with the parameter
IntactException - - thrown if problems are encountered during the search process
public java.util.Iterator getColumnData(java.lang.String type,
java.lang.String[] cols)
throws IntactException
type - The name of the object you want data from (fully qualified java name) - must be specifiedcols - The columns (NOT attribute names) that you are interested in - null returns all
closeData method.
IntactException
public java.util.Collection searchBySQL(java.lang.String type,
java.lang.String sqlString)
throws IntactException
type - The object you are interested in - must be specifiedsqlString - The SQL string you wish to search with
IntactExceptionpublic void closeData(java.util.Iterator items)
items - The Iterator used to retrieve the data originally.
java.lang.IllegalArgumentException - thrown if the Iterator is an invalid type
public java.util.Collection search(java.lang.String objectType,
java.lang.String searchParam,
java.lang.String searchValue)
throws IntactException
objectType - - the object type to be searchedsearchParam - - the parameter to search on (eg field)searchValue - - the search value to match with the parameter
IntactException - - thrown if problems are encountered during the search process
public java.util.Collection search(java.lang.Object obj)
throws IntactException
NOTES ON USAGE:
obj - - the partial object to search on
IntactException - - thrown if problems are encountered during the search process
public java.util.Collection getRelations(BasicObject base)
throws IntactException
base - - the object whose relations we are interested in (as an intact Base object)
IntactException
public java.util.Collection getObjectsByXref(java.lang.Class clazz,
java.lang.String aPrimaryId)
throws IntactException
IntactException
public java.util.Collection getSpliceProteinsByXref(java.lang.String primaryId)
throws IntactException
primaryId - Primary Id to search for proteins.
primaryId or an
empty collection if none are found.
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
public java.lang.Object getObjectByXref(java.lang.Class clazz,
java.lang.String aPrimaryId)
throws IntactException
IntactException
public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
java.lang.String aliasName)
throws IntactException
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.
clazz who have an alias
named aliasName
IntactException - when an error occurs when searching.
java.lang.IllegalArgumentException - if the name of the Alias is not specified or empty.Alias
public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
java.lang.String aliasName,
java.lang.String aliasTypeShortLabel)
throws IntactException
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.
clazz who have an alias
named aliasName
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.Alias
public java.util.Collection getObjectsByAlias(java.lang.Class clazz,
java.lang.String aliasName,
CvAliasType cvAliasType)
throws IntactException
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.
clazz who have an alias
named aliasName
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.Alias
public java.lang.Object getObjectByLabel(java.lang.Class clazz,
java.lang.String label)
throws IntactException
IntactException
public java.lang.Object getObjectByAc(java.lang.Class clazz,
java.lang.String ac)
throws IntactException
IntactException
public java.lang.Object getObjectByName(java.lang.Class clazz,
java.lang.String name)
throws IntactException
clazz - the class to search onname - the name of the object required
IntactException - thrown if a search problem occurs
public BioSource getBioSourceByName(java.lang.String name)
throws IntactException
name - the name of the BioSource required
IntactException - thrown if a search problem occurs, or more than
one BioSource found
NB Not tested yet - requires BioSource data in DB
public BioSource getBioSourceByTaxId(java.lang.String taxId)
throws IntactException
taxId - The tax ID to search on - should be unique
IntactException - thronw if there was a search problem, or if more
than one BioSource was found
public java.util.Collection getInteractorBySource(java.lang.Class clazz,
BioSource source)
throws IntactException
clazz - the subclass of Interactor to search onsource - the BioSource to search with - must be fully defined or at least AC set
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
public Experiment getExperimentBySource(BioSource source)
throws IntactException
source - the BioSource to search with - must be fully defined or at least AC set
IntactException - thrown if a search problem occurs
NB not tested yet!! (requires data in the DB)
public java.util.Collection getComponentsByRole(CvComponentRole role)
throws IntactException
role - the role to search with - must be fully defined or at least AC set
IntactException - thrown if a search problem occurs
NB Not tested yet!!
public java.util.Collection getInteractionsByType(CvInteractionType type)
throws IntactException
type - the type to search with - must be fully defined or at least AC set
IntactException - thrown if a search problem occurs
NB Not tested yet!!
public java.util.Collection getExperimentsByInstitution(Institution institution)
throws IntactException
institution - the institution to search with
IntactException - thrown if a search problem occurs
public Protein getProteinByXref(Xref xref)
throws IntactException
xref - the cross reference to search with - must be fully defined, or
at least have its parent AC field set
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....
public void deleteAllElements(java.util.Collection aCollection)
throws IntactException
IntactException
public Graph subGraph(Interactor startNode,
int graphDepth,
java.util.Collection experiments,
int complexExpansion,
Graph graph)
throws IntactException
subGraph in interface SearchIstartNode - - the start node of the subgraph.graphDepth - - depth of the graphexperiments - - Experiments which should be taken into accountcomplexExpansion - - Mode of expansion of complexes into pairwise interactionsgraph - - the graph we have to fill with interaction data
IntactException - - thrown if problems are encounteredpublic java.util.Collection getRelatedExperiments(java.lang.Object item)
item - A search result item (though anything can be tried!)
public java.sql.Connection getJDBCConnection()
throws IntactException
IntactException - thrown if there was a problem getting the connection
public Institution getInstitution()
throws IntactException
IntactExceptionpublic static IntactObject getRealIntactObject(IntactObject obj)
obj - the object to return the real object from.
obj is returned.public static java.lang.Class getRealClassName(java.lang.Object obj)
obj - the object for which we request the real class name.
VirtualProxypublic static java.lang.String getDisplayableClassName(java.lang.Object obj)
obj - the object for which we want the class name to display - the object must not be null
public static java.lang.String getDisplayableClassName(java.lang.Class clazz)
clazz - the class for which we want the class name to display - the class must not be null
public static java.lang.String getDisplayableClassName(java.lang.String name)
name - the class name for which we want the class name to display - the class must not be null
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||