Changeset 5779


Ignore:
Timestamp:
Dec 10, 2019, 9:03:29 AM (2 years ago)
Author:
Nicklas Nordborg
Message:

References #1209: Add support for storing TMA specimen

Added a "Comment" column which will go into the "description" field of the TMA specimen that are created.

Implemented check for null values in Case name, TMABlock, TMABlockPos and PAD.

Location:
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/TMASpecimenImporter.java

    r5778 r5779  
    6161
    6262  private static final StringParameterType requiredColumnMapping = new StringParameterType(255, null, true);
     63  private static final StringParameterType optionalColumnMapping = new StringParameterType(255, null, false);
    6364 
    6465  private static final PluginParameter<String> caseColumnMapping = new PluginParameter<String>(
     
    9899      );
    99100
     101  private static final PluginParameter<String> commentColumnMapping = new PluginParameter<String>(
     102      "commentColumnMapping",
     103      "Comment",
     104      "Optional mapping that picks a comment for the TMA. The comment is stored " +
     105      "in the Description field of the specimen. " +
     106      "Example: \\Comment\\",
     107      optionalColumnMapping
     108      );
     109 
     110 
    100111  public TMASpecimenImporter()
    101112  {}
     
    213224        storeValue(wrapper, request, tmaBlockPosColumnMapping);
    214225        storeValue(wrapper, request, padColumnMapping);
     226        storeValue(wrapper, request, commentColumnMapping);
    215227       
    216228        response.setDryRun(Boolean.TRUE.equals(request.getParameterValue(Parameters.DRY_RUN_PARAMETER)));
     
    238250  private Mapper tmaBlockPosMapper;
    239251  private Mapper padMapper;
     252  private Mapper commentMapper;
    240253  private String lastTMA_XId;
    241254 
     
    262275  protected void beginData()
    263276  {
    264     caseMapper = getMapper(ffp, job.getValue("caseColumnMapping"), null, null);
    265     tmaBlockMapper = getMapper(ffp, job.getValue("tmaBlockColumnMapping"), null, null);
    266     tmaBlockPosMapper = getMapper(ffp, job.getValue("tmaBlockPosColumnMapping"), null, null);
    267     padMapper = getMapper(ffp, job.getValue("padColumnMapping"), null, null);
     277    caseMapper = NotNullMapper.wrap("Case name is null", getMapper(ffp, job.getValue("caseColumnMapping"), null, null));
     278    tmaBlockMapper = NotNullMapper.wrap("TMABlock is null", getMapper(ffp, job.getValue("tmaBlockColumnMapping"), null, null));
     279    tmaBlockPosMapper = NotNullMapper.wrap("TMABlockPos is null", getMapper(ffp, job.getValue("tmaBlockPosColumnMapping"), null, null));
     280    padMapper = NotNullMapper.wrap("PAD is null", getMapper(ffp, job.getValue("padColumnMapping"), null, null));
     281    commentMapper = getMapper(ffp, job.getValue("commentColumnMapping"), null, null);
    268282    numCreated = 0;
    269283  }
     
    304318    tmaSpecimen.setExternalId(lastTMA_XId);
    305319    tmaSpecimen.getCreationEvent().setSource(theCase);
     320    if (commentMapper != null) tmaSpecimen.setDescription(commentMapper.getString(data));
    306321    dc.saveItem(tmaSpecimen);
    307322   
     
    383398        parameters.add(tmaBlockPosColumnMapping);
    384399        parameters.add(padColumnMapping);
     400        parameters.add(commentColumnMapping);
    385401       
    386402        configureParser = new RequestInformation
Note: See TracChangeset for help on using the changeset viewer.