Search in sources :

Example 1 with Visitor

use of org.talend.dataprep.transformation.pipeline.Visitor in project data-prep by Talend.

the class UpdatedStepVisitor method visitStepNode.

@Override
public void visitStepNode(StepNode stepNode) {
    stepNode.getEntryNode().accept(new Visitor() {

        @Override
        public void visitAction(ActionNode actionNode) {
            final ActionContext.ActionStatus status = actionNode.getActionContext().getActionStatus();
            final Step step = stepNode.getStep();
            switch(status) {
                case NOT_EXECUTED:
                case CANCELED:
                    LOGGER.debug("Not updating metadata for {} (action ended with status {}).", step.getId(), status);
                    step.setRowMetadata(null);
                    break;
                case OK:
                case DONE:
                    LOGGER.debug("Keeping metadata {} (action ended with status {}).", step.getId(), status);
                    break;
            }
            preparationUpdater.update(step.id(), actionNode.getActionContext().getRowMetadata());
        }
    });
    super.visitStepNode(stepNode);
}
Also used : Visitor(org.talend.dataprep.transformation.pipeline.Visitor) ActionNode(org.talend.dataprep.transformation.pipeline.node.ActionNode) Step(org.talend.dataprep.api.preparation.Step)

Aggregations

Step (org.talend.dataprep.api.preparation.Step)1 Visitor (org.talend.dataprep.transformation.pipeline.Visitor)1 ActionNode (org.talend.dataprep.transformation.pipeline.node.ActionNode)1