gt:         return hasGermplasm() ? germplasm.get_mutagen() : null;
context: //------------------------------------------------------------------------------
  //Copyright (c) 2010 Carnegie Institution for Science. All rights reserved
  // $Revision: 1.5 $
  // $Date: 2006/03/02 19:54:28 $
  //------------------------------------------------------------------------------
  package org.tair.processor.microarray.data;
  
  import java.sql.SQLException;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Arrays;
  
  import org.tair.querytools.BioSamEnvConObject;
  import org.tair.querytools.BioSamEnvConObjectCollection;
  import org.tair.tfc.DBconnection;
  import org.tair.tfc.TfcAnnotationType;
  import org.tair.tfc.TfcBioSample;
  import org.tair.tfc.TfcGermplasm;
  import org.tair.tfc.TfcRelationshipType;
  import org.tair.tfc.TfcTaxon;
  import org.tair.utilities.InvalidActionException;
  
  /**
   * LoadableBioSample is a composite class that extends <code>TfcBioSample</code>
   * to present detailed information about a biosample. This class is created
   * specifically for handling bio sample data during microarray data loading and
   * curation.
   */
  
  public class LoadableBioSample extends TfcBioSample {
  
      private LoadableProtocol protocol;
  
      private TfcTaxon taxon;
  
      // germplasm used for bio sample
      private LoadableGermplasm germplasm;
  
      // associated environmental condition data - stored as BioSamEnvConObject
      // objects
      private BioSamEnvConObjectCollection envConds;
  
      // structure keywords for bio sample
      private LoadableBioSampleKeywordCollection structureKeywords;
  
      // developmental stage keywords for bio sample
      private LoadableBioSampleKeywordCollection developmentalStages;
  
      /**
       * Creates an empty instance of LoadableBioSample
       */
      public LoadableBioSample() {
          super();
      }
  
      /**
       * Creates an instance of LoadableBioSample to reflect data referenced by
       * submitted bio_sample id.
       * 
       * @param conn
       *            An active connection to the database
       * @param bio_sample_id
       *            BioSample id to retrieve data for
       * @throws SQLException
       *             if a database error occurs
       */
      public LoadableBioSample( DBconnection conn, Long bio_sample_id ) 
          throws SQLException {
  
          super( conn, bio_sample_id );
  
          envConds = new BioSamEnvConObjectCollection( conn, bio_sample_id );
  
          if ( get_taxon_id() != null ) {
              taxon = new TfcTaxon( conn, get_taxon_id() );
          }
  
          if ( super.get_germplasm_id() != null ) {
              Long tairObjID = 
                  TfcGermplasm.retrieveTairObjectID( conn, get_germplasm_id() );
  
              germplasm = new LoadableGermplasm( conn, tairObjID );
          }
  
          if ( get_extraction_protocol_ref_id() != null ) {
              protocol = 
                  new LoadableProtocol( conn, get_extraction_protocol_ref_id() );
          }
  
          populateKeywords( conn );
      }
  
      /**
       * Gateway method to populate keyword collections for existing bio sample.
       * Each collection must be created with a specific relationship type and
       * keyword type that defines the set keywords in collection
       * 
       * @param conn
       *            An active connection to the database
       * @throws SQLException
       *             if a database error occurs
       */
      private void populateKeywords( DBconnection conn ) throws SQLException {
  
          // create relationship type object to get id literals needed
          // for creating keyword collections
          TfcRelationshipType relType = getBioSampleRelType( conn );
          Long relTypeID = relType.get_relationship_type_id();
          String[] types = { "stru", "grow", "user" };
          List possibleKeywordTypes = Arrays.asList( types );
          structureKeywords = new LoadableBioSampleKeywordCollection( conn,
                                                                      get_bio_sample_id(),
                                                                      relTypeID,
                                                                      possibleKeywordTypes );
  
          developmentalStages = new LoadableBioSampleKeywordCollection( conn,
                                                                        get_bio_sample_id(),
                                                                        relTypeID,
                                                                        possibleKeywordTypes );
      }
  
      //
      // LoadableProtocol wrappers
      //
      public String get_protocol_title() {
          return hasExtractionProtocol() ? protocol.get_title() : null;
      }
  
      public Integer get_protocol_pubmed_id() {
          return hasExtractionProtocol() ? protocol.get_pubmed_id() : null;
      }
  
      public String get_protocol_description() {
          return hasExtractionProtocol() ? protocol.get_description() : null;
      }
  
      public String get_protocol_authors() {
          return hasExtractionProtocol() ? protocol.get_authors() : null;
      }
  
      public String get_protocol_usage() {
          return hasExtractionProtocol() ? protocol.get_usage() : null;
      }
  
      public String get_protocol_methods() {
          return hasExtractionProtocol() ? protocol.get_methods() : null;
      }
  
      public String get_protocol_status() {
          return hasExtractionProtocol() ? protocol.get_status() : null;
      }
  
      /**
       * Determines if biosample has associated extraction protocol data
       * 
       * @return <code>true</code> if bio sample has protocol data,
       *         <code>false</code> if no protocol data for bio sample
       */
      public boolean hasExtractionProtocol() {
          return ( protocol != null );
      }
  
      /**
       * Sets extraction protocol for this object. When loading from external data
       * file, this object is assembled externally and then set with bio sample.
       * 
       * @param protocol
       *            Extraction protocol for biosample
       */
      public void setExtractionProtocol( LoadableProtocol protocol ) {
          this.protocol = protocol;
  
          // set foreign key in superclass -- new protocols will have id set
          // after protocol has been stored to db
          super.set_extraction_protocol_ref_id( protocol.get_reference_id() );
      }
  
      /**
       * Retrieves URLs for extraction protocol associated to bio sample
       * 
       * @return URLs for protocol for bio sample as an <code>Iterator</code> of
       *         <code>ReferenceURL</code> objects or <code>null</code> if no
       *         URLs for protocol
       */
      public Iterator getExtractionProtocolURLs() {
          return hasExtractionProtocol() ? protocol.getURLs() : null;
      }
  
      //
      // TfcTaxon wrappers
      //
      public String get_taxon_original_name() {
          return hasTaxon() ? taxon.get_original_name() : null;
      }
  
      public String get_genus() {
          return hasTaxon() ? taxon.get_genus() : null;
      }
  
      public String get_species() {
          return hasTaxon() ? taxon.get_species() : null;
      }
  
      public String get_division_code() {
          return hasTaxon() ? taxon.get_division_code() : null;
      }
  
      public String get_scientific_name() {
          return hasTaxon() ? taxon.get_scientific_name() : null;
      }
  
      public String get_common_name() {
          return hasTaxon() ? taxon.get_common_name() : null;
      }
  
      public String get_taxonomy() {
          return hasTaxon() ? taxon.get_taxonomy() : null;
      }
  
      public String get_genbank_taxonomy_id() {
          return hasTaxon() ? taxon.get_genbank_taxonomy_id() : null;
      }
  
      /**
       * Determines if bio sample has associated taxon data
       * 
       * @return <code>true</code> if bio sample has taxon data,
       *         <code>false</code> if no taxon data for bio sample
       */
      public boolean hasTaxon() {
          return ( taxon != null );
      }
  
      /**
       * Sets taxon object. When loading from external data file, this object & is
       * assembled externally and then set with bio sample.
       * 
       * @param taxon
       *            Taxon for biosample
       */
      public void setTaxon( TfcTaxon taxon ) {
          this.taxon = taxon;
  
          // set foreign key in superclass
          super.set_taxon_id( taxon.get_taxon_id() );
      }
  
      //
      // Germplasm wrappers
      //
      public Long get_germplasm_tair_object_id() {
          return hasGermplasm() ? germplasm.get_tair_object_id() : null;
      }
  
      public String get_germplasm_original_name() {
          return hasGermplasm() ? germplasm.get_original_name() : null;
      }
  
      public Long get_germplasm_species_variant_id() {
          return hasGermplasm() ? germplasm.get_species_variant_id() : null;
      }
  
      public String get_germplasm_name() {
          return hasGermplasm() ? germplasm.get_name() : null;
      }
  
      public String get_germplasm_type() {
          return hasGermplasm() ? germplasm.get_germplasm_type() : null;
      }
  
      public Boolean get_foreign_dna() {
          return hasGermplasm() ? germplasm.get_has_foreign_dna() : null;
      }
  
      public Boolean get_is_mutant() {
          return hasGermplasm() ? germplasm.get_is_mutant() : null;
      }
  
      public Boolean get_has_polymorphisms() {
          return hasGermplasm() ? germplasm.get_has_polymorphisms() : null;
      }
  
      public Boolean get_is_natural_variant() {
          return hasGermplasm() ? germplasm.get_is_natural_variant() : null;
      }
  
      public Boolean get_is_mapping_strain() {
          return hasGermplasm() ? germplasm.get_is_mapping_strain() : null;
      }
  
      public String get_special_growth_conditions() {
          return hasGermplasm() ? germplasm.get_special_growth_conditions()
                               : null;
      }
  
      public String get_ploidy() {
          return hasGermplasm() ? germplasm.get_ploidy() : null;
      }
  
      public String get_mutagen() {
  