uk.ac.ebi.intenz.mapper
Class EnzymeEntryMapper

java.lang.Object
  extended by uk.ac.ebi.intenz.mapper.EnzymeEntryMapper

public class EnzymeEntryMapper
extends Object

Maps enzyme entry information to the corresponding database tables.
IMPORTANT: after using instances of this class, call the close() method, otherwise the underlying Rhea mapper objects will keep their statements open.

Version:
$Revision: 1.5 $ $Date: 2009/05/26 14:59:09 $
Author:
Michael Darsow

Constructor Summary
EnzymeEntryMapper()
           
EnzymeEntryMapper(EnzymeReactionMapper enzymeReactionMapper)
           
 
Method Summary
 boolean cloneExists(Long id, Connection con)
          Checks if a clone of an enzyme already exists.
 void close()
           
static boolean ecExists(EnzymeCommissionNumber ec, Connection con)
          Checks whether a given EC number already exists in the database.
 List<EnzymeEntry> exportAllEntries(Connection con)
          Exports every piece of data for publicly available entries.
 List<EnzymeEntry> exportApprovedSibEntries(Connection con)
          Tries to export all approved entries containing only ENZYME relevant information.
protected  void finalize()
           
 List<EnzymeEntry> findAll(Connection con)
          Tries to find all public entries but loads the entries only with minimum information.
 List<EnzymeEntry> findAllByEc(int ec1, int ec2, int ec3, int ec4, Boolean preliminary, Connection con)
           
 List<EnzymeEntry> findAllByEc(int ec1, int ec2, int ec3, int ec4, Connection con)
          Tries to find entry information about all enzymes specified by the given EC.
 List<EnzymeEntry> findAllSubSubclassEntriesByEc(int ec1, int ec2, int ec3, Connection con)
           
 EnzymeEntry findByEc(int ec1, int ec2, int ec3, int ec4, Status status, Connection con)
          Tries to find entry information about an enzyme.
 EnzymeEntry findByEc(String ecString, Status status, Connection con)
          Finds an enzyme by EC number (as String) and status.
 EnzymeEntry findById(long id, Connection con)
          Loads a complete version of the enzyme with the given ID.
 EnzymeEntry findById(Long id, Connection con, boolean ghost)
          Tries to find entry information about an enzyme.
 List<EnzymeEntry> findByStatus(Connection con, Status status)
          Retrieves the list of enzymes with a given status.
 EnzymeCommissionNumber findEC(String id, Connection con)
          Returns the EC number of the given enzyme ID.
 List<EnzymeEntry> findFullProposedList(Connection con)
          Tries to find all proposed entries with all information.
 List<EnzymeEntry> findFullSuggestedList(Connection con)
          Tries to find all suggested entries with all information.
 EnzymeEntry findGhostById(int id, Connection con)
          Loads a ghost version of the enzyme with the given ID.
 String findHistoryLine(Long id, Connection con)
          Returns the history line of the enzyme with the given ID.
 Long findIDInMappingTable(String ec, Status status, Connection con)
           
 List<EnzymeEntry> findList(String ec1, String ec2, String ec3, Connection con)
          Tries to find all entries requested but loads the entries only with minimum information.
 Long findNextEnzymeId(Connection con)
          Returns the next available enzyme ID.
 String findNote(Long id, Connection con)
          Returns the note of the enzyme with the given ID.
 List<EnzymeEntry> findPreliminaryEcsList(Connection con)
          Gets the list of preliminary EC numbers issued by UniProt.
 List<EnzymeEntry> findProposedList(Connection con)
          Tries to find all proposed entries but loads the entries only with minimum information.
 EnzymeStatistics findStats(Connection con)
           
 List<EnzymeEntry> findSuggestedList(Connection con)
          Tries to find all suggested entries but loads the entries only with minimum information.
 void insert(Long enzymeId, EnzymeCommissionNumber ec, Status status, EnzymeSourceConstant source, String note, String historyLine, boolean isActive, Connection con)
          Inserts the core data of a new enzyme entry.
 void update(Long enzymeId, EnzymeCommissionNumber ec, Status status, EnzymeSourceConstant source, String note, String historyLine, boolean active, Connection con)
          Updates the core data of an enzyme stored in the table ENZYMES.
 void updateEc(Long enzymeId, EnzymeCommissionNumber newEc, Connection con)
          Updates the EC of the given enzyme.
 void updateHistoryLine(Long enzymeId, String historyLine, Connection con)
          Updates the history line of the given enzyme.
 void updateNote(Long enzymeId, String note, Connection con)
          Updates the notes of the given enzyme.
 void updateStatus(Long enzymeId, Status status, Connection con)
          Updates the status of the given enzyme.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnzymeEntryMapper

public EnzymeEntryMapper()

EnzymeEntryMapper

public EnzymeEntryMapper(EnzymeReactionMapper enzymeReactionMapper)
Method Detail

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

close

public void close()

findByEc

public EnzymeEntry findByEc(int ec1,
                            int ec2,
                            int ec3,
                            int ec4,
                            Status status,
                            Connection con)
                     throws SQLException,
                            DomainException,
                            uk.ac.ebi.rhea.mapper.MapperException
Tries to find entry information about an enzyme.

Parameters:
ec1 - Number of class to search for.
ec2 - Number of subclass to search for.
ec3 - Number of sub-subclass to search for.
ec4 - Number of entry to search for.
status - the status of the searched enzyme. If null, it defaults to Status.APPROVED.
con - The logical connection.
Returns:
an EnzymeEntry instance or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

findByEc

public EnzymeEntry findByEc(String ecString,
                            Status status,
                            Connection con)
                     throws NumberFormatException,
                            SQLException,
                            DomainException,
                            uk.ac.ebi.rhea.mapper.MapperException
Finds an enzyme by EC number (as String) and status.

Parameters:
ecString - the EC number.
status - the enzyme status.
con - a database connection.
Returns:
an enzyme entry, or null if not found.
Throws:
NumberFormatException
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException

findAllByEc

public List<EnzymeEntry> findAllByEc(int ec1,
                                     int ec2,
                                     int ec3,
                                     int ec4,
                                     Boolean preliminary,
                                     Connection con)
                              throws SQLException,
                                     DomainException
Throws:
SQLException
DomainException

findAllByEc

public List<EnzymeEntry> findAllByEc(int ec1,
                                     int ec2,
                                     int ec3,
                                     int ec4,
                                     Connection con)
                              throws SQLException,
                                     DomainException
Tries to find entry information about all enzymes specified by the given EC.

Parameters:
ec1 - Number of class to search for.
ec2 - Number of subclass to search for.
ec3 - Number of sub-subclass to search for.
ec4 - Number of entry to search for.
con - The logical connection.
Returns:
an EnzymeEntry instance or null if nothing has been found.
Throws:
NullPointerException - if parameter con is null.
SQLException - if a database error occurs.
DomainException - if any error related to domain information occurs.

findAllSubSubclassEntriesByEc

public List<EnzymeEntry> findAllSubSubclassEntriesByEc(int ec1,
                                                       int ec2,
                                                       int ec3,
                                                       Connection con)
                                                throws SQLException,
                                                       DomainException
Throws:
SQLException
DomainException

findById

public EnzymeEntry findById(Long id,
                            Connection con,
                            boolean ghost)
                     throws SQLException,
                            DomainException,
                            uk.ac.ebi.rhea.mapper.MapperException
Tries to find entry information about an enzyme.

Parameters:
id - The enzyme ID.
con - The logical connection.
ghost - return a ghost (minimal info)?
Returns:
an EnzymeEntry instance or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info for non-ghosts.

findById

public EnzymeEntry findById(long id,
                            Connection con)
                     throws SQLException,
                            DomainException,
                            uk.ac.ebi.rhea.mapper.MapperException
Loads a complete version of the enzyme with the given ID.

Parameters:
id -
con -
Returns:
an EnzymeEntry instance or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

findGhostById

public EnzymeEntry findGhostById(int id,
                                 Connection con)
                          throws SQLException,
                                 DomainException
Loads a ghost version of the enzyme with the given ID.

Parameters:
id - The enzyme ID.
con - The logical connection.
Returns:
an EnzymeEntry instance or null if nothing has been found.
Throws:
SQLException
DomainException

findIDInMappingTable

public Long findIDInMappingTable(String ec,
                                 Status status,
                                 Connection con)
                          throws SQLException
Throws:
SQLException

findAll

public List<EnzymeEntry> findAll(Connection con)
                          throws SQLException,
                                 DomainException
Tries to find all public entries but loads the entries only with minimum information.

Parameters:
con - The logical connection.
Returns:
a List of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException

findList

public List<EnzymeEntry> findList(String ec1,
                                  String ec2,
                                  String ec3,
                                  Connection con)
                           throws SQLException,
                                  DomainException
Tries to find all entries requested but loads the entries only with minimum information.

Parameters:
ec1 - Number of class to search for.
ec2 - Number of subclass to search for.
ec3 - Number of sub-subclass to search for.
con - The logical connection.
Returns:
a List of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException

findByStatus

public List<EnzymeEntry> findByStatus(Connection con,
                                      Status status)
                               throws SQLException,
                                      DomainException
Retrieves the list of enzymes with a given status.

Parameters:
con -
status -
Returns:
the list of enzymes with the given status.
Throws:
SQLException
DomainException

findProposedList

public List<EnzymeEntry> findProposedList(Connection con)
                                   throws SQLException,
                                          DomainException
Tries to find all proposed entries but loads the entries only with minimum information.

Parameters:
con - The logical connection.
Returns:
a List of EnzymeEntry instances.
Throws:
SQLException - if a database error occurs.
DomainException - if a domain related error occurs.

findSuggestedList

public List<EnzymeEntry> findSuggestedList(Connection con)
                                    throws SQLException,
                                           DomainException
Tries to find all suggested entries but loads the entries only with minimum information.

Parameters:
con - The logical connection.
Returns:
a Vector of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException

findPreliminaryEcsList

public List<EnzymeEntry> findPreliminaryEcsList(Connection con)
                                         throws SQLException,
                                                DomainException
Gets the list of preliminary EC numbers issued by UniProt.

Parameters:
con -
Returns:
A list of preliminary EC numbers issued by UniProt.
Throws:
SQLException
DomainException

exportAllEntries

public List<EnzymeEntry> exportAllEntries(Connection con)
                                   throws SQLException,
                                          DomainException,
                                          uk.ac.ebi.rhea.mapper.MapperException
Exports every piece of data for publicly available entries.

Parameters:
con -
Returns:
A List of EnzymeEntrys
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

exportApprovedSibEntries

public List<EnzymeEntry> exportApprovedSibEntries(Connection con)
                                           throws SQLException,
                                                  DomainException,
                                                  uk.ac.ebi.rhea.mapper.MapperException
Tries to export all approved entries containing only ENZYME relevant information.

Affected table rows will be locked.

Parameters:
con - The logical connection.
Returns:
an ArrayList of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

findFullProposedList

public List<EnzymeEntry> findFullProposedList(Connection con)
                                       throws SQLException,
                                              DomainException,
                                              uk.ac.ebi.rhea.mapper.MapperException
Tries to find all proposed entries with all information.

This feature is just needed to export a list of all proposed entries.

Parameters:
con - The logical connection.
Returns:
a Vector of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

findFullSuggestedList

public List<EnzymeEntry> findFullSuggestedList(Connection con)
                                        throws SQLException,
                                               DomainException,
                                               uk.ac.ebi.rhea.mapper.MapperException
Tries to find all suggested entries with all information.

This feature is just needed to export a list of all suggested entries.

Parameters:
con - The logical connection.
Returns:
a Vector of EnzymeEntry instances or null if nothing has been found.
Throws:
SQLException
DomainException
uk.ac.ebi.rhea.mapper.MapperException - in case of problem retrieving reaction/cofactor info.

findEC

public EnzymeCommissionNumber findEC(String id,
                                     Connection con)
                              throws SQLException,
                                     DomainException
Returns the EC number of the given enzyme ID.

Parameters:
id - The enzyme ID.
con - The logical connection.
Returns:
The EC, if found, otherwise null.
Throws:
SQLException
DomainException

ecExists

public static boolean ecExists(EnzymeCommissionNumber ec,
                               Connection con)
                        throws SQLException
Checks whether a given EC number already exists in the database.

Parameters:
ec - The EC number to be checked.
con - The database connection.
Returns:
true if the given EC number exists in the database.
Throws:
SQLException - if a database error occurs.
NullPointerException - if any of the parameters is null

findHistoryLine

public String findHistoryLine(Long id,
                              Connection con)
                       throws SQLException
Returns the history line of the enzyme with the given ID.

Parameters:
id - The enzyme ID.
con - The logical connection.
Returns:
The history line, if found, otherwise null.
Throws:
SQLException

findNote

public String findNote(Long id,
                       Connection con)
                throws SQLException
Returns the note of the enzyme with the given ID.

Parameters:
id - The enzyme ID.
con - The logical connection.
Returns:
The note, if found, otherwise null.
Throws:
SQLException

findStats

public EnzymeStatistics findStats(Connection con)
                           throws SQLException
Parameters:
con - The logical connection.
Returns:
Throws:
SQLException

insert

public void insert(Long enzymeId,
                   EnzymeCommissionNumber ec,
                   Status status,
                   EnzymeSourceConstant source,
                   String note,
                   String historyLine,
                   boolean isActive,
                   Connection con)
            throws SQLException
Inserts the core data of a new enzyme entry.

A new enzyme ID must already be available. It can be obtained via findNextEnzymeId(java.sql.Connection)

Parameters:
enzymeId -
ec -
status -
source -
isActive -
note -
historyLine -
con -
Throws:
SQLException

update

public void update(Long enzymeId,
                   EnzymeCommissionNumber ec,
                   Status status,
                   EnzymeSourceConstant source,
                   String note,
                   String historyLine,
                   boolean active,
                   Connection con)
            throws SQLException
Updates the core data of an enzyme stored in the table ENZYMES.

NOTE: The ACTIVE column of this table is cannot be updated using this method since this column is managed by the event package.

Parameters:
enzymeId - The enzyme's ID.
ec - The EC number.
status - The current status of the enzyme.
source - The source of this enzyme.
note - A note the curator might have added.
historyLine - The enzyme's history line.
active - The enzyme's active status.
con - A database connection.
Throws:
SQLException

updateEc

public void updateEc(Long enzymeId,
                     EnzymeCommissionNumber newEc,
                     Connection con)
              throws SQLException
Updates the EC of the given enzyme.

Parameters:
enzymeId - The enzyme's ID.
newEc - The new EC.
con - The logical connection.
Throws:
SQLException

updateNote

public void updateNote(Long enzymeId,
                       String note,
                       Connection con)
                throws SQLException
Updates the notes of the given enzyme.

Parameters:
enzymeId - The enzyme's ID.
note - The note.
con - The logical connection.
Throws:
SQLException

updateStatus

public void updateStatus(Long enzymeId,
                         Status status,
                         Connection con)
                  throws SQLException
Updates the status of the given enzyme.

Parameters:
enzymeId - The enzyme's ID.
status - The status.
con - The logical connection.
Throws:
SQLException

updateHistoryLine

public void updateHistoryLine(Long enzymeId,
                              String historyLine,
                              Connection con)
                       throws SQLException
Updates the history line of the given enzyme.

Parameters:
enzymeId - The enzyme's ID.
historyLine - The new history line.
con - The logical connection.
Throws:
SQLException

cloneExists

public boolean cloneExists(Long id,
                           Connection con)
                    throws SQLException
Checks if a clone of an enzyme already exists.

Parameters:
id - The enzyme ID.
con - The logical connection.
Returns:
true, if a clone already exists.
Throws:
SQLException

findNextEnzymeId

public Long findNextEnzymeId(Connection con)
                      throws SQLException
Returns the next available enzyme ID.

Parameters:
con - The connection.
Returns:
The next enzyme ID.
Throws:
SQLException


Copyright © 2013 EMBL-EBI. All Rights Reserved.