/** * Creates a {@link org.streampipes.model.output.CustomOutputStrategy}. Custom output strategies let pipeline * developers decide which events are produced by the corresponding pipeline element. * @return CustomOutputStrategy */ public static CustomOutputStrategy custom() { return new CustomOutputStrategy(); }
public CustomOutputStrategy(CustomOutputStrategy other) { super(other); this.eventProperties = new Cloner().properties(other.getEventProperties()); this.outputRight = other.isOutputRight(); }
private void updateOutputStrategy(SpDataStream stream, Integer count) { if (rdfRootElement instanceof DataProcessorInvocation) { ((DataProcessorInvocation) rdfRootElement) .getOutputStrategies() .stream() .filter(strategy -> strategy instanceof CustomOutputStrategy) .forEach(strategy -> { CustomOutputStrategy outputStrategy = (CustomOutputStrategy) strategy; if (count == 0) { outputStrategy.setProvidesProperties(new ArrayList<>()); } if (outputStrategy.isOutputRight() && count > 0) { outputStrategy.setProvidesProperties(stream.getEventSchema().getEventProperties()); } else { if (outputStrategy.getProvidesProperties() == null) { outputStrategy.setProvidesProperties(new ArrayList<>()); } outputStrategy.getProvidesProperties().addAll(stream.getEventSchema().getEventProperties()); } }); } }
public OutputSchemaGenerator<?> getOuputSchemaGenerator() { if (firstOutputStrategy instanceof AppendOutputStrategy) return new AppendOutputSchemaGenerator(((AppendOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof KeepOutputStrategy) return new RenameOutputSchemaGenerator((KeepOutputStrategy) firstOutputStrategy); else if (firstOutputStrategy instanceof FixedOutputStrategy) return new FixedOutputSchemaGenerator(((FixedOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof CustomOutputStrategy) return new CustomOutputSchemaGenerator(((CustomOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof ListOutputStrategy) return new ListOutputSchemaGenerator(((ListOutputStrategy) firstOutputStrategy).getPropertyName()); else if (firstOutputStrategy instanceof TransformOutputStrategy) { return new TransformOutputSchemaGenerator(dataProcessorInvocation, (TransformOutputStrategy) firstOutputStrategy); } else if (firstOutputStrategy instanceof CustomTransformOutputStrategy) { return new CustomTransformOutputSchemaGenerator(dataProcessorInvocation, (CustomTransformOutputStrategy) firstOutputStrategy); } else { throw new IllegalArgumentException(); } } }
private void updateOutputStrategy(SpDataStream stream, Integer count) { if (rdfRootElement instanceof DataProcessorInvocation) { ((DataProcessorInvocation) rdfRootElement) .getOutputStrategies() .stream() .filter(strategy -> strategy instanceof CustomOutputStrategy) .forEach(strategy -> { CustomOutputStrategy outputStrategy = (CustomOutputStrategy) strategy; if (count == 0) { outputStrategy.setProvidesProperties(new ArrayList<>()); } if (outputStrategy.isOutputRight() && count > 0) { outputStrategy.setProvidesProperties(stream.getEventSchema().getEventProperties()); } else { if (outputStrategy.getProvidesProperties() == null) { outputStrategy.setProvidesProperties(new ArrayList<>()); } outputStrategy.getProvidesProperties().addAll(stream.getEventSchema().getEventProperties()); } }); } }
public OutputSchemaGenerator<?> getOuputSchemaGenerator() { if (firstOutputStrategy instanceof AppendOutputStrategy) return new AppendOutputSchemaGenerator(((AppendOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof KeepOutputStrategy) return new RenameOutputSchemaGenerator((KeepOutputStrategy) firstOutputStrategy); else if (firstOutputStrategy instanceof FixedOutputStrategy) return new FixedOutputSchemaGenerator(((FixedOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof CustomOutputStrategy) return new CustomOutputSchemaGenerator(((CustomOutputStrategy) firstOutputStrategy).getEventProperties()); else if (firstOutputStrategy instanceof ListOutputStrategy) return new ListOutputSchemaGenerator(((ListOutputStrategy) firstOutputStrategy).getPropertyName()); else if (firstOutputStrategy instanceof TransformOutputStrategy) { return new TransformOutputSchemaGenerator(dataProcessorInvocation, (TransformOutputStrategy) firstOutputStrategy); } else if (firstOutputStrategy instanceof CustomTransformOutputStrategy) { return new CustomTransformOutputSchemaGenerator(dataProcessorInvocation, (CustomTransformOutputStrategy) firstOutputStrategy); } else { throw new IllegalArgumentException(); } } }
/** * Creates a {@link org.streampipes.model.output.CustomOutputStrategy}. * @param outputBoth If two input streams are expected by a pipeline element, you can use outputBoth to indicate * whether the properties of both input streams should be available to the pipeline developer for * selection. * @return CustomOutputStrategy */ public static CustomOutputStrategy custom(boolean outputBoth) { return new CustomOutputStrategy(outputBoth); }
public OutputStrategy outputStrategy(OutputStrategy other) { if (other instanceof KeepOutputStrategy) { return new KeepOutputStrategy((KeepOutputStrategy) other); } else if (other instanceof FixedOutputStrategy) { return new FixedOutputStrategy((FixedOutputStrategy) other); } else if (other instanceof ListOutputStrategy) { return new ListOutputStrategy((ListOutputStrategy) other); } else if (other instanceof CustomOutputStrategy) { return new CustomOutputStrategy((CustomOutputStrategy) other); } else if (other instanceof TransformOutputStrategy) { return new TransformOutputStrategy((TransformOutputStrategy) other); } else if (other instanceof CustomTransformOutputStrategy) { return new CustomTransformOutputStrategy((CustomTransformOutputStrategy) other); } else { return new AppendOutputStrategy((AppendOutputStrategy) other); } }