Search in sources :

Example 1 with DataShape

use of io.syndesis.common.model.DataShape in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method processTarget.

/**
 * Gets input data shape for specified step, which should follow after the mapping.
 *
 * @param followingStep
 * @return
 */
private DataSource processTarget(StepDefinition followingStep) {
    DataSource target = null;
    DataShape inDataShape = followingStep.getConnectorDescriptor().get().getInputDataShape().get();
    target = createDataSource(inDataShape, followingStep, DataSourceType.TARGET);
    return target;
}
Also used : DataShape(io.syndesis.common.model.DataShape) DataSource(io.atlasmap.v2.DataSource) JsonDataSource(io.atlasmap.json.v2.JsonDataSource) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource)

Example 2 with DataShape

use of io.syndesis.common.model.DataShape in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method getMapperStepAction.

public Action getMapperStepAction(ConnectorDescriptor outputConnectorDescriptor) {
    ObjectMapper mapper = new ObjectMapper().registerModules(new Jdk8Module());
    Action ts = new StepAction.Builder().descriptor(new StepDescriptor.Builder().build()).build();
    try {
        DataShape inputDataShape = new DataShape.Builder().kind(DataShapeKinds.ANY).name("All preceding outputs").build();
        JSONObject json = new JSONObject(mapper.writeValueAsString(ts));
        JSONObject inputDataType = new JSONObject(mapper.writeValueAsString(inputDataShape));
        JSONObject outputDataType = new JSONObject(mapper.writeValueAsString(outputConnectorDescriptor.getInputDataShape().get()));
        json.getJSONObject("descriptor").put("inputDataShape", inputDataType);
        json.getJSONObject("descriptor").put("outputDataShape", outputDataType);
        ts = Json.reader().forType(Action.class).readValue(json.toString());
        log.debug(mapper.writeValueAsString(ts));
    } catch (IOException ex) {
        log.error("Error: " + ex);
    }
    return ts;
}
Also used : Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) Action(io.syndesis.common.model.action.Action) StepAction(io.syndesis.common.model.action.StepAction) JSONObject(org.json.JSONObject) StepDescriptor(io.syndesis.common.model.action.StepDescriptor) IOException(java.io.IOException) DataShape(io.syndesis.common.model.DataShape) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with DataShape

use of io.syndesis.common.model.DataShape in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method processSources.

/**
 * Gets list of output data shapes for preceding steps.
 *
 * @param precedingSteps
 * @return
 */
private List<DataSource> processSources(List<StepDefinition> precedingSteps) {
    List<DataSource> sources = new ArrayList<>();
    for (StepDefinition s : precedingSteps) {
        DataShape outDataShape = s.getConnectorDescriptor().get().getOutputDataShape().get();
        sources.add(createDataSource(outDataShape, s, DataSourceType.SOURCE));
    }
    return sources;
}
Also used : ArrayList(java.util.ArrayList) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) DataShape(io.syndesis.common.model.DataShape) DataSource(io.atlasmap.v2.DataSource) JsonDataSource(io.atlasmap.json.v2.JsonDataSource) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource)

Aggregations

DataShape (io.syndesis.common.model.DataShape)3 JsonDataSource (io.atlasmap.json.v2.JsonDataSource)2 DataSource (io.atlasmap.v2.DataSource)2 XmlDataSource (io.atlasmap.xml.v2.XmlDataSource)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 Action (io.syndesis.common.model.action.Action)1 StepAction (io.syndesis.common.model.action.StepAction)1 StepDescriptor (io.syndesis.common.model.action.StepDescriptor)1 DataMapperStepDefinition (io.syndesis.qe.bdd.entities.DataMapperStepDefinition)1 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 JSONObject (org.json.JSONObject)1