Changeset 7667


Ignore:
Timestamp:
Mar 21, 2019, 8:45:42 AM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #2161: Import data from Excel files

Introduced Mapper.getDate() method and changed all places in the code that uses/parses string values to use the new method (where this is apparent). Most remaining places that call Mapper.getValue() need a value based on a generic Type.

Location:
trunk/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/parser/ColFunction.java

    r7665 r7667  
    2424import java.text.NumberFormat;
    2525import java.text.ParsePosition;
     26import java.util.Date;
    2627import java.util.LinkedHashMap;
    2728import java.util.List;
     
    3536import net.sf.basedb.core.BaseException;
    3637import net.sf.basedb.core.Type;
     38import net.sf.basedb.util.formatter.Formatter;
    3739import net.sf.basedb.util.jep.JepFunction;
    3840
     
    6365  private final Map<String, Integer> columnHeaders;
    6466  private final NumberFormat numberFormat;
     67  private final Formatter<Date> dateFormat;
    6568  private final ParsePosition pos;
    6669  private FlatFileParser.Data data;
     
    7073  public ColFunction(Map<String, Integer> columnHeaders, NumberFormat numberFormat)
    7174  {
     75    this(columnHeaders, numberFormat, null);
     76  }
     77 
     78  /**
     79    @since 3.15
     80  */
     81  public ColFunction(Map<String, Integer> columnHeaders, NumberFormat numberFormat, Formatter<Date> dateFormat)
     82  {
    7283    this.columnHeaders = columnHeaders;
    7384    this.numberFormat = numberFormat;
     85    this.dateFormat = dateFormat;
    7486    this.pos = new ParsePosition(0);
    7587  }
    76  
     88
    7789  public ColFunction(List<String> columnHeaders, NumberFormat numberFormat)
    7890  {
     91    this(columnHeaders, numberFormat, null);
     92  }
     93 
     94  /**
     95    @since 3.15
     96  */
     97  public ColFunction(List<String> columnHeaders, NumberFormat numberFormat, Formatter<Date> dateFormat)
     98  {
    7999    this.numberFormat = numberFormat;
     100    this.dateFormat = dateFormat;
    80101    this.pos = new ParsePosition(0);
    81102    this.columnHeaders = new LinkedHashMap<String, Integer>(columnHeaders.size());
     
    160181      {
    161182        value = data.getDouble(column, numberFormat, true);
     183      }
     184      else if (nextValueType.isTemporal())
     185      {
     186        value = data.getDate(column, dateFormat, true);
    162187      }
    163188      else
  • trunk/src/core/net/sf/basedb/util/parser/ColumnMapper.java

    r7666 r7667  
    2323
    2424import java.text.NumberFormat;
     25import java.util.Date;
    2526
     27import net.sf.basedb.util.formatter.Formatter;
    2628import net.sf.basedb.util.parser.FlatFileParser.Data;
    2729
     
    4143  private final String name;
    4244  private final NumberFormat parser;
     45  private final Formatter<Date> dateParser;
    4346  private final boolean nullIfException;
    4447
     
    5154  public ColumnMapper(int index, String name)
    5255  {
    53     this(index, name, null, false);
     56    this(index, name, null, null, false);
    5457  }
    5558 
     
    6669  public ColumnMapper(int index, String name, NumberFormat parser, boolean nullIfException)
    6770  {
     71    this(index, name, parser, null, nullIfException);
     72  }
     73 
     74  /**
     75    Create a new column mapper using a specific number or date format.
     76    @param index The index of the data column to use, starting at 0
     77    @param name An optional name of the column, use in the <code>toString</code>
     78      method
     79    @param nullIfException If TRUE, the mapper returns null for unparsable numeric
     80      values, otherwise an excption is thrown
     81    @param parser The parser to use for numeric values or null to use Double.valueOf()
     82    @param parser The parser to use for date values
     83    @since 3.15
     84  */
     85  public ColumnMapper(int index, String name, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException)
     86  {
    6887    this.index = index;
    6988    this.name = name;
    7089    this.parser = parser;
     90    this.dateParser = dateParser;
    7191    this.nullIfException = nullIfException;
    7292  }
    73  
     93
    7494  /*
    7595    From the Mapper interface
     
    97117    return index < data.columns() ? data.getFloat(index, parser, nullIfException) : null;
    98118  }
     119  @Override
     120  public Date getDate(Data data)
     121  {
     122    return index < data.columns() ? data.getDate(index, dateParser, nullIfException) : null;
     123  }
    99124  // -------------------------------------------
    100125 
  • trunk/src/core/net/sf/basedb/util/parser/CompoundMapper.java

    r7666 r7667  
    2424
    2525import java.text.NumberFormat;
     26import java.util.Date;
    2627import java.util.List;
    2728
    2829import net.sf.basedb.core.Type;
     30import net.sf.basedb.util.formatter.Formatter;
    2931import net.sf.basedb.util.parser.FlatFileParser.Data;
    3032
     
    4345  private final List<Mapper> mappers;
    4446  private final NumberFormat parser;
     47  private final Formatter<Date> dateParser;
    4548  private final boolean nullIfException;
    4649 
     
    5255  public CompoundMapper(List<Mapper> mappers)
    5356  {
    54     this(mappers, null, false);
     57    this(mappers, null, null, false);
    5558  }
    5659 
     
    6669  public CompoundMapper(List<Mapper> mappers, NumberFormat parser, boolean nullIfException)
    6770  {
     71    this(mappers, parser, null, nullIfException);
     72  }
     73 
     74  /**
     75    Create a new compound mapper, using a specific number formatter as it's parser.
     76    @param mappers A list of other mappers that will be invoked in
     77      the order they appear in the list
     78    @param parser The number format to use or null to use Float.valueOf()
     79    @param parser The date format to use
     80    @param nullIfException If TRUE, the mapper returns null for unparsable numeric
     81      values, otherwise an excption is thrown
     82    @since 3.15
     83  */
     84  public CompoundMapper(List<Mapper> mappers, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException)
     85  {
    6886    this.mappers = mappers;
    6987    this.parser = parser;
     88    this.dateParser = dateParser;
    7089    this.nullIfException = nullIfException;
    7190  }
    72  
     91
    7392  /*
    7493    From the Mapper interface
     
    99118  public Integer getInt(Data data)
    100119  {
    101     String stringValue = getValue(data);
     120    if (mappers.size() == 1) return mappers.get(0).getInt(data);
     121    String stringValue = getString(data);
    102122    Integer intValue = null;
    103123    if (stringValue != null)
    104124    {
    105       if (parser != null)
    106       {
    107         intValue = (Integer)Type.INT.parseString(stringValue, parser, nullIfException);
    108       }
    109       else
    110       {
    111         try
    112         {
    113           intValue = Double.valueOf(stringValue).intValue();
    114         }
    115         catch (RuntimeException rex)
    116         {
    117           if (!nullIfException) throw rex;
    118         }
    119       }
     125      intValue = (Integer)Type.INT.parseString(stringValue, parser, nullIfException);
    120126    }
    121127    return intValue;
     
    124130  public Float getFloat(Data data)
    125131  {
    126     String stringValue = getValue(data);
     132    if (mappers.size() == 1) return mappers.get(0).getFloat(data);
     133    String stringValue = getString(data);
    127134    Float floatValue = null;
    128135    if (stringValue != null)
    129136    {
    130       if (parser != null)
    131       {
    132         floatValue = (Float)Type.FLOAT.parseString(stringValue, parser, nullIfException);
    133       }
    134       else
    135       {
    136         try
    137         {
    138           floatValue = Float.parseFloat(stringValue);
    139         }
    140         catch (RuntimeException rex)
    141         {
    142           if (!nullIfException) throw rex;
    143         }
    144       }
     137      floatValue = (Float)Type.FLOAT.parseString(stringValue, parser, nullIfException);
    145138    }
    146139    return floatValue;
     140  }
     141  @Override
     142  public Date getDate(Data data)
     143  {
     144    if (mappers.size() == 1) return mappers.get(0).getDate(data);
     145    String stringValue = getString(data);
     146    Date dateValue = null;
     147    if (stringValue != null)
     148    {
     149      dateValue = (Date)Type.DATE.parseString(stringValue, dateParser, nullIfException);
     150    }
     151    return dateValue;
    147152  }
    148153  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/util/parser/ConstantMapper.java

    r7666 r7667  
    2424
    2525import java.text.NumberFormat;
    26 
     26import java.util.Date;
     27
     28import net.sf.basedb.core.DateUtil;
    2729import net.sf.basedb.core.Type;
     30import net.sf.basedb.util.formatter.Formatter;
    2831import net.sf.basedb.util.parser.FlatFileParser.Data;
    2932
     
    4144  private final String constant;
    4245  private final NumberFormat parser;
     46  private final Formatter<Date> dateParser;
    4347  private final boolean nullIfException;
    4448  private boolean needToParseNumeric;
     49  private boolean needToParseDate;
    4550  private Float asFloat;
    4651  private Integer asInteger;
    47   private NumberFormatException parseException;
     52  private Date asDate;
     53  private RuntimeException parseException;
    4854 
    4955  /**
     
    6672  public ConstantMapper(String constant, NumberFormat parser, boolean nullIfException)
    6773  {
     74    this(constant, parser, null, nullIfException);
     75  }
     76 
     77  /**
     78    Create a constant mapper using a specific number formatter as it's parser.
     79    @param constant The constant expression
     80    @param parser The number format to use or null to use Double.valueOf()
     81    @param nullIfException If TRUE, the mapper returns null for unparsable numeric
     82      values, otherwise an excption is thrown
     83    @since 3.15
     84  */
     85  public ConstantMapper(String constant, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException)
     86  {
    6887    this.constant = constant;
    6988    this.parser = parser;
     89    this.dateParser = dateParser;
    7090    this.nullIfException = nullIfException;
    7191    this.needToParseNumeric = constant != null;
     92    this.needToParseDate = constant != null;
    7293  }
    7394 
     
    80101    this.needToParseNumeric = false;
    81102    this.nullIfException = false;
     103    this.dateParser = null;
     104    this.needToParseDate = false;
    82105  }
    83106 
     
    90113    this.needToParseNumeric = false;
    91114    this.nullIfException = false;
     115    this.dateParser = null;
     116    this.needToParseDate = false;
     117  }
     118 
     119  public ConstantMapper(Date constant, Formatter<Date> dateParser)
     120  {
     121    this.constant = dateParser != null ? dateParser.format(constant) : DateUtil.formatDate(constant);
     122    this.asDate = constant;
     123    this.asFloat = null;
     124    this.asInteger = null;
     125    this.parser = null;
     126    this.needToParseNumeric = false;
     127    this.nullIfException = false;
     128    this.dateParser = dateParser;
     129    this.needToParseDate = false;
    92130  }
    93131 
     
    113151  public Integer getInt(Data data)
    114152  {
     153    if (needToParseNumeric) parseNumeric();
    115154    if (parseException != null) throw parseException;
     155    return asInteger;
     156  }
     157  @Override
     158  public Float getFloat(Data data)
     159  {
    116160    if (needToParseNumeric) parseNumeric();
    117     return asInteger;
    118   }
    119   @Override
    120   public Float getFloat(Data data)
    121   {
    122161    if (parseException != null) throw parseException;
    123     if (needToParseNumeric) parseNumeric();
    124162    return asFloat;
     163  }
     164  @Override
     165  public Date getDate(Data data)
     166  {
     167    if (needToParseDate) parseDate();
     168    if (parseException != null) throw parseException;
     169    return asDate;
    125170  }
    126171  // -------------------------------------------
     
    143188    try
    144189    {
    145       if (parser != null)
    146       {
    147         asFloat = (Float)Type.FLOAT.parseString(constant, parser, nullIfException);
    148       }
    149       else
    150       {
    151         asFloat = Double.valueOf(constant).floatValue();
    152       }
    153     }
    154     catch (NumberFormatException ex)
     190      asFloat = (Float)Type.FLOAT.parseString(constant, parser, false);
     191    }
     192    catch (RuntimeException ex)
    155193    {
    156194      if (!nullIfException) parseException = ex;
     
    161199    }
    162200  }
     201 
     202  private void parseDate()
     203  {
     204    assert constant != null : "constant == null";
     205    needToParseDate = false;
     206    try
     207    {
     208      asDate = (Date)Type.DATE.parseString(constant, dateParser, false);
     209    }
     210    catch (RuntimeException ex)
     211    {
     212      if (!nullIfException) parseException = ex;
     213    }
     214  }
    163215}
  • trunk/src/core/net/sf/basedb/util/parser/CropStringMapper.java

    r7666 r7667  
    2121*/
    2222package net.sf.basedb.util.parser;
     23
     24import java.util.Date;
    2325
    2426import net.sf.basedb.util.parser.FlatFileParser.Data;
     
    8183    return parent.getFloat(data);
    8284  }
     85  @Override
     86  public Date getDate(Data data)
     87  {
     88    return parent.getDate(data);
     89  }
    8390  // -------------------------------------------
    8491
  • trunk/src/core/net/sf/basedb/util/parser/FlatFileParser.java

    r7665 r7667  
    6363/**
    6464
    65   This class can be used to parse data from flat text files. The
    66   text file must follow a few simple rules:
     65  This class can be used to parse data from flat text files and from
     66  Excel workbooks in xlsx format. If the file is a text file it must
     67  follow a few simple rules:
    6768  <ul>
    6869  <li>Data must be organised into columns, with one record per line
     
    98991 7 1 "Psme1_Protease (prosome, macropain) 28 s"
    99100</pre>
     101
     102  <p>
     103  If the file is an Excel file the first sheet is automatically converted to a
     104  tab-separated text file by default. To use a different sheet call the
     105  {@link #setExcelSheet(String)} method with the name or index of the sheet.
     106  Initial parsing and regular expression matching is always done against the
     107  text representation of the selected sheet. Note that empty cells on the top
     108  and left are usually cut away. When retrieving values via the {@link Data}
     109  class it will typically go directly to the mapped cell from the Excel sheet
     110  and get the value, which means that numeric and date values doesn't have to
     111  be converted to and from strings if not needed. For example, if a date
     112  value is requested and the mapped cell is date that will be used as it is,
     113  but it the mapped cell is a string, the same parsers that are used for CSV
     114  files are used to convert the string to a date.
    100115
    101116  <p>
     
    145160  <b>Mapping column values</b><br>
    146161  With the <code>FlatFileParser.Data</code> object you can only
    147   access the data by column index (0-based) and all values are returned
    148   as strings. Another approach is to use {@link Mapper}:s. A mapper
    149   takes a string template and inserts the values of the data columns
    150   where you specify. Here are some example:
     162  access the data by column index (0-based). Another approach is to
     163  use {@link Mapper}:s. A mapper takes a string template and inserts the
     164  values of the data columns where you specify. Here are some example:
    151165  <pre class="code">
    152166\1\
     
    156170</pre>
    157171 
    158   The result can be retrieved either as a string or
    159   as a numeric value. It is even possible to create expressions that
     172  The result can be retrieved either as a string, as a numeric value
     173  or as a date. It is even possible to create expressions that
    160174  does a calculation on the value before it is returned.
    161175  See the {@link #getMapper(String)} method for more information.
     
    11221136    return getMapper(expression, numberFormat, nullIfException, (JepFunction[])null);
    11231137  }
    1124 
     1138 
     1139  /**
     1140    Get a mapper using the default date format.
     1141    @since 3.15
     1142  */
     1143  public Mapper getDateMapper(String expression)
     1144  {
     1145    return getMapper(expression, dateFormat, useNullIfException);
     1146  }
     1147 
     1148  /**
     1149    Get a mapper using the default timestamp format.
     1150    @since 3.15
     1151  */
     1152  public Mapper getTimestampMapper(String expression)
     1153  {
     1154    return getMapper(expression, timestampFormat, useNullIfException);
     1155  }
     1156
     1157  /**
     1158    Get a mapper using the specified date format.
     1159    @since 3.15
     1160  */
     1161  public Mapper getMapper(String expression, Formatter<Date> dateFormat, boolean nullIfException)
     1162  {
     1163    return getMapper(expression, numberFormat, dateFormat, nullIfException, (JepFunction[])null);
     1164  }
     1165 
     1166  public Mapper getMapper(String expression, NumberFormat numberFormat, boolean nullIfException, JepFunction... functions)
     1167  {
     1168    return getMapper(expression, numberFormat, dateFormat, nullIfException, (JepFunction[])null);
     1169  }
     1170 
    11251171  /**
    11261172    Create a mapper object that maps an expression string to a value.
     
    11491195    @param numberFormat The number format the mapper should use for
    11501196      parsing numbers, or null to use Float.valueOf or Double.valueOf
     1197    @param dateFormat The date format the mapper should use for
     1198      parsing dates, or null to use Type.DATE.parseString()
    11511199    @param nullIfException TRUE to return a null value instead of throwing
    11521200      an exception when a value can't be parsed.
     
    11541202      included in the parser
    11551203    @return A mapper object
    1156     @since 3.1
    1157   */
    1158   public Mapper getMapper(String expression, NumberFormat numberFormat, boolean nullIfException, JepFunction... functions)
     1204    @since 3.15
     1205  */
     1206  public Mapper getMapper(String expression, NumberFormat numberFormat, Formatter<Date> dateFormat, boolean nullIfException, JepFunction... functions)
    11591207  {
    11601208    Mapper mapper = null;
    11611209    if (expression == null || expression.length() == 0)
    11621210    {
    1163       mapper = new ConstantMapper(emptyIsNull ? null : "", numberFormat, nullIfException);
     1211      mapper = new ConstantMapper(emptyIsNull ? null : "", numberFormat, dateFormat, nullIfException);
    11641212    }
    11651213    else if (expression.startsWith("="))
    11661214    {
    1167       mapper = new JepMapper(expression.substring(1), columnHeaders, numberFormat, ignoreNonExistingColumns, functions);
     1215      mapper = new JepMapper(expression.substring(1), columnHeaders, numberFormat, dateFormat, ignoreNonExistingColumns, functions);
    11681216      if (nullIfException) mapper = new NullIfExceptionMapper(mapper);
    11691217    }
     
    11781226        if (matchStart > nextStart)
    11791227        {
    1180           mappers.add(new ConstantMapper(expression.substring(nextStart, matchStart), numberFormat, nullIfException));
     1228          mappers.add(new ConstantMapper(expression.substring(nextStart, matchStart), numberFormat, dateFormat, nullIfException));
    11811229        }
    11821230        try
    11831231        {
    11841232          int column = Integer.parseInt(m.group(1));
    1185           mappers.add(new ColumnMapper(column, null, numberFormat, nullIfException));
     1233          mappers.add(new ColumnMapper(column, null, numberFormat, dateFormat, nullIfException));
    11861234        }
    11871235        catch (NumberFormatException ex)
     
    12011249            else
    12021250            {
    1203               mappers.add(new ColumnMapper(column, name, numberFormat, nullIfException));
     1251              mappers.add(new ColumnMapper(column, name, numberFormat, dateFormat, nullIfException));
    12041252            }
    12051253          }
     
    12091257      if (nextStart < expression.length())
    12101258      {
    1211         mappers.add(new ConstantMapper(expression.substring(nextStart), numberFormat, nullIfException));
     1259        mappers.add(new ConstantMapper(expression.substring(nextStart), numberFormat, dateFormat, nullIfException));
    12121260      }
    12131261      if (mappers.size() == 0)
    12141262      {
    1215         mapper = new ConstantMapper(emptyIsNull ? null : "", numberFormat, nullIfException);
     1263        mapper = new ConstantMapper(emptyIsNull ? null : "", numberFormat, dateFormat, nullIfException);
    12161264      }
    12171265      else if (mappers.size() == 1)
     
    12211269      else
    12221270      {
    1223         mapper = new CompoundMapper(mappers, numberFormat, nullIfException);
     1271        mapper = new CompoundMapper(mappers, numberFormat, dateFormat, nullIfException);
    12241272      }
    12251273    }
  • trunk/src/core/net/sf/basedb/util/parser/JepMapper.java

    r7666 r7667  
    2323
    2424import java.text.NumberFormat;
     25import java.util.Date;
    2526import java.util.List;
    2627import org.nfunk.jep.JEP;
    2728
    2829import net.sf.basedb.core.Type;
     30import net.sf.basedb.util.formatter.Formatter;
    2931import net.sf.basedb.util.jep.Jep;
    3032import net.sf.basedb.util.jep.JepFunction;
     
    6365  private final boolean hasDataNo;
    6466  private final NumberFormat numberFormat;
     67  private final Formatter<Date> dateFormat;
    6568 
    6669  /**
     
    8285      boolean ignoreNonExistingColumns)
    8386  {
    84     this(expression, columnHeaders, numberFormat, ignoreNonExistingColumns, (JepFunction[])null);
     87    this(expression, columnHeaders, numberFormat, null, ignoreNonExistingColumns, (JepFunction[])null);
    8588  }
    86 
     89 
    8790  /**
    88  
     91   
    8992    @since 3.1
    9093  */
     
    9295    boolean ignoreNonExistingColumns, JepFunction... functions)
    9396  {
     97    this(expression, columnHeaders, numberFormat, null, ignoreNonExistingColumns, (JepFunction[])null);
     98  }
     99
     100  /**
     101 
     102    @since 3.15
     103  */
     104  public JepMapper(String expression, List<String> columnHeaders, NumberFormat numberFormat,
     105    Formatter<Date> dateFormat, boolean ignoreNonExistingColumns, JepFunction... functions)
     106  {
    94107    this.expression = expression;
    95108    this.numberFormat = numberFormat;
    96     this.colFunction = new ColFunction(columnHeaders, numberFormat);
     109    this.dateFormat = dateFormat;
     110    this.colFunction = new ColFunction(columnHeaders, numberFormat, dateFormat);
    97111    colFunction.setIgnoreNonExistingColumns(ignoreNonExistingColumns);
    98112    this.lineNoFunction = expression.contains("lineNo()") ? new LineNoFunction() : null;
     
    150164    return Float.valueOf((float)parser.getValue());
    151165  }
     166  @Override
     167  public Date getDate(Data data)
     168  {
     169    setData(data, Type.DATE);
     170    if (parser.hasError()) Jep.clearErrorList(parser);
     171    Object value = parser.getValueAsObject();
     172    return (Date)value;
     173  }
     174
    152175  // -------------------------------------------
    153176  /*
  • trunk/src/core/net/sf/basedb/util/parser/Mapper.java

    r7666 r7667  
    2121*/
    2222package net.sf.basedb.util.parser;
     23
     24import java.util.Date;
    2325
    2426import net.sf.basedb.util.parser.FlatFileParser.Data;
     
    8082  public Float getFloat(Data data);
    8183
     84  public Date getDate(Data data);
    8285
    8386}
  • trunk/src/core/net/sf/basedb/util/parser/NullIfExceptionMapper.java

    r7666 r7667  
    2121*/
    2222package net.sf.basedb.util.parser;
     23
     24import java.util.Date;
    2325
    2426import net.sf.basedb.util.parser.FlatFileParser.Data;
     
    9092    return null;
    9193  }
     94  @Override
     95  public Date getDate(Data data)
     96  {
     97    try
     98    {
     99      return parent.getDate(data);
     100    }
     101    catch (Throwable t)
     102    {}
     103    return null;
     104  }
    92105  // -------------------------------------------
    93106
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java

    r7666 r7667  
    611611    this.ffp = ffp;
    612612    this.dc = sc.newDbControl();
    613     String dateFormat = Values.getString((String)job.getValue(Parameters.DATE_FORMAT_PARAMETER), "yyyy-MM-dd");
    614613    this.dateFormatter = ffp.getDefaultDateFormat();
    615614    this.idMethod = getIdMethod(dc, (String)job.getValue("idMethod"));
     
    13091308    use to extract date values, since the {@link Mapper} interface doesn't
    13101309    supports it.
    1311   */
     1310    @deprecated In 3.15, use {@link FlatFileParser#getDateMapper(String)} or {@link FlatFileParser#getTimestampMapper(String)}
     1311      and {@link Mapper#getDate(Data)} instead
     1312  */
     1313  @Deprecated
    13121314  protected Date parseDate(String date)
    13131315  {
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AnnotationTypeImporter.java

    r7666 r7667  
    446446    if (registeredMapper != null)
    447447    {
    448       at.setEntryDate(parseDate(registeredMapper.getValue(data)));
     448      at.setEntryDate(registeredMapper.getDate(data));
    449449    }
    450450    updateItem(dc, at, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayBatchImporter.java

    r7666 r7667  
    182182    if (registeredMapper != null)
    183183    {
    184       batch.setEntryDate(parseDate(registeredMapper.getValue(data)));
     184      batch.setEntryDate(registeredMapper.getDate(data));
    185185    }
    186186    updateItem(dc, batch, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayDesignImporter.java

    r7666 r7667  
    270270    if (registeredMapper != null)
    271271    {
    272       design.setEntryDate(parseDate(registeredMapper.getValue(data)));
     272      design.setEntryDate(registeredMapper.getDate(data));
    273273    }
    274274    updateItem(dc, design, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArraySlideImporter.java

    r7666 r7667  
    200200    if (registeredMapper != null)
    201201    {
    202       slide.setEntryDate(parseDate(registeredMapper.getValue(data)));
     202      slide.setEntryDate(registeredMapper.getDate(data));
    203203    }
    204204    updateItem(dc, slide, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/BioPlateImporter.java

    r7666 r7667  
    251251    if (registeredMapper != null)
    252252    {
    253       plate.setEntryDate(parseDate(registeredMapper.getValue(data)));
     253      plate.setEntryDate(registeredMapper.getDate(data));
    254254    }
    255255    updateItem(dc, plate, data);
     
    262262    if (nameMapper != null) plate.setName(nameMapper.getString(data));
    263263    if (descriptionMapper != null) plate.setDescription(descriptionMapper.getString(data));
    264     if (createdMapper != null) plate.setEventDate(parseDate(createdMapper.getValue(data)));
     264    if (createdMapper != null) plate.setEventDate(createdMapper.getDate(data));
    265265    if (barcodeMapper != null) plate.setBarcode(barcodeMapper.getString(data));
    266266    if (hardwareMapper != null)
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/BioSourceImporter.java

    r7666 r7667  
    145145    if (registeredMapper != null)
    146146    {
    147       bs.setEntryDate(parseDate(registeredMapper.getValue(data)));
     147      bs.setEntryDate(registeredMapper.getDate(data));
    148148    }
    149149    updateItem(dc, bs, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/DerivedBioAssayImporter.java

    r7666 r7667  
    334334    if (registeredMapper != null)
    335335    {
    336       bioAssay.setEntryDate(parseDate(registeredMapper.getValue(data)));
     336      bioAssay.setEntryDate(registeredMapper.getDate(data));
    337337    }
    338338    updateItem(dc, bioAssay, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java

    r7666 r7667  
    207207    if (registeredMapper != null)
    208208    {
    209       e.setEntryDate(parseDate(registeredMapper.getValue(data)));
     209      e.setEntryDate(registeredMapper.getDate(data));
    210210    }
    211211    updateItem(dc, e, data);
     
    221221    if (originalQuantityMapper != null) extract.setOriginalQuantity(originalQuantityMapper.getFloat(data));
    222222    BioMaterialEvent creationEvent = extract.getCreationEvent();
    223     if (createdMapper != null) creationEvent.setEventDate(parseDate(createdMapper.getValue(data)));
     223    if (createdMapper != null) creationEvent.setEventDate(createdMapper.getDate(data));
    224224    updateItemSubtype(dc, extract, data);
    225225
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/KitImporter.java

    r7666 r7667  
    173173    if (registeredMapper != null)
    174174    {
    175       kit.setEntryDate(parseDate(registeredMapper.getValue(data)));
     175      kit.setEntryDate(registeredMapper.getDate(data));
    176176    }
    177177    updateItem(dc, kit, data);
     
    183183    if (nameMapper != null) kit.setName(nameMapper.getString(data));
    184184    if (descriptionMapper != null) kit.setDescription(descriptionMapper.getString(data));
    185     if (expirationDateMapper != null) kit.setExpirationDate(parseDate(expirationDateMapper.getValue(data)));
     185    if (expirationDateMapper != null) kit.setExpirationDate(expirationDateMapper.getDate(data));
    186186    if (inactiveMapper != null) kit.setInactive(Values.getBoolean(inactiveMapper.getString(data)));
    187187
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/PhysicalBioAssayImporter.java

    r7666 r7667  
    253253    if (registeredMapper != null)
    254254    {
    255       pba.setEntryDate(parseDate(registeredMapper.getValue(data)));
     255      pba.setEntryDate(registeredMapper.getDate(data));
    256256    }
    257257    updateItem(dc, pba, data);
     
    266266    if (sizeMapper != null) pba.setSize(sizeMapper.getInt(data));
    267267    BioMaterialEvent creationEvent = pba.getCreationEvent();
    268     if (createdMapper != null) creationEvent.setEventDate(parseDate(createdMapper.getValue(data)));
     268    if (createdMapper != null) creationEvent.setEventDate(createdMapper.getDate(data));
    269269    updateItemSubtype(dc, pba, data);
    270270    if (protocolMapper != null)
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java

    r7666 r7667  
    344344    if (registeredMapper != null)
    345345    {
    346       rba.setEntryDate(parseDate(registeredMapper.getValue(data)));
     346      rba.setEntryDate(registeredMapper.getDate(data));
    347347    }
    348348    updateItem(dc, rba, data);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java

    r7666 r7667  
    304304    if (registeredMapper != null)
    305305    {
    306       s.setEntryDate(parseDate(registeredMapper.getValue(data)));
     306      s.setEntryDate(registeredMapper.getDate(data));
    307307    }
    308308    updateItem(dc, s, data);
     
    318318    if (originalQuantityMapper != null) sample.setOriginalQuantity(originalQuantityMapper.getFloat(data));
    319319    BioMaterialEvent creationEvent = sample.getCreationEvent();
    320     if (createdMapper != null) creationEvent.setEventDate(parseDate(createdMapper.getValue(data)));
     320    if (createdMapper != null) creationEvent.setEventDate(createdMapper.getDate(data));
    321321    updateItemSubtype(dc, sample, data);
    322322    if (protocolMapper != null)
Note: See TracChangeset for help on using the changeset viewer.