use of org.talend.dataprep.transformation.api.action.DataSetRowAction in project data-prep by Talend.
the class MetadataChangesOnActionsGenerator method compileActionsOnMetadata.
/**
* Compile the given actions, hence updating the given row metadata and return the later.
*
* @param actions the actions to compile.
* @param startingRowMetadata the row metadata to start from.
* @return the updated row metadata from the actions compilation.
*/
private RowMetadata compileActionsOnMetadata(List<RunnableAction> actions, final RowMetadata startingRowMetadata) {
final RowMetadata updatedRowMetadata = startingRowMetadata.clone();
TransformationContext transformationContext = new TransformationContext();
// compile every action within the transformation context
for (RunnableAction action : actions) {
final DataSetRowAction rowAction = action.getRowAction();
final ActionContext actionContext = transformationContext.create(rowAction, updatedRowMetadata);
rowAction.compile(actionContext);
}
// the cleanup is REALLY important (as it can close http connection in case of a lookup for instance)
transformationContext.cleanup();
return updatedRowMetadata;
}
Aggregations