@Override
 public ActionResult importFile(File selectedFile) throws IOException {
   showValid = true;
   Timer timer = new Timer();
   dt.types.clear();
   init();
   fileTest(selectedFile);
   refineResults();
   return new ActionResult(
       selectedFile,
       selectedFile.getName(),
       this.toString(),
       details,
       dt.types,
       true,
       timer.getDuration());
 }
  // file import rules
  public ActionResult importFile(File selectedFile) throws IOException {
    Timer timer = new Timer();
    TreeMap<String, Stats> types = new TreeMap<String, Stats>();

    InputStream in = new FileInputStream(selectedFile);
    MarcReader reader = new MarcPermissiveStreamReader(in, true, true);

    while (reader.hasNext()) {
      Record record = reader.next();

      String bib_id = "";
      DataField df907 = (DataField) record.getVariableField("907");

      if (df907 != null) {
        Subfield df907a = df907.getSubfield('a');
        if (df907a != null) {
          bib_id = df907a.getData();
        }
      }
      if (bib_id.startsWith(".b")) {
        bib_id = bib_id.substring(2, 9);
      }

      String key = bib_id;
      Stats stat = Generator.INSTANCE.create(key);
      types.put(stat.key, stat);

      String checksum = getChecksum(record.toString());
      stat.setVal(InventoryStatsItem.Hash_Code, checksum);
    } // end while loop

    return new ActionResult(
        selectedFile,
        selectedFile.getName(),
        this.toString(),
        details,
        types,
        true,
        timer.getDuration());
  }
  public ActionResult importFile(File selectedFile) throws IOException {
    Separator fileSeparator = (Separator) getProperty(DELIM);
    Timer timer = new Timer();
    forceKey = dt.getImporterForceKey();

    int colcount = 0;
    TreeMap<String, Stats> types = new TreeMap<String, Stats>();
    StatsItemConfig details = new StatsItemConfig();
    if (forceKey) {
      details.addStatsItem(KEY, StatsItem.makeStringStatsItem("Auto Num").setExport(false));
    }

    int colset = 0;

    DelimitedFileReader dfr = new DelimitedFileReader(selectedFile, fileSeparator.separator);
    boolean firstRow = (YN) getProperty(HEADROW) == YN.Y;

    for (Vector<String> cols = dfr.getRow(); cols != null; cols = dfr.getRow()) {
      colcount = Math.max(colcount, cols.size());
      for (int i = colset; i < colcount; i++) {
        String colkey = "Col" + (i + 1);
        details.addStatsItem(
            colkey, StatsItem.makeStringStatsItem(firstRow ? cols.get(i) : colkey));
        colset++;
      }
      firstRow = false;
    }

    firstRow = (YN) getProperty(HEADROW) == YN.Y;
    dfr = new DelimitedFileReader(selectedFile, fileSeparator.separator);
    for (Vector<String> cols = dfr.getRow(); cols != null; cols = dfr.getRow()) {
      if (firstRow) {
        firstRow = false;
        continue;
      }
      String key = cols.get(0);
      if (forceKey) {
        key = "" + (rowKey++);
      }
      Stats stats = Stats.Generator.INSTANCE.create(key);
      stats.init(details);
      int start = 1;
      if (forceKey) {
        stats.setKeyVal(details.getByKey(KEY), cols.get(0));
        start = 0;
      }
      for (int i = start; i < cols.size(); i++) {
        String colkey = "Col" + (i + 1);
        stats.setKeyVal(details.getByKey(colkey), cols.get(i));
      }
      types.put(key, stats);
    }

    return new ActionResult(
        selectedFile,
        selectedFile.getName(),
        this.toString(),
        details,
        types,
        true,
        timer.getDuration());
  }