use of org.talend.dataprep.transformation.actions.common.RunnableAction 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();
}
}
use of org.talend.dataprep.transformation.actions.common.RunnableAction in project data-prep by Talend.
the class PreparationService method buildActions.
/**
* Given a list of actions recreate but with the Spring Context {@link ActionDefinition}. It is mandatory to use any
* action parsed from JSON.
*/
private List<RunnableAction> buildActions(List<Action> allActions) {
final List<RunnableAction> builtActions = new ArrayList<>(allActions.size() + 1);
for (Action parsedAction : allActions) {
if (parsedAction != null && parsedAction.getName() != null) {
String actionNameLowerCase = parsedAction.getName().toLowerCase();
final ActionDefinition metadata = actionRegistry.get(actionNameLowerCase);
builtActions.add(factory.create(metadata, parsedAction.getParameters()));
}
}
return builtActions;
}
Aggregations