Search in sources :

Example 1 with DataShapeKinds

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

the class AtlasMapperGenerator method processPrecedingSteps.

/**
 * Using output datashape, generates jsonInspectionResponse for steps preceding atlasMapping we want to generate. In
 * case, the specification is of JavaClass-type, is only transforms this scpecification into required Field listing.
 * The jsonInspectionResponse is stored in StepDefinition.
 */
private void processPrecedingSteps() {
    precedingSteps.stream().filter(s -> s.getStep().getAction().isPresent()).forEach(s -> {
        String stepSpecification = s.getStep().getAction().get().getOutputDataShape().get().getSpecification();
        DataShapeKinds dsKind = s.getStep().getAction().get().getOutputDataShape().get().getKind();
        s.setInspectionResponseFields(processDataShapeIntoFields(stepSpecification, dsKind));
    });
}
Also used : JsonInspectionResponse(io.atlasmap.json.v2.JsonInspectionResponse) Action(io.syndesis.common.model.action.Action) Step(io.syndesis.common.model.integration.Step) XmlComplexType(io.atlasmap.xml.v2.XmlComplexType) DataSource(io.atlasmap.v2.DataSource) Autowired(org.springframework.beans.factory.annotation.Autowired) MappingType(io.atlasmap.v2.MappingType) DataMapperStepDefinition(io.syndesis.qe.entities.DataMapperStepDefinition) JsonDataSource(io.atlasmap.json.v2.JsonDataSource) StringUtils(org.apache.commons.lang3.StringUtils) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ArrayList(java.util.ArrayList) JSONObject(org.json.JSONObject) StepDescriptor(io.syndesis.common.model.action.StepDescriptor) JsonUtils(io.syndesis.common.util.json.JsonUtils) Field(io.atlasmap.v2.Field) XmlInspectionResponse(io.atlasmap.xml.v2.XmlInspectionResponse) StepKind(io.syndesis.common.model.integration.StepKind) JavaClass(io.atlasmap.java.v2.JavaClass) StepDefinition(io.syndesis.qe.entities.StepDefinition) BaseMapping(io.atlasmap.v2.BaseMapping) LookupTables(io.atlasmap.v2.LookupTables) DataShape(io.syndesis.common.model.DataShape) StepAction(io.syndesis.common.model.action.StepAction) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AtlasmapEndpoint(io.syndesis.qe.endpoint.AtlasmapEndpoint) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) DataShapeKinds(io.syndesis.common.model.DataShapeKinds) Properties(io.atlasmap.v2.Properties) DataSourceType(io.atlasmap.v2.DataSourceType) Mapping(io.atlasmap.v2.Mapping) Component(org.springframework.stereotype.Component) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Assertions.fail(org.assertj.core.api.Assertions.fail) TestUtils(io.syndesis.qe.utils.TestUtils) XmlNamespaces(io.atlasmap.xml.v2.XmlNamespaces) AtlasMapping(io.atlasmap.v2.AtlasMapping) JavaField(io.atlasmap.java.v2.JavaField) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) Mappings(io.atlasmap.v2.Mappings) Collections(java.util.Collections) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource) JsonComplexType(io.atlasmap.json.v2.JsonComplexType) DataShapeKinds(io.syndesis.common.model.DataShapeKinds)

Example 2 with DataShapeKinds

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

the class AtlasMapperGenerator method processFolowingStep.

/**
 * Using input datashape, generates jsonInspectionResponse for step following after atlasMapping we want to
 * generate. The jsonInspectionResponse is stored in StepDefinition.
 *
 * @param followingStep
 */
private void processFolowingStep(StepDefinition followingStep) {
    String stepSpecification = followingStep.getConnectorDescriptor().get().getInputDataShape().get().getSpecification();
    DataShapeKinds dsKind = followingStep.getConnectorDescriptor().get().getInputDataShape().get().getKind();
    followingStep.setInspectionResponseFields(Optional.ofNullable(processDataShapeIntoFields(stepSpecification, dsKind)));
}
Also used : DataShapeKinds(io.syndesis.common.model.DataShapeKinds)

Example 3 with DataShapeKinds

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

the class AtlasMapperGenerator method processPrecedingSteps.

/**
 * Using output datashape, generates jsonInspectionResponse for steps preceding atlasMapping we want to generate. In
 * case, the specification is of JavaClass-type, is only transforms this scpecification into required Field listing.
 * The jsonInspectionResponse is stored in StepDefinition.
 *
 * @param precedingSteps
 */
private void processPrecedingSteps(List<StepDefinition> precedingSteps) {
    for (StepDefinition s : precedingSteps) {
        String stepSpecification = s.getConnectorDescriptor().get().getOutputDataShape().get().getSpecification();
        DataShapeKinds dsKind = s.getConnectorDescriptor().get().getOutputDataShape().get().getKind();
        s.setInspectionResponseFields(Optional.ofNullable(processDataShapeIntoFields(stepSpecification, dsKind)));
    }
}
Also used : DataShapeKinds(io.syndesis.common.model.DataShapeKinds) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition)

Example 4 with DataShapeKinds

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

the class AtlasMapperGenerator method createDataSource.

/**
 * Used to generate data source elements for atlasMapping. There are three types of them: Java, Json, XML.
 *
 * TODO(tplevko): update also for XML
 *
 * @param dataShape
 * @param step
 * @param dataSourceType
 * @return
 */
private DataSource createDataSource(DataShape dataShape, StepDefinition step, DataSourceType dataSourceType) {
    DataShapeKinds dataShapeKind = dataShape.getKind();
    DataSource source = null;
    if (dataShapeKind.toString().contains("json")) {
        source = new JsonDataSource();
        source.setUri("atlas:" + "json:" + step.getStep().getId().get());
    } else if (dataShapeKind.toString().contains("java")) {
        source = new DataSource();
        source.setUri("atlas:" + "java:" + step.getStep().getId().get() + "?className=" + dataShape.getType());
    } else if (dataShapeKind.toString().contains("xml")) {
        source = new XmlDataSource();
    // TODO(tplevko): find out how should look the XML datasource definition
    }
    source.setId(step.getStep().getId().get());
    source.setDataSourceType(dataSourceType);
    return source;
}
Also used : JsonDataSource(io.atlasmap.json.v2.JsonDataSource) DataShapeKinds(io.syndesis.common.model.DataShapeKinds) DataSource(io.atlasmap.v2.DataSource) JsonDataSource(io.atlasmap.json.v2.JsonDataSource) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource)

Example 5 with DataShapeKinds

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

the class AtlasMapperGenerator method processFollowingStep.

/**
 * Using input datashape, generates jsonInspectionResponse for step following after atlasMapping we want to
 * generate. The jsonInspectionResponse is stored in StepDefinition.
 */
private void processFollowingStep() {
    String stepSpecification = followingStep.getStep().getAction().get().getInputDataShape().get().getSpecification();
    DataShapeKinds dsKind = followingStep.getStep().getAction().get().getInputDataShape().get().getKind();
    followingStep.setInspectionResponseFields(processDataShapeIntoFields(stepSpecification, dsKind));
}
Also used : DataShapeKinds(io.syndesis.common.model.DataShapeKinds)

Aggregations

DataShapeKinds (io.syndesis.common.model.DataShapeKinds)6 JsonDataSource (io.atlasmap.json.v2.JsonDataSource)3 DataSource (io.atlasmap.v2.DataSource)3 XmlDataSource (io.atlasmap.xml.v2.XmlDataSource)3 XmlNamespaces (io.atlasmap.xml.v2.XmlNamespaces)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 JavaClass (io.atlasmap.java.v2.JavaClass)1 JavaField (io.atlasmap.java.v2.JavaField)1 JsonComplexType (io.atlasmap.json.v2.JsonComplexType)1 JsonInspectionResponse (io.atlasmap.json.v2.JsonInspectionResponse)1 AtlasMapping (io.atlasmap.v2.AtlasMapping)1 BaseMapping (io.atlasmap.v2.BaseMapping)1 DataSourceType (io.atlasmap.v2.DataSourceType)1 Field (io.atlasmap.v2.Field)1 LookupTables (io.atlasmap.v2.LookupTables)1 Mapping (io.atlasmap.v2.Mapping)1