/** * Assigns a property scope to the event property. * @param propertyScope The {@link org.streampipes.model.schema.PropertyScope}. * @return this */ public PrimitivePropertyBuilder scope(PropertyScope propertyScope) { this.eventProperty.setPropertyScope(propertyScope.name()); return this; }
public EventProperty property(EventProperty o) { if (o instanceof EventPropertyPrimitive) { return new EventPropertyPrimitive((EventPropertyPrimitive) o); } else if (o instanceof EventPropertyList) { return new EventPropertyList((EventPropertyList) o); } else { return new EventPropertyNested((EventPropertyNested) o); } }
private boolean isAnyProperty(EventProperty eventProperty) { return eventProperty instanceof EventPropertyPrimitive && eventProperty.getDomainProperties() == null && ((EventPropertyPrimitive) eventProperty).getMeasurementUnit() == null && ((EventPropertyPrimitive) eventProperty).getRuntimeType() == null; }
public EventSchema generateSchema(EventSchema schemaRequirement, boolean minimumSchema) { EventSchema schema = new EventSchema(); for(EventProperty requiredProperty : schemaRequirement.getEventProperties()) { if (requiredProperty instanceof EventPropertyPrimitive) schema.addEventProperty(new EventPropertyPrimitive(((EventPropertyPrimitive) requiredProperty).getRuntimeType(), MonitoringUtils.randomKey(), "", requiredProperty.getDomainProperties())); //else if (requiredProperty instanceof EventPropertyNested) } return schema; }
public static EventPropertyPrimitive datatypeReq(String datatype) { EventPropertyPrimitive ep = new EventPropertyPrimitive(); ep.setRuntimeType(datatype); return ep; }
@Override public EventSchema buildFromOneStream(SpDataStream stream) { return new EventSchema(customProperties); }
public EventSchema build() { schema.setEventProperties(properties); return schema; }
public ValueSpecification valueSpecification(ValueSpecification o) { if (o instanceof QuantitativeValue) { return new QuantitativeValue((QuantitativeValue) o); } else { return new Enumeration((Enumeration) o); } }
/** * Defines the value range. The data type of the event property must be a number. * @param min The minimum value the property can have at runtime. * @param max The maximum value the property can have at runtime. * @param step The expected granularity the property has at runtime. * @return this */ public PrimitivePropertyBuilder valueSpecification(Float min, Float max, Float step) { this.eventProperty.setValueSpecification(new QuantitativeValue(min, max, step)); return this; }
/** * Defines the value range in form of an enumeration. The data type of the event property must be of type String * or Number. * @param label A human-readable label describing this enumeration. * @param description A human-readable description of the enumeration. * @param allowedValues A list of allowed values of the event property at runtime. * @return this */ public PrimitivePropertyBuilder valueSpecification(String label, String description, List<String> allowedValues) { this.eventProperty.setValueSpecification(new Enumeration(label, description, allowedValues)); return this; }
public QuantitativeValue(QuantitativeValue other) { super(other); this.minValue = other.getMinValue(); this.maxValue = other.getMaxValue(); this.step = other.getStep(); }
public Enumeration(Enumeration other) { super(other); this.label = other.getLabel(); this.description = other.getDescription(); this.runtimeValues = other.getRuntimeValues(); }
private static Enumeration from(List<String> values) { Enumeration enumeration = new Enumeration(); enumeration.setRuntimeValues(values); return enumeration; }
/** * Defines the measurement unit (e.g., tons) of the event property. * @param measurementUnit The measurement unit as a URI from a vocabulary (e.g., QUDT). * @return */ public PrimitivePropertyBuilder measurementUnit(URI measurementUnit) { this.eventProperty.setMeasurementUnit(measurementUnit); return this; }
/** * Assigns a human-readable label to the event property. The label is used in the StreamPipes UI for better * explaining users the meaning of the property. * @param label * @return this */ public PrimitivePropertyBuilder label(String label) { this.eventProperty.setLabel(label); return this; }
public EventPropertyList(String propertyName, EventProperty eventProperty, List<URI> domainProperties) { super(propertyName); this.eventProperty = eventProperty; this.setDomainProperties(domainProperties); }
/** * Assigns a human-readable description to the event property. The description is used in the StreamPipes UI for * better explaining users the meaning of the property. * @param description * @return this */ public PrimitivePropertyBuilder description(String description) { this.eventProperty.setDescription(description); return this; }
public EventSchema generateSchema(EventSchema schemaRequirement, boolean minimumSchema) { EventSchema schema = new EventSchema(); for(EventProperty requiredProperty : schemaRequirement.getEventProperties()) { if (requiredProperty instanceof EventPropertyPrimitive) schema.addEventProperty(new EventPropertyPrimitive(((EventPropertyPrimitive) requiredProperty).getRuntimeType(), MonitoringUtils.randomKey(), "", requiredProperty.getDomainProperties())); //else if (requiredProperty instanceof EventPropertyNested) } return schema; }
private boolean isAnyProperty(EventProperty eventProperty) { return eventProperty instanceof EventPropertyPrimitive && eventProperty.getDomainProperties() == null && ((EventPropertyPrimitive) eventProperty).getMeasurementUnit() == null && ((EventPropertyPrimitive) eventProperty).getRuntimeType() == null; }
public PrimitivePropertyBuilder label(String label) { primitive.setLabel(label); return this; }