use of org.talend.dataprep.api.action.ActionDefinition in project data-prep by Talend.
the class DeleteTest method should_adapt_to_line_scope.
@Test
public void should_adapt_to_line_scope() {
// when
final ActionDefinition adaptedAction = action.adapt(LINE);
// then
assertThat(adaptedAction.getDescription(Locale.US), is("Delete this row"));
assertThat(adaptedAction.getLabel(Locale.US), is("Delete row"));
assertThat(adaptedAction, not(is(action)));
}
use of org.talend.dataprep.api.action.ActionDefinition in project data-prep by Talend.
the class DeleteTest method should_adapt_to_column_scope.
@Test
public void should_adapt_to_column_scope() {
// when
final ActionDefinition adaptedAction = action.adapt(COLUMN);
// then
assertThat(adaptedAction.getDescription(Locale.US), is("Delete this column"));
assertThat(adaptedAction.getLabel(Locale.US), is("Delete column"));
}
use of org.talend.dataprep.api.action.ActionDefinition 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