Search in sources :

Example 1 with DataMapperDefinition

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();
}
Also used : Connector(io.syndesis.common.model.connection.Connector) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) Action(io.syndesis.common.model.action.Action) DataMapperDefinition(io.syndesis.qe.entities.DataMapperDefinition) Connection(io.syndesis.common.model.connection.Connection) StepDefinition(io.syndesis.qe.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) StepKind(io.syndesis.common.model.integration.StepKind)

Aggregations

Action (io.syndesis.common.model.action.Action)1 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)1 Connection (io.syndesis.common.model.connection.Connection)1 Connector (io.syndesis.common.model.connection.Connector)1 Step (io.syndesis.common.model.integration.Step)1 StepKind (io.syndesis.common.model.integration.StepKind)1 DataMapperDefinition (io.syndesis.qe.entities.DataMapperDefinition)1 StepDefinition (io.syndesis.qe.entities.StepDefinition)1