Search in sources :

Example 6 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project polymap4-core by Polymap4.

the class StyleCompositeSerializer method handle.

protected <V> Iterable<RuleModifier<V, S>> handle(Property<StylePropertyValue<V>> prop) {
    StylePropertyValue<V> styleProp = prop.get();
    // no value -> nothing to modify
    if (styleProp == null || styleProp instanceof NoValue) {
        return singletonList(new NoValueRuleModifier());
    } else // ConstantValue
    if (styleProp instanceof ConstantValue) {
        Expression expr = ff.literal(((ConstantValue) styleProp).value());
        return singletonList(new SimpleRuleModifier(expr));
    } else // AttributeValue
    if (styleProp instanceof AttributeValue) {
        String attributeName = (String) ((AttributeValue) styleProp).attributeName.get();
        Expression expr = ff.property(attributeName);
        return singletonList(new SimpleRuleModifier(expr));
    } else // FilterMappedValues
    if (styleProp instanceof FilterMappedValues) {
        List<Mapped<Filter, Object>> values = ((FilterMappedValues) styleProp).values();
        return FluentIterable.from(values).transform(mapped -> new SimpleRuleModifier(ff.literal(mapped.value()), mapped.key()));
    } else // ScaleMappedValues
    if (styleProp instanceof ScaleMappedValues) {
        List<Mapped<ScaleRange, Object>> values = ((ScaleMappedValues) styleProp).values();
        return FluentIterable.from(values).transform(mapped -> new SimpleRuleModifier(ff.literal(mapped.value()), mapped.key().min.get(), mapped.key().max.get()));
    } else {
        throw new RuntimeException("Unhandled StylePropertyValue type: " + styleProp.getClass().getSimpleName());
    }
}
Also used : Mapped(org.polymap.core.style.model.feature.MappedValues.Mapped) Configurable(org.polymap.core.runtime.config.Configurable) StylePropertyValue(org.polymap.core.style.model.StylePropertyValue) ScaleRangeFilter(org.polymap.core.style.model.feature.ScaleRangeFilter) Mandatory(org.polymap.core.runtime.config.Mandatory) StyleComposite(org.polymap.core.style.model.StyleComposite) Function(java.util.function.Function) StyleFactory(org.geotools.styling.StyleFactory) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) Style(org.polymap.core.style.model.Style) ScaleMappedValues(org.polymap.core.style.model.feature.ScaleMappedValues) Config2(org.polymap.core.runtime.config.Config2) FluentIterable(com.google.common.collect.FluentIterable) FilterFactory2(org.opengis.filter.FilterFactory2) ConstantValue(org.polymap.core.style.model.feature.ConstantValue) FilterMappedValues(org.polymap.core.style.model.feature.FilterMappedValues) ScaleRange(org.polymap.core.style.model.feature.ScaleMappedValues.ScaleRange) Symbolizer(org.geotools.styling.Symbolizer) Cloner(com.rits.cloning.Cloner) ConstantFilter(org.polymap.core.style.model.feature.ConstantFilter) Property(org.polymap.model2.Property) Expression(org.opengis.filter.expression.Expression) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) List(java.util.List) NoValue(org.polymap.core.style.model.feature.NoValue) Rule(org.geotools.styling.Rule) AttributeValue(org.polymap.core.style.model.feature.AttributeValue) Filter(org.opengis.filter.Filter) Log(org.apache.commons.logging.Log) LogFactory(org.apache.commons.logging.LogFactory) Context(org.polymap.core.style.serialize.FeatureStyleSerializer.Context) FilterStyleProperty(org.polymap.core.style.model.feature.FilterStyleProperty) AttributeValue(org.polymap.core.style.model.feature.AttributeValue) Mapped(org.polymap.core.style.model.feature.MappedValues.Mapped) ScaleMappedValues(org.polymap.core.style.model.feature.ScaleMappedValues) NoValue(org.polymap.core.style.model.feature.NoValue) Expression(org.opengis.filter.expression.Expression) ScaleRangeFilter(org.polymap.core.style.model.feature.ScaleRangeFilter) ConstantFilter(org.polymap.core.style.model.feature.ConstantFilter) Filter(org.opengis.filter.Filter) FilterMappedValues(org.polymap.core.style.model.feature.FilterMappedValues) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) List(java.util.List) ConstantValue(org.polymap.core.style.model.feature.ConstantValue)

Example 7 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.

the class AtlasTestData method generateAtlasProperties.

public static List<Property> generateAtlasProperties() {
    List<Property> props = new ArrayList<Property>();
    Property p = new Property();
    p.setName("prop-boolean");
    p.setValue("false");
    p.setFieldType(FieldType.BOOLEAN);
    props.add(p);
    p = new Property();
    p.setName("prop-byte");
    p.setValue("92");
    p.setFieldType(FieldType.BYTE);
    props.add(p);
    p = new Property();
    p.setName("prop-char");
    p.setValue("z");
    p.setFieldType(FieldType.CHAR);
    props.add(p);
    p = new Property();
    p.setName("prop-double");
    p.setValue(Double.toString(Double.MIN_VALUE));
    p.setFieldType(FieldType.DOUBLE);
    props.add(p);
    p = new Property();
    p.setName("prop-float");
    p.setValue(Float.toString(Float.MIN_VALUE));
    p.setFieldType(FieldType.FLOAT);
    props.add(p);
    p = new Property();
    p.setName("prop-int");
    p.setValue(Integer.toString(Integer.MIN_VALUE));
    p.setFieldType(FieldType.INTEGER);
    props.add(p);
    p = new Property();
    p.setName("prop-long");
    p.setValue(Long.toString(Long.MIN_VALUE));
    p.setFieldType(FieldType.LONG);
    props.add(p);
    p = new Property();
    p.setName("prop-short");
    p.setValue(Short.toString(Short.MIN_VALUE));
    p.setFieldType(FieldType.SHORT);
    props.add(p);
    p = new Property();
    p.setName("prop-string");
    p.setValue("helloworld");
    p.setFieldType(FieldType.STRING);
    props.add(p);
    p = new Property();
    p.setName("dupe-string");
    p.setValue("whatup");
    p.setFieldType(FieldType.STRING);
    props.add(p);
    return props;
}
Also used : ArrayList(java.util.ArrayList) Property(io.atlasmap.v2.Property)

Example 8 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.

the class BaseMarshallerTest method generateProperties.

private void generateProperties(AtlasMapping atlasMapping) {
    Property p = new Property();
    p.setName("foo");
    p.setValue("bar");
    p.setFieldType(FieldType.INTEGER);
    atlasMapping.setProperties(new Properties());
    atlasMapping.getProperties().getProperty().add(p);
}
Also used : Properties(io.atlasmap.v2.Properties) Property(io.atlasmap.v2.Property)

Example 9 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.

the class BaseMarshallerTest method generateProperties.

private void generateProperties(AtlasMapping atlasMapping) {
    Property p = new Property();
    p.setName("foo");
    p.setValue("bar");
    p.setFieldType(FieldType.INTEGER);
    atlasMapping.setProperties(new Properties());
    atlasMapping.getProperties().getProperty().add(p);
}
Also used : Properties(io.atlasmap.v2.Properties) Property(io.atlasmap.v2.Property)

Example 10 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project atlasmap by atlasmap.

the class BaseMarshallerTest method generateProperties.

private void generateProperties(AtlasMapping mapping) {
    Property p = new Property();
    p.setName("foo");
    p.setValue("bar");
    p.setFieldType(FieldType.INTEGER);
    mapping.setProperties(new Properties());
    mapping.getProperties().getProperty().add(p);
}
Also used : Properties(io.atlasmap.v2.Properties) Property(io.atlasmap.v2.Property)

Aggregations

Property (org.eclipse.bpmn2.Property)21 Test (org.junit.Test)8 Property (io.atlasmap.v2.Property)7 ArrayList (java.util.ArrayList)7 Node (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Node)7 Process (org.eclipse.bpmn2.Process)6 Property (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property)6 DataObject (org.eclipse.bpmn2.DataObject)5 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)5 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)5 RootElement (org.eclipse.bpmn2.RootElement)5 NodeAttributes (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.NodeAttributes)5 PropertyAttributes (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.PropertyAttributes)5 Properties (io.atlasmap.v2.Properties)4 List (java.util.List)4 DataInput (org.eclipse.bpmn2.DataInput)4 DeclarationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList)4 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)3 DataOutput (org.eclipse.bpmn2.DataOutput)3 FlowElement (org.eclipse.bpmn2.FlowElement)3