Changeset 8021


Ignore:
Timestamp:
Dec 9, 2021, 1:52:23 PM (8 months ago)
Author:
Nicklas Nordborg
Message:

Fixes #2272: Implement "ALL" as a special keyword for the "Used quantity from parent" mapping in batch importers

Location:
branches/3.19-stable/src/plugins/core/net/sf/basedb/plugins/batchimport
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.19-stable/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java

    r7667 r8021  
    2626import java.util.Set;
    2727
    28 import net.sf.basedb.core.BioMaterial;
    2928import net.sf.basedb.core.BioMaterialEvent;
    3029import net.sf.basedb.core.BioMaterialEventSource;
     
    3736import net.sf.basedb.core.ItemSubtype;
    3837import net.sf.basedb.core.Kit;
     38import net.sf.basedb.core.MeasuredBioMaterial;
    3939import net.sf.basedb.core.PluginParameter;
    4040import net.sf.basedb.core.Protocol;
     
    102102  private Mapper parentTypeMapper;
    103103  private Mapper parentMapper;
    104   private Mapper usedQuantityMapper;
     104  private UsedQuantityMapper usedQuantityMapper;
    105105  private Mapper bioPlateMapper;
    106106  private Mapper bioWellRowMapper;
     
    195195    parentTypeMapper = getMapper(ffp, (String)job.getValue("parentTypeColumnMapping"), null, null);
    196196    parentMapper = getMapper(ffp, (String)job.getValue("parentColumnMapping"), null, null);
    197     usedQuantityMapper = getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null);
     197    usedQuantityMapper = UsedQuantityMapper.create(getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null));
    198198    bioPlateMapper = getMapper(ffp, (String)job.getValue("bioPlateColumnMapping"), null, null);
    199199    bioWellRowMapper = getMapper(ffp, (String)job.getValue("bioWellRowColumnMapping"), null, null);
     
    287287      // Try to find either a sample or a biosource
    288288      String nameOrId = parentMapper.getString(data);
    289       BioMaterial parent = null;
     289      MeasuredBioMaterial parent = null;
    290290      if (parentType == Item.EXTRACT)
    291291      {
     
    301301        if (evtSrc != null)
    302302        {
    303           Float usedQuantity = usedQuantityMapper == null ? null : usedQuantityMapper.getFloat(data);
     303          Float usedQuantity = usedQuantityMapper == null ? null : usedQuantityMapper.getUsedQuantity(data, evtSrc);
    304304          evtSrc.setUsedQuantity(usedQuantity);
    305305        }
     
    322322      if (parent != null)
    323323      {
     324        BioMaterialEventSource evtSrc = extract.getCreationEvent().addSource(parent);
    324325        Float usedQuantity = usedQuantityMapper == null ?
    325             null : usedQuantityMapper.getFloat(data);
    326         extract.getCreationEvent().addSource(parent).setUsedQuantity(usedQuantity);
     326            null : usedQuantityMapper.getUsedQuantity(data, evtSrc);
     327        evtSrc.setUsedQuantity(usedQuantity);
    327328        // Use same tag as parent if not yet set and not mapped in the file
    328329        if (tagMapper == null && parent.getTag() != null && extract.getTag() == null)
  • branches/3.19-stable/src/plugins/core/net/sf/basedb/plugins/batchimport/PhysicalBioAssayImporter.java

    r7667 r8021  
    148148  private Mapper kitMapper;
    149149  private Mapper parentMapper;
    150   private Mapper usedQuantityMapper;
     150  private UsedQuantityMapper usedQuantityMapper;
    151151  private Mapper extractPositionMapper;
    152152  private Mapper arraySlideMapper;
     
    241241    hardwareMapper = getMapper(ffp, (String)job.getValue("hardwareColumnMapping"), null, null, defaultHardwareFunction);
    242242    parentMapper = getMapper(ffp, (String)job.getValue("parentColumnMapping"), null, null);
    243     usedQuantityMapper = getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null);
     243    usedQuantityMapper = UsedQuantityMapper.create(getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null));
    244244    extractPositionMapper = getMapper(ffp, (String)job.getValue("extractPositionColumnMapping"), null, null);
    245245    arraySlideMapper = getMapper(ffp, (String)job.getValue("arraySlideColumnMapping"), null, null);
     
    349349        if (usedQuantityMapper != null)
    350350        {
    351           eventSource.setUsedQuantity(usedQuantityMapper.getFloat(data));
     351          eventSource.setUsedQuantity(usedQuantityMapper.getUsedQuantity(data, eventSource));
    352352        }
    353353        if (extractPositionMapper != null)
  • branches/3.19-stable/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java

    r7667 r8021  
    3636import net.sf.basedb.core.ItemSubtype;
    3737import net.sf.basedb.core.Kit;
     38import net.sf.basedb.core.MeasuredBioMaterial;
    3839import net.sf.basedb.core.PluginParameter;
    3940import net.sf.basedb.core.Protocol;
     
    120121        "Used quantity from parent",
    121122        "Mapping that picks the used quantity (µg) of the parent item in the data columns. The " +
    122         "values must be in the numeric format specified by the 'Number format' parameter." +
     123        "values must be in the numeric format specified by the 'Number format' parameter or 'ALL' to "+
     124        "as a special case to use all remaining quantity from the parent." +
    123125        "Example: \\Used quantity\\",
    124126        optionalColumnMapping
     
    201203  private Mapper parentTypeMapper;
    202204  private Mapper parentMapper;
    203   private Mapper usedQuantityMapper;
     205  private UsedQuantityMapper usedQuantityMapper;
    204206  private Mapper bioPlateMapper;
    205207  private Mapper bioWellRowMapper;
     
    292294    parentTypeMapper = getMapper(ffp, (String)job.getValue("parentTypeColumnMapping"), null, null);
    293295    parentMapper = getMapper(ffp, (String)job.getValue("parentColumnMapping"), null, null);
    294     usedQuantityMapper = getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null);
     296    usedQuantityMapper = UsedQuantityMapper.create(getMapper(ffp, (String)job.getValue("usedQuantityColumnMapping"), null, null));
    295297    bioPlateMapper = getMapper(ffp, (String)job.getValue("bioPlateColumnMapping"), null, null);
    296298    bioWellRowMapper = getMapper(ffp, (String)job.getValue("bioWellRowColumnMapping"), null, null);
     
    386388      {
    387389        BioMaterialEventSource evtSrc = sample.getCreationEvent().setSource(parent);
    388         if (evtSrc != null)
     390        if (evtSrc != null && parent instanceof MeasuredBioMaterial)
    389391        {
    390           Float usedQuantity = usedQuantityMapper == null ? null : usedQuantityMapper.getFloat(data);
     392          Float usedQuantity = usedQuantityMapper == null ? null : usedQuantityMapper.getUsedQuantity(data, evtSrc);
    391393          evtSrc.setUsedQuantity(usedQuantity);
    392394        }
     
    410412      if (parent != null)
    411413      {
     414        BioMaterialEventSource evtSrc = sample.getCreationEvent().addSource(parent);
    412415        Float usedQuantity = usedQuantityMapper == null ?
    413             null : usedQuantityMapper.getFloat(data);
    414         sample.getCreationEvent().addSource(parent).setUsedQuantity(usedQuantity);
     416            null : usedQuantityMapper.getUsedQuantity(data, evtSrc);
     417        evtSrc.setUsedQuantity(usedQuantity);
    415418      }
    416419    }
Note: See TracChangeset for help on using the changeset viewer.