SigPath

Package org.sigpath.task

Database Tasks.

See:
          Description

Interface Summary
ITSearchTask Used to build polyvalent search user interfaces.
Task Specifies a single atomic operation.
 

Class Summary
DBTask Specifies a single atomic database operation.
TAddConcentration Adds a new concentration measurement to the database.
TAddModel Adds a new Model to the database.
TAddPathway Adds a new Pathway to the database.
TCheckDBAlive A simple task class to test if database is alive.
TCheckDeletePermission Gets a group of SigPathEntity objects from the database and checks if the authenticated user has the right of permission to delete.
TGetChemical Gets a Chemical object from the database.
TGetConcentrations Gets concentration measurements.
TGetConcentrationsByReaction Gets all concentrations for all molecules within a single reaction.
TGetDBInfo Gets Database Information.
TGetModel Gets a Model object from the database.
TGetPathway Gets a Model object from the database.
TGetSigPathEntity Gets a SigPathEntity object from the database.
TGetSpidByDbAc This task class gets spid(s) by database:accession code pair(s) from the database.
TGetUsers Gets SigPath Users and related data.
TLinkComponentsToReactions Links component chemicals to reactions.
TOrganismOptimizer Task to eliminate redundancy of Organism objects in database.
TRemoveConcentration Removes a concentration measurement from the database.
TRemoveSigPathEntity Removes SigPathEntities from the database.
TScanEnzReactionsAndReactions scans the instances of classes Reaction and EnzimaticReaction classes existing in the database.
TSearchMolecules Performs a molecule search based on search criteria, including: keyword, category, and organism.
TSearchReactions Performs a reaction search based on multiple search criteria.
TSearchReactionsByKeyword Searches for Reactions by Keyword.
TSearchReactionsByPMID Searches for or Filters a HashSet of Reactions by PubMedID.
TSearchReactionsByUser Searches for Reactions created by a User given a username.
TSearchTask Core Task extended by Reaction search Tasks.
 

Package org.sigpath.task Description

Database Tasks. The goal of the task package is to centralize database tasks in spot. DBTasks represent single atomic database transactions. The root DBTask conveniently centralizes transactions, logging and exception handling in one place. This frees the subclasses to focus on business logic.

Creating New Tasks

To create a new Task, simply extend DBTask, and implement the _execute() method. For example:
public class TDeleteExternalReference extends DBTask {
  private String _spid;
  private String _db;
  private String _ac;

  /**
  * Constructor.
  * @param spid SigPath ID
  * @param db database name
  * @param ac accession code
  */
  public TDeleteExternalReference(String spid, String db, String ac) {
    this._spid = spid;
    this._db = db;
    this._ac = ac;
  }

  /**
  * Executes Task.
  * @throws SigPathDatabaseException Indicates Database Error
  */
  protected void _execute() throws SigPathDatabaseException {
    SigPathEntity spe = (SigPathEntity) entityManager.lookupBySpid(_spid);
    ExternalReferences ers = spe.er();
    boolean removed = ers.removeReference(_db, _ac);
    xdebug.logMsg(this, "Updating SigPath Entity:  " + _spid +
    ", removing external reference -->  db:  " + _db +
    ", ac:  " + _ac);
    xdebug.logMsg(this, "Removal succeeded:  " + removed);
  }
}
The DBTask class takes care of starting and stopping transactions, and lets you focus on the specific task at hand. It also provides easy access to the following database managers: EntityManager, ChemicalManager, UserManager, etc.

Resolving FastObjects Data

If you are retrieving data from the database, you can pass data model objects directly to a Java Server Page. The only trick is that you must resolve all data members that you want to display. For example, the following method with TGetChemical resolves aliases:
  private void resolveAliases (Chemical chemical) {
    Aliases aliases = chemical.aliases ();
      if (aliases != null) {
        aliases.getAsIterator ();
     }
  }
To help you more easily resolve data members, the DBTask class also includes a handy resolve() method. For a more complete example of resolving FastObjects data, check out the complete source code for TGetChemical.

Background Information


SigPath

Copyright © 2002-2006 Institute for Computational Biomedicine, All Rights Reserved.