use of io.syndesis.qe.entities.DataMapperDefinition in project syndesis-qe by syndesisio.
the class AbstractStep method createStep.
public void createStep() {
// Some steps do not have connector / connection
Connector connector = properties.get(StepProperty.CONNECTOR_ID) == null ? null : connectorsEndpoint.get((String) properties.get(StepProperty.CONNECTOR_ID));
Connection connection = properties.get(StepProperty.CONNECTION_ID) == null ? null : connectionsEndpoint.get((String) properties.get(StepProperty.CONNECTION_ID));
Action action;
// If the action is not String, then we already have action object, so just use it
if (properties.get(StepProperty.ACTION) != null && !(properties.get(StepProperty.ACTION) instanceof String)) {
action = (Action) properties.get(StepProperty.ACTION);
} else {
// It may not have an action
action = properties.get(StepProperty.ACTION) == null ? null : findConnectorAction(connector, (String) properties.get(StepProperty.ACTION));
if (action != null) {
// Get the action with datashapes configured
action = generateStepAction(action, getConnectorDescriptor(action, (Map) properties.get(StepProperty.PROPERTIES), (String) properties.get(StepProperty.CONNECTION_ID)));
}
}
final Step.Builder stepBuilder = new Step.Builder();
stepBuilder.stepKind(properties.get(StepProperty.KIND) == null ? StepKind.endpoint : (StepKind) properties.get(StepProperty.KIND));
stepBuilder.id(properties.get(StepProperty.STEP_ID) == null ? UUID.randomUUID().toString() : (String) properties.get(StepProperty.STEP_ID));
stepBuilder.name(properties.get(StepProperty.STEP_NAME) == null ? UUID.randomUUID().toString() : (String) properties.get(StepProperty.STEP_NAME));
if (connection != null) {
stepBuilder.connection(connection);
}
if (action != null) {
stepBuilder.action(action);
}
if (properties.get(StepProperty.PROPERTIES) != null) {
stepBuilder.configuredProperties((Map) properties.get(StepProperty.PROPERTIES));
}
if (properties.get(StepProperty.EXTENSION) != null) {
stepBuilder.extension((Extension) properties.get(StepProperty.EXTENSION));
}
if (properties.get(StepProperty.KIND) == StepKind.mapper) {
steps.getStepDefinitions().add(new StepDefinition(stepBuilder.build(), new DataMapperDefinition()));
} else {
steps.getStepDefinitions().add(new StepDefinition(stepBuilder.build()));
}
properties.clear();
}
Aggregations