use of org.talend.dataprep.transformation.api.action.context.TransformationContext in project data-prep by Talend.
the class ReplaceCellValueTest method getActionContext.
@SafeVarargs
private final ActionContext getActionContext(SimpleEntry<String, String>... entries) {
Map<String, String> parameters = new HashMap<>();
for (SimpleEntry<String, String> entry : entries) {
parameters.put(entry.getKey(), entry.getValue());
}
ActionContext context = new ActionContext(new TransformationContext());
context.setParameters(parameters);
return context;
}
use of org.talend.dataprep.transformation.api.action.context.TransformationContext in project data-prep by Talend.
the class TransformationService method applyActionsOnMetadata.
private void applyActionsOnMetadata(RowMetadata metadata, String actionsAsJson) {
List<RunnableAction> actions = actionParser.parse(actionsAsJson);
TransformationContext transformationContext = new TransformationContext();
try {
for (RunnableAction action : actions) {
final ActionContext actionContext = transformationContext.create(action.getRowAction(), metadata);
action.getRowAction().compile(actionContext);
}
} finally {
// cleanup the transformation context is REALLY important as it can close open http connections
transformationContext.cleanup();
}
}
Aggregations