Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

GWT bug fix (JsonFormat Shape doesn't seem to work in GWT jackson)

Rich Turnerad8b8191077d
diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeRef.java b/model/src/main/java/org/openremote/model/attribute/AttributeRef.java
index 0227ae504..d2ab78e0b 100644
--- a/model/src/main/java/org/openremote/model/attribute/AttributeRef.java
+++ b/model/src/main/java/org/openremote/model/attribute/AttributeRef.java
@@ -19,9 +19,6 @@
*/
package org.openremote.model.attribute;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
import org.openremote.model.AbstractValueHolder;
import org.openremote.model.value.ArrayValue;
import org.openremote.model.value.Value;
@@ -40,7 +37,6 @@ import static org.openremote.model.util.TextUtil.requireNonNullAndNonEmpty;
* Two attribute references are {@link #equals} if they reference the same entity
* and attribute.
*/
-@JsonFormat(shape= JsonFormat.Shape.ARRAY)
public class AttributeRef {
protected String entityId;
@@ -49,9 +45,7 @@ public class AttributeRef {
protected AttributeRef() {
}
- @JsonCreator
- public AttributeRef(@JsonProperty("entityId") String entityId,
- @JsonProperty("attributeName") String attributeName) {
+ public AttributeRef(String entityId, String attributeName) {
requireNonNullAndNonEmpty(entityId);
requireNonNullAndNonEmpty(attributeName);
this.entityId = entityId;
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetAttributeLinkingTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetAttributeLinkingTest.groovy
index 26ca960a5..734a657d2 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetAttributeLinkingTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetAttributeLinkingTest.groovy
@@ -61,17 +61,13 @@ class AssetAttributeLinkingTest extends Specification implements ManagerContaine
converterOnOff.put("PRESSED", "@TOGGLE")
converterOnOff.put("RELEASED", "@IGNORE")
converterOnOff.put("LONG_PRESSED", "@IGNORE")
- def attributeLinkOnOff = Values.createObject()
- attributeLinkOnOff.put("attributeRef", new AttributeRef(asset2.id, "lightOnOff").toArrayValue())
- attributeLinkOnOff.put("converter", converterOnOff)
+ def attributeLinkOnOff = Values.parse(Container.JSON.writeValueAsString(new AttributeLink(new AttributeRef(asset2.id, "lightOnOff"), converterOnOff, null))).orElse(null)
def converterCounter = Values.createObject()
converterCounter.put("PRESSED", "@INCREMENT")
converterCounter.put("RELEASED", "@DECREMENT")
converterCounter.put("LONG_PRESSED", "@IGNORE")
- def attributeLinkCounter = Values.createObject()
- attributeLinkCounter.put("attributeRef", new AttributeRef(asset2.id, "counter").toArrayValue())
- attributeLinkCounter.put("converter", converterCounter)
+ def attributeLinkCounter = Values.parse(Container.JSON.writeValueAsString(new AttributeLink(new AttributeRef(asset2.id, "counter"), converterCounter, null))).orElse(null)
def attributeLinkProp = Values.parse(Container.JSON.writeValueAsString(new AttributeLink(
new AttributeRef(asset2.id, "item2Prop1"), null, [