use of org.eclipse.vorto.model.FunctionblockModel 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.FunctionblockModel 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());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithPropertyConditionXpath 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.FLOAT);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithConditionalXpath("xpath:eval('data[@id = 100]/value',this) == 'x'", "100"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("button", buttonModel).build());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithSameFunctionblock 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.FLOAT);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("/@btnvalue1"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("btn1", buttonModel).build());
FunctionblockModel buttonModel2 = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
ModelProperty digitalInputStateProperty2 = new ModelProperty();
digitalInputStateProperty2.setMandatory(true);
digitalInputStateProperty2.setName("sensor_value");
digitalInputStateProperty2.setType(PrimitiveType.FLOAT);
digitalInputStateProperty2.setTargetPlatformKey("iotbutton");
digitalInputStateProperty2.addStereotype(Stereotype.createWithXpath("/@btnvalue2"));
buttonModel2.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty2 }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("btn2", buttonModel2).build());
}
use of org.eclipse.vorto.model.FunctionblockModel 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;
}
Aggregations