Search in sources :

Example 11 with EntityModel

use of org.eclipse.vorto.model.EntityModel in project vorto by eclipse.

the class SpecWithTwoFunctionblocksWithNestedEntity method createModel.

@Override
protected void createModel() {
    EntityModel sensorValueEntity = EntityModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:SensorValue:1.0.0")).property(ModelProperty.Builder("value", PrimitiveType.FLOAT).withXPathStereotype("/temperature", "iotbutton").build()).build();
    FunctionblockModel temperatureModel = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Temperature:1.0.0")).statusProperty(ModelProperty.Builder("value", sensorValueEntity).build()).build();
    infomodel.getFunctionblocks().add(ModelProperty.Builder("outdoorTemperature", temperatureModel).build());
    EntityModel sensorValueEntity2 = EntityModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:SensorValue:1.0.0")).property(ModelProperty.Builder("value", PrimitiveType.FLOAT).withXPathStereotype("/humidity", "iotbutton").build()).build();
    FunctionblockModel humidityModel = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Humidity:1.0.0")).statusProperty(ModelProperty.Builder("value", sensorValueEntity2).build()).build();
    infomodel.getFunctionblocks().add(ModelProperty.Builder("humidity", humidityModel).build());
}
Also used : FunctionblockModel(org.eclipse.vorto.model.FunctionblockModel) EntityModel(org.eclipse.vorto.model.EntityModel)

Aggregations

EntityModel (org.eclipse.vorto.model.EntityModel)11 ModelProperty (org.eclipse.vorto.model.ModelProperty)5 FunctionblockModel (org.eclipse.vorto.model.FunctionblockModel)4 Test (org.junit.Test)4 EnumModel (org.eclipse.vorto.model.EnumModel)3 ModelContent (org.eclipse.vorto.model.ModelContent)3 ModelId (org.eclipse.vorto.model.ModelId)3 Entity (org.eclipse.vorto.core.api.model.datatype.Entity)2 Property (org.eclipse.vorto.core.api.model.datatype.Property)2 FunctionblockProperty (org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)2 IModel (org.eclipse.vorto.model.IModel)2 JXPathInvalidAccessException (org.apache.commons.jxpath.JXPathInvalidAccessException)1 JXPathNotFoundException (org.apache.commons.jxpath.JXPathNotFoundException)1 Enum (org.eclipse.vorto.core.api.model.datatype.Enum)1 ObjectPropertyType (org.eclipse.vorto.core.api.model.datatype.ObjectPropertyType)1 MappingRule (org.eclipse.vorto.core.api.model.mapping.MappingRule)1 ReferenceTarget (org.eclipse.vorto.core.api.model.mapping.ReferenceTarget)1 StereoTypeTarget (org.eclipse.vorto.core.api.model.mapping.StereoTypeTarget)1 MappingException (org.eclipse.vorto.mapping.engine.MappingException)1 Infomodel (org.eclipse.vorto.model.Infomodel)1