Skip to content

armgit / core

Public Imported from GitHub
0

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

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.java
index 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, AssetUpdateProce
Attribute<?> 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.java
index 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.groovy
index 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 ManagerContainerTrai
assets[0].id == managerTestSetup.smartOfficeId
// Assets should not be completely loaded
assets[0].path == null
- assets[0].attributes.size() == 5
+ assets[0].attributes.size() == 6
when: "the root assets of the authenticated realm are retrieved"
assets = assetResource.queryAssets(null,
@@ -409,7 +409,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
assets[0].id == managerTestSetup.smartBuildingId
// Assets should not be completely loaded
assets[0].path == null
- assets[0].attributes.size() == 5
+ assets[0].attributes.size() == 6
when: "the root assets of a foreign realm are retrieved"
assets = assetResource.queryAssets(null,
@@ -556,7 +556,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
apartment1.type == BuildingAsset.DESCRIPTOR.getName()
apartment1.parentId == managerTestSetup.smartBuildingId
apartment1.path == null
- apartment1.attributes.size() == 5
+ apartment1.attributes.size() == 6
Asset apartment1Livingroom = assets[1]
apartment1Livingroom.id == managerTestSetup.apartment1LivingroomId
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
index 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() == 6
assets.get(0).id == managerTestSetup.apartment1Id
assets.get(1).id == managerTestSetup.apartment1LivingroomId
- assets.get(1).getAttributes().size() == 11
+ assets.get(1).getAttributes().size() == 12
assets.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.groovy
index 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.realmBuildingTenant
assert 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.realmBuildingTenant
assert localBuilding1Room5Asset.getParentId() == mapAssetId(gateway.id, assetIds[0], false)
- assert localBuilding1Room5Asset.getAttributes().size() == 4
+ assert localBuilding1Room5Asset.getAttributes().size() == 5
assert 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.realmBuildingTenant
assert localBuilding1Room5Asset.getParentId() == mapAssetId(gateway.id, assetIds[0], false)
- assert localBuilding1Room5Asset.getAttributes().size() == 3
+ assert localBuilding1Room5Asset.getAttributes().size() == 4
assert localBuilding1Room5Asset.version == version
when: "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.groovy
index 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 ManagerContainerTrait
and: "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() == 305
def memoTextAttribute = asset.asset.getAttributes().values().find {it.getMetaValue(AGENT_LINK).map{(it as VelbusAgent.VelbusAgentLink).deviceValueLink.orElse(null) == "MEMO_TEXT"}.orElse(false)}
assert memoTextAttribute != null
assert memoTextAttribute.getMetaValue(AGENT_LINK).flatMap(){(it as VelbusAgent.VelbusAgentLink).deviceAddress}.orElse(null) == 24