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
Hotfix for AssetResource TypeScript model generation (#1548)
Martin Peetersb89b7970960b
diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java b/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.javaindex 8c6254669..f00c6b1ac 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java@@ -450,7 +450,7 @@ public class AssetResourceImpl extends ManagerWebResource implements AssetResour@Overridepublic AttributeWriteResult[] writeAttributeValues(RequestParams requestParams, AttributeState[] attributeStates) {- return writeAttributeValues(requestParams,+ return writeAttributeEvents(requestParams,Arrays.stream(attributeStates).map(AttributeEvent::new).toArray(AttributeEvent[]::new)@@ -458,7 +458,7 @@ public class AssetResourceImpl extends ManagerWebResource implements AssetResour}@Override- public AttributeWriteResult[] writeAttributeValues(RequestParams requestParams, AttributeEvent[] attributeEvents) {+ public AttributeWriteResult[] writeAttributeEvents(RequestParams requestParams, AttributeEvent[] attributeEvents) {// Process asynchronously but block for a little while waiting for the resultreturn Arrays.stream(attributeEvents).map(event -> {if (!clientEventService.authorizeEventWrite(getRequestRealmName(), getAuthContext(), event)) {diff --git a/model/src/main/java/org/openremote/model/asset/AssetResource.java b/model/src/main/java/org/openremote/model/asset/AssetResource.javaindex 5a745146c..abdb86f81 100644--- a/model/src/main/java/org/openremote/model/asset/AssetResource.java+++ b/model/src/main/java/org/openremote/model/asset/AssetResource.java@@ -275,8 +275,8 @@ public interface AssetResource {@Consumes(APPLICATION_JSON)@Produces(APPLICATION_JSON)@Path("attributes/timestamp")- @Operation(operationId = "writeAttributeValuesWithTimestamps", summary = "Update attribute values with timestamps")- AttributeWriteResult[] writeAttributeValues(@BeanParam RequestParams requestParams, AttributeEvent[] attributeStates);+ @Operation(operationId = "writeAttributeEvents", summary = "Update attribute values with timestamps")+ AttributeWriteResult[] writeAttributeEvents(@BeanParam RequestParams requestParams, AttributeEvent[] attributeEvents);/*** Creates an asset. The identifier value of the asset can be provided, it should be a globally unique string value,diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovyindex dbd8b844b..f426a443d 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy@@ -286,7 +286,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTraitstates.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.AREA.getName(), 123456), timestamp-3000));states.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.ROOM_NUMBER.getName(), 123456), timestamp-3000));- assetResource.writeAttributeValues(null, states.toArray() as AttributeEvent[])+ assetResource.writeAttributeEvents(null, states.toArray() as AttributeEvent[])then: "the attribute value should match"new PollingConditions(timeout: 5, delay: 0.2).eventually {@@ -305,7 +305,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTraitstates.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.AREA.getName(), 1234567), timestamp-2000));states.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.ROOM_NUMBER.getName(), 1234567), timestamp-2000));- assetResource.writeAttributeValues(null, states.toArray() as AttributeEvent[])+ assetResource.writeAttributeEvents(null, states.toArray() as AttributeEvent[])then: "the attribute value should match"new PollingConditions(timeout: 5, delay: 0.2).eventually {@@ -322,7 +322,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTraitstates.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.AREA.getName(), 12345678), timestamp-4000));states.add(new AttributeEvent(new AttributeState(testAsset.getId(), testAsset.ROOM_NUMBER.getName(), 12345678), timestamp-4000));- assetResource.writeAttributeValues(null, states.toArray() as AttributeEvent[])+ assetResource.writeAttributeEvents(null, states.toArray() as AttributeEvent[])then: "the attribute value should match"new PollingConditions(timeout: 5, delay: 0.2).eventually {