public boolean importKK(final String file) {
    ExcelWrapper exw = new ExcelWrapper();
    exw.setFieldTypes(
        new Class[] {
          Integer.class,
          String.class,
          String.class,
          String.class,
          String.class,
          Integer.class,
          Integer.class
        });
    exw.load(file, 0);

    String[] row;
    for (int i = exw.getFirstRow() + 1; i <= exw.getLastRow(); i++) {
      row = exw.getRow(i).toArray(new String[0]);
      if (row == null) {
        continue;
      }
      if (row.length != 7) {
        continue;
      }
      log.info(Messages.KontaktImporterBlatt_Importing + StringTool.join(row, " "));
      // Please keep in sync with doc/import.textile !!
      String bagnr = StringTool.getSafe(row, 0);
      String name = StringTool.getSafe(row, 1);
      String zweig = StringTool.getSafe(row, 2);
      String adresse = StringTool.getSafe(row, 3);
      String typ = StringTool.getSafe(row, 4);
      String EANInsurance = StringTool.getSafe(row, 5);
      String EANReceiver = StringTool.getSafe(row, 6);
      String[] adr = splitAdress(adresse);
      Organisation kk =
          KontaktMatcher.findOrganisation(name, null, adr[0], adr[1], adr[2], CreateMode.CREATE);
      if (kk == null) {
        return false;
      }
      kk.setInfoElement("EAN", EANInsurance); // $NON-NLS-1$
      kk.setInfoElement("BAGNr", bagnr); // $NON-NLS-1$
      kk.set("Bezeichnung2", zweig); // $NON-NLS-1$
      kk.set(
          "Kuerzel",
          StringTool.limitLength(
              Messages.KontaktImporterBlatt_KKKuerzel // $NON-NLS-1$
                  + StringTool.getFirstWord(name),
              39));
    }
    return true;
  }
Esempio n. 2
0
 /**
  * Enter keywords for this note
  *
  * @param kw a string with a comma separated list of keywords (at most 250 chars)
  */
 public void setKeywords(String kw) {
   set(FLD_KEYWORDS, StringTool.limitLength(kw.toLowerCase(), 250));
 }