Search in sources :

Example 21 with FunctionblockModel

use of org.eclipse.vorto.repository.api.content.FunctionblockModel in project vorto by eclipse.

the class SpecWithCustomFunction method createButtonFb.

private FunctionblockModel createButtonFb() {
    FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
    ModelProperty digitalInputStateProperty = new ModelProperty();
    digitalInputStateProperty.setMandatory(true);
    digitalInputStateProperty.setName("digital_input_state");
    digitalInputStateProperty.setType(PrimitiveType.BOOLEAN);
    digitalInputStateProperty.setTargetPlatformKey("iotbutton");
    digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("boolean:toBoolean(\"true\")"));
    ModelProperty digitalInputCount = new ModelProperty();
    digitalInputCount.setMandatory(true);
    digitalInputCount.setName("digital_input_count");
    digitalInputCount.setType(PrimitiveType.INT);
    digitalInputCount.setTargetPlatformKey("iotbutton");
    digitalInputCount.addStereotype(Stereotype.createWithXpath("button:convertClickType(clickType)"));
    buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty, digitalInputCount }));
    return buttonModel;
}
Also used : FunctionblockModel(org.eclipse.vorto.repository.api.content.FunctionblockModel) ModelProperty(org.eclipse.vorto.repository.api.content.ModelProperty)

Aggregations

FunctionblockModel (org.eclipse.vorto.repository.api.content.FunctionblockModel)21 ModelProperty (org.eclipse.vorto.repository.api.content.ModelProperty)18 Test (org.junit.Test)4 Infomodel (org.eclipse.vorto.repository.api.content.Infomodel)2 Stereotype (org.eclipse.vorto.repository.api.content.Stereotype)2 ArrayList (java.util.ArrayList)1 JXPathInvalidAccessException (org.apache.commons.jxpath.JXPathInvalidAccessException)1 JXPathNotFoundException (org.apache.commons.jxpath.JXPathNotFoundException)1 ModelId (org.eclipse.vorto.repository.api.ModelId)1 EntityModel (org.eclipse.vorto.repository.api.content.EntityModel)1 JavascriptFunctions (org.eclipse.vorto.service.mapping.internal.converter.JavascriptFunctions)1 DefaultMappingSpecification (org.eclipse.vorto.service.mapping.internal.spec.DefaultMappingSpecification)1 FunctionblockData (org.eclipse.vorto.service.mapping.normalized.FunctionblockData)1