/** * Returns a combined modifier with substring and regex modifications. the substring modifier will * be applied before the regex modifier during import. * * @return an ImportValueModifier that applies substring and regex modifications. */ public ImportValueModifier getModifier() { ValueFilter filter = new ValueFilter(); if (substring.getSize() > 0) filter.addColumnModifier(substring); if (regex.getSize() > 0) filter.addColumnModifier(regex); if (filter.getSize() > 0) { return filter; } return null; }
private void parseRegex(String parameterValue) { if (parameterValue == null) return; List<String> entries = StringUtil.stringToList(parameterValue, ",", true, true, false); if (entries.isEmpty()) return; for (String entry : entries) { String[] parts = entry.split("="); if (parts.length == 2 && parts[0] != null && parts[1] != null) { ColumnIdentifier col = new ColumnIdentifier(parts[0]); String[] limits = parts[1].split(":"); String expression = null; String replacement = ""; if (limits.length == 1) { expression = limits[0].trim(); } else if (limits.length == 2) { expression = limits[0].trim(); replacement = limits[1].trim(); } regex.addDefinition(col, expression, replacement); } } }