public void setTransformations(String extraImportTransformations) { this.transformationsMap = new HashMap<String, Transformation>(); this.extraTransformations = extraImportTransformations; if (StringUtils.isEmpty(extraImportTransformations)) { return; } try { HSSFWorkbook wbEscaping = new HSSFWorkbook(new FileInputStream(new File(this.extraTransformations))); HSSFSheet sheetEscaping = wbEscaping.getSheetAt(0); Iterator<Row> it = sheetEscaping.rowIterator(); while (it.hasNext()) { Row row = it.next(); if (row == null || row.getCell(0) == null || row.getCell(1) == null || row.getCell(2) == null) { return; } Transformation transformation = new Transformation(row.getCell(1).getStringCellValue(), row.getCell(2).getStringCellValue(), row.getCell(3) != null ? row.getCell(3).getStringCellValue() : null); transformationsMap.put(row.getCell(0).getStringCellValue(), transformation); } } catch (FileNotFoundException e) { } catch (IOException e) { } }
public void setTransformations(String extraImportTransformations) { this.transformationsMap = new HashMap<String, Transformation>(); this.extraTransformations = extraImportTransformations; if (StringUtils.isEmpty(extraImportTransformations)) { return; } try { HSSFWorkbook wbEscaping = new HSSFWorkbook(new FileInputStream(new File(this.extraTransformations))); HSSFSheet sheetEscaping = wbEscaping.getSheetAt(0); Iterator<Row> it = sheetEscaping.rowIterator(); while (it.hasNext()) { Row row = it.next(); if (row == null || row.getCell(0) == null || row.getCell(1) == null || row.getCell(2) == null) { return; } Transformation transformation = new Transformation(row.getCell(1).getStringCellValue(), row.getCell(2).getStringCellValue(), row.getCell(3) != null ? row.getCell(3).getStringCellValue() : null); transformationsMap.put(row.getCell(0).getStringCellValue(), transformation); } } catch (FileNotFoundException e) { } catch (IOException e) { } }
private String prepareOutputValue(String lang, String key, String value) { ImportConfig.Transformation tranformation = mConfig.getKeyTransformation(key); if (tranformation != null) { value = tranformation.apply(value, lang); } if (mConfig.unescapeFirst) { value = EscapingUtils.unescapeQuotes(value); } if (mConfig.isEscapedKey(key)) { value = EscapingUtils.escapeWithQuotes(value); } else { value = EscapingUtils.escapeWithBackslash(value); } return value; }
private String prepareOutputValue(String lang, String key, String value) { ImportConfig.Transformation tranformation = mConfig.getKeyTransformation(key); if (tranformation != null) { value = tranformation.apply(value, lang); } if (mConfig.unescapeFirst) { value = EscapingUtils.unescapeQuotes(value); } if (mConfig.isEscapedKey(key)) { value = EscapingUtils.escapeWithQuotes(value); } else { value = EscapingUtils.escapeWithBackslash(value); } return value; }