Skip to content

armgit / core

Public Imported from GitHub
0

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

Model updates: Updated json schema related annotations

Rich Turner070c112d8a80
diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
index 57d177feb..5a308a2b8 100644
--- a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
@@ -62,7 +62,8 @@ public abstract class AgentLink<T extends AgentLink<?>> implements Serializable
" protocol (particularly useful for executable attributes)")
protected String writeValue;
@JsonPropertyDescription("The predicate to apply to incoming messages to determine if the message is intended for the" +
- " linked attribute; the value used in the predicate can be filtered using the message match filters")
+ " linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to" +
+ " enable attributes to be updated by the linked agent.")
protected ValuePredicate messageMatchPredicate;
@JsonPropertyDescription("ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate")
protected ValueFilter[] messageMatchFilters;
diff --git a/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
index 02cf6c68c..8634f6f43 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openremote.model.util.ValueUtil;
@@ -41,7 +41,7 @@ import java.util.function.Supplier;
* There is an implicit 'and' between each specified condition; the negation is applied once all the criteria are
* evaluated.
*/
-@JsonClassDescription("Predicate for array values; will match based on configured options.")
+@JsonSchemaDescription("Predicate for array values; will match based on configured options.")
public class ArrayPredicate extends ValuePredicate {
public static final String name = "array";
diff --git a/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java b/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
index 69c53de67..69f2fd951 100644
--- a/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import org.openremote.model.util.ValueUtil;
import java.util.function.Predicate;
@@ -29,7 +29,7 @@ import java.util.function.Supplier;
* Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value
* that is not a boolean will not match.
*/
-@JsonClassDescription("Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match")
+@JsonSchemaDescription("Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match")
public class BooleanPredicate extends ValuePredicate {
public static final String name = "boolean";
diff --git a/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java b/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
index d4f7617ca..b921aece6 100644
--- a/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
@@ -36,7 +36,7 @@ import java.util.function.Supplier;
* Can be applied to {@link org.openremote.model.attribute.Attribute}s of type {@link ValueType#CALENDAR_EVENT}.
*/
@JsonSchemaTitle("Calendar")
-@JsonClassDescription("Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.")
+@JsonSchemaDescription("Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.")
public class CalendarEventPredicate extends ValuePredicate {
public static final String name = "calendar-event";
diff --git a/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java b/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
index d7e6181fa..4affddf7e 100644
--- a/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.Pair;
import org.openremote.model.util.TimeUtil;
@@ -34,7 +34,7 @@ import java.util.function.Supplier;
* (e.g. yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss\u00b1HH:mm), offset and time are optional, if no offset
* information is supplied then UTC is assumed.
*/
-@JsonClassDescription("Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss\\u00b1HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed.")
+@JsonSchemaDescription("Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss±HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed.")
public class DateTimePredicate extends ValuePredicate {
public static final String name = "datetime";
diff --git a/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java b/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
index e9a38dcdb..9bcb7b1ed 100644
--- a/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.NumberComparator;
import org.openremote.model.util.ValueUtil;
@@ -30,7 +30,7 @@ import java.util.function.Supplier;
/**
* Predicate for number values; will match based on configured options.
*/
-@JsonClassDescription("Predicate for number values; will match based on configured options.")
+@JsonSchemaDescription("Predicate for number values; will match based on configured options.")
public class NumberPredicate extends ValuePredicate {
public static final String name = "number";
diff --git a/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java b/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
index bc43b9180..37a921bef 100644
--- a/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
@@ -37,7 +37,7 @@ import java.util.function.Supplier;
* latitude and longitude unless negated.
*/
@JsonSchemaTitle("Radial geofence")
-@JsonClassDescription("Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated.")
+@JsonSchemaDescription("Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated.")
public class RadialGeofencePredicate extends GeofencePredicate {
public static final String name = "radial";
diff --git a/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java b/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
index 20569dd3b..d62184751 100644
--- a/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
@@ -19,9 +19,9 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
@@ -37,7 +37,7 @@ import java.util.function.Supplier;
* latitude and longitude values of two corners unless negated.
*/
@JsonSchemaTitle("Rectangular geofence")
-@JsonClassDescription("Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated.")
+@JsonSchemaDescription("Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated.")
public class RectangularGeofencePredicate extends GeofencePredicate {
public static final String name = "rect";
diff --git a/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java b/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
index 505573986..2c04c44c8 100644
--- a/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.ValueUtil;
import org.openremote.model.value.NameHolder;
@@ -32,7 +32,7 @@ import java.util.function.Supplier;
/**
* Predicate for string values; will match based on configured options.
*/
-@JsonClassDescription("Predicate for string values; will match based on configured options.")
+@JsonSchemaDescription("Predicate for string values; will match based on configured options.")
public class StringPredicate extends ValuePredicate {
public static final String name = "string";
diff --git a/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
index 0e24c5e90..40717cdea 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
@@ -19,14 +19,14 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import java.util.function.Predicate;
import java.util.function.Supplier;
@JsonSchemaTitle("Any value")
-@JsonClassDescription("Predicate that matches any value including null.")
+@JsonSchemaDescription("Predicate that matches any value including null.")
public class ValueAnyPredicate extends ValuePredicate {
public static final String name = "value-any";
diff --git a/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
index 62e0b9371..0a866d76e 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.fasterxml.jackson.annotation.JsonClassDescription;
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import java.util.Objects;
@@ -27,7 +27,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
@JsonSchemaTitle("Empty value")
-@JsonClassDescription("Predicate that matches any empty/null value; unless negated.")
+@JsonSchemaDescription("Predicate that matches any empty/null value; unless negated.")
public class ValueEmptyPredicate extends ValuePredicate {
public static final String name = "value-empty";
diff --git a/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java b/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
index a9e5681b9..73b0eee2a 100644
--- a/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
+++ b/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
@@ -126,7 +126,9 @@ public class JSONSchemaUtil {
}},
null,
false,
- null
+ null,
+ null,
+ true
).withJsonSchemaDraft(JsonSchemaDraft.DRAFT_07);
}
}