Changeset 3575


Ignore:
Timestamp:
Jul 19, 2007, 3:42:17 PM (14 years ago)
Author:
Martin Svensson
Message:

Fixes #685 Add plugin parameter asking for bioassays to AbstractAnalysisPlugin?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/plugin/AbstractAnalysisPlugin.java

    r3569 r3575  
    2525
    2626import java.util.Collections;
     27import java.util.List;
    2728import java.util.Set;
    2829
     30import net.sf.basedb.core.BioAssay;
    2931import net.sf.basedb.core.BioAssaySet;
    3032import net.sf.basedb.core.DbControl;
     
    107109 
    108110  /**
     111    The bioAssays subset parameter.
     112    To use when working on subset of bioassays in a bioAssaySet
     113    @see #getSourceBioAssaysSubSetParameter(String, String, List<BioAssay>)
     114   */
     115  private PluginParameter<BioAssay> sourceSubSetParameter = null;
     116 
     117  /**
    109118    Create a new <code>AbstractAnalysisPlugin</code>.
    110119  */
     
    200209    }
    201210    return sourceParameter;
     211  }
     212 
     213  protected static final String SOURCE_BIOASSAYS = "source_subset";
     214 
     215  /**
     216    Gets a plugin parameter that asks for a subset of bioassays to use as data source
     217    for the plugin.
     218      @param label The parameter's label. Uses a default value if null.
     219   * @param description Description of the parameter. Uses a default value if null.
     220    @return A plugin parameter
     221    @since 2.4
     222  */
     223  protected PluginParameter<BioAssay> getSourceBioAssaysParameter(String label, String description)
     224  {
     225    if (sourceSubSetParameter == null)
     226    {
     227      if (label == null) label = "Source bioassays";
     228      if (description == null) description = "Select the bioassays that should be filtered. " +
     229          "If no bioassay is selected all will be filtered.";
     230      sourceSubSetParameter = new PluginParameter<BioAssay>
     231        (
     232          SOURCE_BIOASSAYS, label, description,
     233          new ItemParameterType<BioAssay>(BioAssay.class, null, false, 0, null)
     234        );   
     235    }
     236    return sourceSubSetParameter;
    202237  }
    203238 
     
    336371 
    337372  /**
     373    Gets a list of bioassays that were selected from the current bioassay set, to use for the analysis.
     374      @param dc The DbControl to access the database with
     375      @return A list with bioassays or null.
     376      @since 2.4
     377   */
     378  @SuppressWarnings("unchecked")
     379  protected List<BioAssay> getSourceBioAssays(DbControl dc)
     380  {
     381    List<BioAssay> bioAssaySubset = (List<BioAssay>)job.getValues(SOURCE_BIOASSAYS);
     382    if (bioAssaySubset != null)
     383    {
     384      for (BioAssay ba : bioAssaySubset)
     385      {
     386        dc.reattachItem(ba);
     387      }
     388    }
     389    return bioAssaySubset;
     390  }
     391 
     392  /**
    338393    Generate a name for the transformation based on the plugin and it's
    339394    configuration. The name is created by taking the name of the plugin from the
Note: See TracChangeset for help on using the changeset viewer.