use of org.eclipse.vorto.model.ModelProperty in project vorto by eclipse.
the class SpecWithArrayType method createButtonFb.
private FunctionblockModel createButtonFb() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
ModelProperty digitalInputCount = new ModelProperty();
digitalInputCount.setMandatory(true);
digitalInputCount.setName("flag");
digitalInputCount.setType(PrimitiveType.STRING);
digitalInputCount.setTargetPlatformKey("iotbutton");
digitalInputCount.addStereotype(Stereotype.createWithXpath("button:convertArray(/data)"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputCount }));
return buttonModel;
}
use of org.eclipse.vorto.model.ModelProperty in project vorto by eclipse.
the class SpecWithConstraintConfigMapping method createVoltageFb.
private FunctionblockModel createVoltageFb() {
FunctionblockModel voltageModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:Voltage:1.0.0"));
ModelProperty sensorValueProperty = new ModelProperty();
sensorValueProperty.setMandatory(true);
sensorValueProperty.setName("sensor_value");
sensorValueProperty.setType(PrimitiveType.FLOAT);
Constraint constraint = new Constraint(ConstraintType.MAX, "5000");
sensorValueProperty.setConstraints(Arrays.asList(constraint));
sensorValueProperty.setTargetPlatformKey("iotbutton");
sensorValueProperty.addStereotype(Stereotype.createWithXpath("number:toFloat(string:substring(batteryVoltage,0,string:length(batteryVoltage)-2))"));
ModelProperty sensorUnitsProperty = new ModelProperty();
sensorUnitsProperty.setMandatory(false);
sensorUnitsProperty.setName("sensor_units");
sensorUnitsProperty.setType(PrimitiveType.STRING);
sensorUnitsProperty.setTargetPlatformKey("iotbutton");
sensorUnitsProperty.addStereotype(Stereotype.createWithXpath("string:substring(batteryVoltage,string:length(batteryVoltage)-2)"));
voltageModel.setConfigurationProperties(Arrays.asList(new ModelProperty[] { sensorValueProperty, sensorUnitsProperty }));
return voltageModel;
}
use of org.eclipse.vorto.model.ModelProperty in project vorto by eclipse.
the class SpecWithMaliciousFunction method createButtonFb.
private FunctionblockModel createButtonFb() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
ModelProperty digitalInputCount = new ModelProperty();
digitalInputCount.setMandatory(true);
digitalInputCount.setName("digital_input_count");
digitalInputCount.setType(PrimitiveType.INT);
digitalInputCount.setTargetPlatformKey("iotbutton");
digitalInputCount.addStereotype(Stereotype.createWithXpath("button:convert(clickType)"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputCount }));
return buttonModel;
}
use of org.eclipse.vorto.model.ModelProperty in project vorto by eclipse.
the class SpecWithArrayPayload method createModel.
@Override
protected void createModel() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.STRING);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("array[1]/clickType"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("button", buttonModel).build());
}
use of org.eclipse.vorto.model.ModelProperty in project vorto by eclipse.
the class SpecWithConditionedRules method createModel.
@Override
protected void createModel() {
FunctionblockModel doorState = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
doorState.addStereotype(Stereotype.createCondition("data.key == 'DoorState'"));
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.STRING);
digitalInputStateProperty.setTargetPlatformKey("homeconnect");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("data/value"));
doorState.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
FunctionblockModel operationState = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
operationState.addStereotype(Stereotype.createCondition("data.key == 'OperationState'"));
ModelProperty digitalInputStateProperty1 = new ModelProperty();
digitalInputStateProperty1.setMandatory(true);
digitalInputStateProperty1.setName("sensor_value");
digitalInputStateProperty1.setType(PrimitiveType.STRING);
digitalInputStateProperty1.setTargetPlatformKey("homeconnect");
digitalInputStateProperty1.addStereotype(Stereotype.createWithXpath("data/value"));
operationState.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty1 }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("doorState", doorState).build());
infomodel.getFunctionblocks().add(ModelProperty.Builder("operationState", operationState).build());
}
Aggregations