/** * Adds a new {@link org.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition * which is not linked to a specific input property. * @deprecated Use {@link #unaryMappingPropertyWithoutRequirement(Label)} instead. * Use this method if you want to present users a single-value selection of all available input * event properties. * @param label A human-readable label * @return this */ public BU unaryMappingPropertyWithoutRequirement(String internalName, String label, String description) { this.staticProperties.add(new MappingPropertyUnary(internalName, label, description)); return me(); }
public MappingPropertyUnary(MappingPropertyUnary other) { super(other); this.mapsTo = other.getMapsTo(); }
private URI getURIFromStaticProperty(String staticPropertyName) { Optional<MappingPropertyUnary> property = sepaElement.getStaticProperties().stream() .filter(p -> p instanceof MappingPropertyUnary) .map((p -> (MappingPropertyUnary) p)) .filter(p -> p.getInternalName().equals(staticPropertyName)) .findFirst(); return property.map(MappingPropertyUnary::getMapsTo).orElse(null); //TODO: exceptions } }
/** * Set a new event property requirement linked to a unary mapping. * @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead */ @Deprecated public BU requiredPropertyStream1WithUnaryMapping(EventProperty propertyRequirement, Label label, PropertyScope propertyScope) { this.stream1Properties.add(propertyRequirement); MappingPropertyUnary mp = new MappingPropertyUnary(URI.create(propertyRequirement.getElementId()), label.getInternalId(), label.getLabel(), label.getDescription()); mp.setPropertyScope(propertyScope.name()); this.staticProperties.add(mp); return me(); }
private List<StaticProperty> collectStaticProperties(Pipeline pipeline) { List<StaticProperty> staticProperties = new ArrayList<>(); pipeline.getSepas().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); pipeline.getActions().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); staticProperties .stream() .filter(sp -> sp instanceof MappingPropertyUnary) .forEach(mp -> ((MappingPropertyUnary) mp) .setMapsTo(URI.create(((MappingPropertyUnary) mp) .getMapsFromOptions() .get(0) .getElementId()))); return staticProperties; }
/** * Sets a new property requirement and, in addition, adds a * {@link org.streampipes.model.staticproperty.MappingPropertyUnary} static property to the pipeline element * definition. * @param propertyRequirement The property requirement. Use {@link org.streampipes.sdk.helpers.EpRequirements} to * create a new requirement. * @param label The {@link org.streampipes.sdk.helpers.Label} that defines the mapping property. * @param propertyScope The {@link org.streampipes.model.schema.PropertyScope} of the requirement. * @return this */ public StreamRequirementsBuilder requiredPropertyWithUnaryMapping(EventProperty propertyRequirement, Label label, PropertyScope propertyScope) { this.eventProperties.add(propertyRequirement); MappingPropertyUnary mp = new MappingPropertyUnary(URI.create(propertyRequirement.getElementId()), label .getInternalId(), label.getLabel(), label.getDescription()); mp.setPropertyScope(propertyScope.name()); this.mappingProperties.add(mp); return this; }
private List<StaticProperty> collectStaticProperties(Pipeline pipeline) { List<StaticProperty> staticProperties = new ArrayList<>(); pipeline.getSepas().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); pipeline.getActions().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); staticProperties .stream() .filter(sp -> sp instanceof MappingPropertyUnary) .forEach(mp -> ((MappingPropertyUnary) mp) .setMapsTo(URI.create(((MappingPropertyUnary) mp) .getMapsFromOptions() .get(0) .getElementId()))); return staticProperties; }
/** * Adds a new {@link org.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition * which is not linked to a specific input property. * @deprecated * Use this method if you want to present users a single-value selection of all available input * event properties. * @param label A human-readable label that is displayed to users in the StreamPipes UI. * @param propertyScope Only input event properties that match the * {@link org.streampipes.model.schema.PropertyScope} are displayed. * @return this */ public BU unaryMappingPropertyWithoutRequirement(Label label, PropertyScope propertyScope) { MappingPropertyUnary mp = new MappingPropertyUnary(label.getInternalId(), label.getLabel(), label.getDescription()); mp.setPropertyScope(propertyScope.name()); this.staticProperties.add(mp); return me(); }
/** * * @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead */ @Deprecated public BU requiredPropertyStream2WithUnaryMapping(EventProperty propertyRequirement, String internalName, String label, String description) { this.stream2Properties.add(propertyRequirement); this.staticProperties.add(new MappingPropertyUnary(URI.create(propertyRequirement.getElementId()), internalName, label, description)); return me(); }
private Optional<EventProperty> findEventProperty(List<EventProperty> eventProperties, List<StaticProperty> staticProperties, String linkedMappingPropertyId) { Optional<MappingPropertyUnary> mappingProperty = staticProperties .stream() .filter(sp -> sp.getInternalName().equals(linkedMappingPropertyId)) .map(sp -> (MappingPropertyUnary) sp) .findFirst(); if (mappingProperty.isPresent()) { return eventProperties .stream() .filter(ep -> ep.getElementId().equals(mappingProperty.get().getMapsTo().toString())) .findFirst(); } else { return Optional.empty(); } }
/** * * @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead */ @Deprecated public BU requiredPropertyStream1WithUnaryMapping(EventProperty propertyRequirement, String internalName, String label, String description) { this.stream1Properties.add(propertyRequirement); this.staticProperties.add(new MappingPropertyUnary(URI.create(propertyRequirement.getElementId()), internalName, label, description)); return me(); }
private Optional<EventProperty> findEventProperty(List<EventProperty> eventProperties, List<StaticProperty> staticProperties, String linkedMappingPropertyId) { Optional<MappingPropertyUnary> mappingProperty = staticProperties .stream() .filter(sp -> sp.getInternalName().equals(linkedMappingPropertyId)) .map(sp -> (MappingPropertyUnary) sp) .findFirst(); if (mappingProperty.isPresent()) { return eventProperties .stream() .filter(ep -> ep.getElementId().equals(mappingProperty.get().getMapsTo().toString())) .findFirst(); } else { return Optional.empty(); } }
public BU unaryMappingProperty(StreamIdentifier streamIdentifier, Integer propertyIndex, Label label) { EventProperty propertyRequirement; // TODO we need proper exception handling for the sdk if (streamIdentifier == StreamIdentifier.Stream0) { propertyRequirement = this.stream1Properties.get(propertyIndex); } else { propertyRequirement = this.stream2Properties.get(propertyIndex); } this.staticProperties.add(new MappingPropertyUnary(URI.create(propertyRequirement.getElementId()), label .getInternalId(), label.getLabel(), label.getDescription())); return me(); }
Optional<EventProperty> eventPropertyOpt = findEventProperty(mappingPropertyOpt.get().getMapsTo(), inSchema .getEventProperties());
/** * Adds a new {@link org.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition * which is not linked to a specific input property. * @deprecated * Use this method if you want to present users a single-value selection of all available input * event properties. * @param label * @return this */ public BU unaryMappingPropertyWithoutRequirement(Label label) { this.staticProperties.add(new MappingPropertyUnary(label.getInternalId(), label.getLabel(), label.getDescription())); return me(); }
Optional<EventProperty> eventPropertyOpt = findEventProperty(mappingPropertyOpt.get().getMapsTo(), inSchema .getEventProperties());
public StaticProperty staticProperty(StaticProperty o) { if (o instanceof FreeTextStaticProperty) { return new FreeTextStaticProperty((FreeTextStaticProperty) o); } else if (o instanceof OneOfStaticProperty) { return new OneOfStaticProperty((OneOfStaticProperty) o); } else if (o instanceof RemoteOneOfStaticProperty) { return new RemoteOneOfStaticProperty((RemoteOneOfStaticProperty) o); } else if (o instanceof MappingPropertyNary) { return new MappingPropertyNary((MappingPropertyNary) o); } else if (o instanceof DomainStaticProperty) { return new DomainStaticProperty((DomainStaticProperty) o); } else if (o instanceof AnyStaticProperty) { return new AnyStaticProperty((AnyStaticProperty) o); } else if (o instanceof CollectionStaticProperty) { return new CollectionStaticProperty((CollectionStaticProperty) o); } else if (o instanceof MatchingStaticProperty) { return new MatchingStaticProperty((MatchingStaticProperty) o); } else if (o instanceof RuntimeResolvableOneOfStaticProperty) { return new RuntimeResolvableOneOfStaticProperty((RuntimeResolvableOneOfStaticProperty) o); } else if (o instanceof RuntimeResolvableAnyStaticProperty) { return new RuntimeResolvableAnyStaticProperty((RuntimeResolvableAnyStaticProperty) o); } else { return new MappingPropertyUnary((MappingPropertyUnary) o); } }