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
Implemented notExists AttributePredicate support in AssetStorageService
Rich Turneref21cdb01eff
diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.javaindex 31533e7a0..e10572609 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java@@ -1221,7 +1221,13 @@ public class AssetStorageService extends RouteBuilder implements ContainerServicisFirst = false;sb.append("(");- sb.append(buildAttributeFilter(attributePredicate, joinCounter.get(), binders));+ if (attributePredicate.notExists && attributePredicate.name != null && attributePredicate.name.value != null) {+ sb.append("NOT A.ATTRIBUTES ?? ?");+ final int pos = binders.size() + 1;+ binders.add(st -> st.setString(pos, attributePredicate.name.value));+ } else {+ sb.append(buildAttributeFilter(attributePredicate, joinCounter.get(), binders));+ }sb.append(")");}joinCounter.incrementAndGet();@@ -1504,7 +1510,7 @@ public class AssetStorageService extends RouteBuilder implements ContainerServicfinal int pos = binders.size() + 1;java.sql.Timestamp when = new java.sql.Timestamp(((CalendarEventPredicate)attributePredicate.value).timestamp.getTime());- // The recurrence logic is applied post DB query just start key is present and in the past and also+ // The recurrence logic is applied post DB query just check start key is present and in the past and also// that the end key is numeric and in the future if no recurrence valueattributeBuilder.append("(jsonb_typeof(AX").append(joinCounter)diff --git a/model/src/main/java/org/openremote/model/rules/json/RuleActionTarget.java b/model/src/main/java/org/openremote/model/rules/json/RuleActionTarget.javaindex 54682da7b..02a0ebdcc 100644--- a/model/src/main/java/org/openremote/model/rules/json/RuleActionTarget.java+++ b/model/src/main/java/org/openremote/model/rules/json/RuleActionTarget.java@@ -23,7 +23,9 @@ import org.openremote.model.query.AssetQuery;import org.openremote.model.query.UserQuery;/**- * None or one of the options should be set the precedence is:+ * Controls which {@link org.openremote.model.asset.Asset}s the {@link RuleAction} is applied to; if not supplied or+ * none of the options are supplied then the default behaviour is to use all {@link org.openremote.model.asset.Asset}s+ * that caused the rule to trigger. The precedence is:* <ol>* <li>{@link #ruleConditionTag}</li>* <li>{@link #assets}</li>diff --git a/ui/component/or-smart-notify/src/index.ts b/ui/component/or-smart-notify/src/index.tsindex 0c370f9cb..86bcfefcd 100644--- a/ui/component/or-smart-notify/src/index.ts+++ b/ui/component/or-smart-notify/src/index.ts@@ -6,7 +6,7 @@ import {icon} from "@fortawesome/fontawesome-svg-core";import {faClock} from "@fortawesome/free-regular-svg-icons";import {faTimes} from "@fortawesome/free-solid-svg-icons";-import {AssetQuery} from "@openremote/model";+import {AssetQuery, ClientRole} from "@openremote/model";import manager from "@openremote/core";@customElement("or-smart-notify")@@ -340,7 +340,7 @@ class OrSmartNotify extends LitElement {protected firstUpdated(_changedProperties: PropertyValues): void {super.firstUpdated(_changedProperties);- this.isDisabled = !manager.hasRole(Constants.WRITE_ASSETS_ROLE);+ this.isDisabled = !manager.hasRole(ClientRole.WRITE_ASSETS);}}