100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
New constructors for null attribute state
Christian Bauer9e41bea96ced
diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java b/model/src/main/java/org/openremote/model/attribute/AttributeEvent.javaindex 678bf6f1a..05fe1eb55 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java@@ -110,6 +110,10 @@ public class AttributeEvent extends SharedEvent {this(new AttributeState(new AttributeRef(entityId, attributeName), value));}+ public AttributeEvent(String entityId, String attributeName) {+ this(new AttributeState(new AttributeRef(entityId, attributeName)));+ }+public AttributeEvent(String entityId, String attributeName, Value value, long timestamp) {this(new AttributeState(new AttributeRef(entityId, attributeName), value), timestamp);}@@ -118,6 +122,10 @@ public class AttributeEvent extends SharedEvent {this(new AttributeState(attributeRef, value));}+ public AttributeEvent(AttributeRef attributeRef) {+ this(new AttributeState(attributeRef));+ }+public AttributeEvent(AttributeRef attributeRef, Value value, long timestamp) {this(new AttributeState(attributeRef, value), timestamp);}diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeState.java b/model/src/main/java/org/openremote/model/attribute/AttributeState.javaindex ddf81be9e..3043841aa 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeState.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeState.java@@ -29,6 +29,9 @@ import java.util.Optional;/*** The desired or current or past state of an {@link AttributeRef}.+ * <p>+ * <code>null</code> is a valid {@link #value}.+ * </p>*/public class AttributeState {@@ -42,6 +45,13 @@ public class AttributeState {this(new AttributeRef(entityId, attributeName), value);}+ /**+ * Sets the {@link #value} to <code>null</code>.+ */+ public AttributeState(String entityId, String attributeName) {+ this(new AttributeRef(entityId, attributeName), null);+ }+/*** @param value can be <code>null</code> if the attribute has no value.*/@@ -50,6 +60,13 @@ public class AttributeState {this.value = value;}+ /**+ * Sets the {@link #value} to <code>null</code>.+ */+ public AttributeState(AttributeRef attributeRef) {+ this(attributeRef, null);+ }+public AttributeRef getAttributeRef() {return attributeRef;}