use of io.syndesis.qe.bdd.entities.StepDefinition 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)));
}
}
use of io.syndesis.qe.bdd.entities.StepDefinition 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;
}
use of io.syndesis.qe.bdd.entities.StepDefinition in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method generateCombineMapping.
private Mapping generateCombineMapping(DataMapperStepDefinition mappingDef, List<StepDefinition> precedingSteps, StepDefinition followingStep) {
StepDefinition fromStep = precedingSteps.get(mappingDef.getFromStep() - 1);
Mapping generatedMapping = new Mapping();
generatedMapping.setId(UUID.randomUUID().toString());
generatedMapping.setMappingType(MappingType.COMBINE);
generatedMapping.setDelimiter(mappingDef.getStrategy().name());
List<Field> in = new ArrayList<>();
for (int i = 0; i < mappingDef.getInputFields().size(); i++) {
String def = mappingDef.getInputFields().get(i);
Field inField = fromStep.getInspectionResponseFields().get().stream().filter(f -> f.getPath().matches(def)).findFirst().get();
inField.setIndex(i);
in.add(inField);
}
Field out = followingStep.getInspectionResponseFields().get().stream().filter(f -> f.getPath().matches(mappingDef.getOutputFields().get(0))).findFirst().get();
in.forEach(f -> f.setDocId(fromStep.getStep().getId().get()));
out.setDocId(followingStep.getStep().getId().get());
generatedMapping.getInputField().addAll(in);
generatedMapping.getOutputField().add(out);
return generatedMapping;
}
Aggregations