use of org.talend.dataprep.transformation.actions.common.ReplaceOnValueHelper in project data-prep by Talend.
the class MatchesPattern method getPattern.
/**
* @param parameters the action parameters.
* @return the pattern to use according to the given parameters.
*/
private ReplaceOnValueHelper getPattern(Map<String, String> parameters) {
if (CUSTOM.equals(parameters.get(PATTERN_PARAMETER))) {
final String jsonString = parameters.get(MANUAL_PATTERN_PARAMETER);
final ReplaceOnValueHelper regexParametersHelper = new ReplaceOnValueHelper();
return regexParametersHelper.build(jsonString, true);
} else {
return new ReplaceOnValueHelper(parameters.get(PATTERN_PARAMETER), ReplaceOnValueHelper.REGEX_MODE);
}
}
use of org.talend.dataprep.transformation.actions.common.ReplaceOnValueHelper in project data-prep by Talend.
the class DeleteOnValue method compile.
@Override
public void compile(ActionContext actionContext) {
super.compile(actionContext);
if (ActionsUtils.doesCreateNewColumn(actionContext.getParameters(), CREATE_NEW_COLUMN_DEFAULT)) {
ActionsUtils.createNewColumn(actionContext, singletonList(ActionsUtils.additionalColumn()));
}
if (actionContext.getActionStatus() == OK) {
final Map<String, String> parameters = actionContext.getParameters();
final ReplaceOnValueHelper regexParametersHelper = new ReplaceOnValueHelper();
actionContext.get("replaceOnValue", p -> regexParametersHelper.build(parameters.get(VALUE_PARAMETER), true));
}
}
Aggregations