/** * Creates a {@link org.streampipes.model.output.KeepOutputStrategy}. Keep output strategies do not change the * schema of an input event, i.e., the output schema matches the input schema. * @return KeepOutputStrategy */ public static KeepOutputStrategy keep() { return new KeepOutputStrategy(); }
public KeepOutputStrategy(KeepOutputStrategy other) { super(other); this.eventName = other.getEventName(); this.keepBoth = other.isKeepBoth(); }
@Override public EventSchema buildFromTwoStreams(SpDataStream stream1, SpDataStream stream2) { EventSchema resultSchema = new EventSchema(); List<EventProperty> properties = new ArrayList<>(); properties.addAll(stream1.getEventSchema().getEventProperties()); if (strategy.isKeepBoth()) { properties.addAll(new PropertyDuplicateRemover(properties, stream2.getEventSchema().getEventProperties()).rename()); } resultSchema.setEventProperties(properties); return resultSchema; }
@Override public EventSchema buildFromTwoStreams(SpDataStream stream1, SpDataStream stream2) { EventSchema resultSchema = new EventSchema(); List<EventProperty> properties = new ArrayList<>(); properties.addAll(stream1.getEventSchema().getEventProperties()); if (strategy.isKeepBoth()) { properties.addAll(new PropertyDuplicateRemover(properties, stream2.getEventSchema().getEventProperties()).rename()); } resultSchema.setEventProperties(properties); return resultSchema; }
public static KeepOutputStrategy keep(boolean mergeInputStreams) { return new KeepOutputStrategy("Rename", mergeInputStreams); }
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); } }