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
Asset datapoints now stored for all attributes, now need to opt out on any attributes not to be stored
Rich Turner424e3d2683dc
diff --git a/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java b/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.javaindex 48554fd0e..4b13f4f40 100644--- a/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java+++ b/manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java@@ -120,7 +120,7 @@ public class AssetDatapointService implements ContainerService, AssetUpdateProceAttribute<?> attribute,Source source) throws AssetProcessingException {- if (attribute.getMetaValue(STORE_DATA_POINTS).orElse(false)+ if (attribute.getMetaValue(STORE_DATA_POINTS).orElse(true)&& attribute.getValue().isPresent()) { // Don't store datapoints with null value// Perform upsert on datapoint (datapoint isn't immutable then really and tied to postgresql but prevents entire attribute event from failing)diff --git a/model/src/main/java/org/openremote/model/asset/Asset.java b/model/src/main/java/org/openremote/model/asset/Asset.javaindex 7fd0e7878..b304f5d08 100644--- a/model/src/main/java/org/openremote/model/asset/Asset.java+++ b/model/src/main/java/org/openremote/model/asset/Asset.java@@ -260,7 +260,7 @@ public abstract class Asset<T extends Asset<?>> implements IdentifiableEntity<T>public static final AttributeDescriptor<String[]> TAGS = new AttributeDescriptor<>("tags", ValueType.TEXT.asArray()).withOptional(true);- public static final AttributeDescriptor<String> NOTES = new AttributeDescriptor<>("notes", ValueType.TEXT).withOptional(true);+ public static final AttributeDescriptor<String> NOTES = new AttributeDescriptor<>("notes", ValueType.TEXT);public static final AttributeDescriptor<String> MANUFACTURER = new AttributeDescriptor<>("manufacturer", ValueType.TEXT).withOptional(true);public static final AttributeDescriptor<String> MODEL = new AttributeDescriptor<>("model", ValueType.TEXT).withOptional(true);diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovyindex 62fae3a48..f213498ec 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy@@ -245,7 +245,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiassets[0].id == managerTestSetup.smartOfficeId// Assets should not be completely loadedassets[0].path == null- assets[0].attributes.size() == 5+ assets[0].attributes.size() == 6when: "the root assets of the authenticated realm are retrieved"assets = assetResource.queryAssets(null,@@ -409,7 +409,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiassets[0].id == managerTestSetup.smartBuildingId// Assets should not be completely loadedassets[0].path == null- assets[0].attributes.size() == 5+ assets[0].attributes.size() == 6when: "the root assets of a foreign realm are retrieved"assets = assetResource.queryAssets(null,@@ -556,7 +556,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiapartment1.type == BuildingAsset.DESCRIPTOR.getName()apartment1.parentId == managerTestSetup.smartBuildingIdapartment1.path == null- apartment1.attributes.size() == 5+ apartment1.attributes.size() == 6Asset apartment1Livingroom = assets[1]apartment1Livingroom.id == managerTestSetup.apartment1LivingroomIddiff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovyindex a201ee1a1..743d5dfde 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy@@ -106,7 +106,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {assets.size() == 6assets.get(0).id == managerTestSetup.apartment1Idassets.get(1).id == managerTestSetup.apartment1LivingroomId- assets.get(1).getAttributes().size() == 11+ assets.get(1).getAttributes().size() == 12assets.get(1).getAttribute("motionSensor").isPresent()!assets.get(1).getAttribute("currentTemperature").get().getValue().isPresent()!assets.get(1).getAttribute("currentTemperature").get().meta.isEmpty()diff --git a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovyindex 1f1d9ea47..594f3e3e5 100644--- a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy+++ b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy@@ -408,7 +408,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {assert localBuilding1Room5Asset.getType() == RoomAsset.DESCRIPTOR.getName()assert localBuilding1Room5Asset.getRealm() == managerTestSetup.realmBuildingTenantassert localBuilding1Room5Asset.getParentId() == mapAssetId(gateway.id, assetIds[0], false)- assert localBuilding1Room5Asset.getAttributes().size() == 3+ assert localBuilding1Room5Asset.getAttributes().size() == 4}when: "an asset is modified on the gateway and the local manager is notified"@@ -432,7 +432,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {assert localBuilding1Room5Asset.getType() == RoomAsset.DESCRIPTOR.getName()assert localBuilding1Room5Asset.getRealm() == managerTestSetup.realmBuildingTenantassert localBuilding1Room5Asset.getParentId() == mapAssetId(gateway.id, assetIds[0], false)- assert localBuilding1Room5Asset.getAttributes().size() == 4+ assert localBuilding1Room5Asset.getAttributes().size() == 5assert localBuilding1Room5Asset.getAttribute("co2Level", Integer.class).flatMap{it.getValue()}.orElse(0i) == 500i}@@ -494,7 +494,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {assert localBuilding1Room5Asset.getType() == RoomAsset.DESCRIPTOR.getName()assert localBuilding1Room5Asset.getRealm() == managerTestSetup.realmBuildingTenantassert localBuilding1Room5Asset.getParentId() == mapAssetId(gateway.id, assetIds[0], false)- assert localBuilding1Room5Asset.getAttributes().size() == 3+ assert localBuilding1Room5Asset.getAttributes().size() == 4assert localBuilding1Room5Asset.version == versionwhen: "the client received messages are cleared"diff --git a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovyindex fb26fe5b3..4317d51d8 100644--- a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy@@ -173,7 +173,7 @@ class VelbusProtocolTest extends Specification implements ManagerContainerTraitand: "a given asset should have the correct attributes (VMBGPOD)"def asset = assets.find {it.asset.name == "VMBGPOD"}assert asset != null- assert asset.asset.getAttributes().size() == 304+ assert asset.asset.getAttributes().size() == 305def memoTextAttribute = asset.asset.getAttributes().values().find {it.getMetaValue(AGENT_LINK).map{(it as VelbusAgent.VelbusAgentLink).deviceValueLink.orElse(null) == "MEMO_TEXT"}.orElse(false)}assert memoTextAttribute != nullassert memoTextAttribute.getMetaValue(AGENT_LINK).flatMap(){(it as VelbusAgent.VelbusAgentLink).deviceAddress}.orElse(null) == 24