use of org.talend.dataprep.api.preparation.StepDiff in project data-prep by Talend.
the class TransformationService method getCreatedColumns.
/**
* Compare the results of 2 sets of actions, and return the diff metadata Ex : the created columns ids
*/
private StepDiff getCreatedColumns(final PreviewParameters previewParameters) {
final DataSetGetMetadata dataSetGetMetadata = context.getBean(DataSetGetMetadata.class, previewParameters.getDataSetId());
DataSetMetadata dataSetMetadata = dataSetGetMetadata.execute();
StepDiff stepDiff;
if (dataSetGetMetadata.isSuccessfulExecution() && dataSetMetadata != null) {
RowMetadata metadataBase = dataSetMetadata.getRowMetadata();
RowMetadata metadataAfter = metadataBase.clone();
applyActionsOnMetadata(metadataBase, previewParameters.getBaseActions());
applyActionsOnMetadata(metadataAfter, previewParameters.getNewActions());
metadataAfter.diff(metadataBase);
List<String> createdColumnIds = metadataAfter.getColumns().stream().filter(c -> Flag.NEW.getValue().equals(c.getDiffFlagValue())).map(ColumnMetadata::getId).collect(Collectors.toList());
stepDiff = new StepDiff();
stepDiff.setCreatedColumns(createdColumnIds);
} else {
stepDiff = null;
// maybe throw an exception...
}
return stepDiff;
}
use of org.talend.dataprep.api.preparation.StepDiff in project data-prep by Talend.
the class EntityBuilder method diff.
public static StepDiff diff(String... createdColumns) {
StepDiff stepDiff = new StepDiff();
stepDiff.setCreatedColumns(Arrays.asList(createdColumns));
return stepDiff;
}
Aggregations