Deep copy of object before to inlineImageForEdge in order to correctly work with cached values
This commit is contained in:
parent
b11a9df3fb
commit
02c9fe3f82
@ -63,7 +63,8 @@ public class AssetMsgConstructorV1 extends BaseAssetMsgConstructor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) {
|
public AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) {
|
||||||
imageService.inlineImageForEdge(assetProfile);
|
AssetProfile copy = JacksonUtil.clone(assetProfile);
|
||||||
|
imageService.inlineImageForEdge(copy);
|
||||||
AssetProfileUpdateMsg.Builder builder = AssetProfileUpdateMsg.newBuilder()
|
AssetProfileUpdateMsg.Builder builder = AssetProfileUpdateMsg.newBuilder()
|
||||||
.setMsgType(msgType)
|
.setMsgType(msgType)
|
||||||
.setIdMSB(assetProfile.getId().getId().getMostSignificantBits())
|
.setIdMSB(assetProfile.getId().getId().getMostSignificantBits())
|
||||||
@ -81,7 +82,7 @@ public class AssetMsgConstructorV1 extends BaseAssetMsgConstructor {
|
|||||||
builder.setDescription(assetProfile.getDescription());
|
builder.setDescription(assetProfile.getDescription());
|
||||||
}
|
}
|
||||||
if (assetProfile.getImage() != null) {
|
if (assetProfile.getImage() != null) {
|
||||||
builder.setImage(ByteString.copyFrom(assetProfile.getImage().getBytes(StandardCharsets.UTF_8)));
|
builder.setImage(ByteString.copyFrom(copy.getImage().getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
if (assetProfile.getDefaultEdgeRuleChainId() != null) {
|
if (assetProfile.getDefaultEdgeRuleChainId() != null) {
|
||||||
builder.setDefaultRuleChainIdMSB(assetProfile.getDefaultEdgeRuleChainId().getId().getMostSignificantBits())
|
builder.setDefaultRuleChainIdMSB(assetProfile.getDefaultEdgeRuleChainId().getId().getMostSignificantBits())
|
||||||
|
|||||||
@ -33,7 +33,8 @@ public class DashboardMsgConstructorV1 extends BaseDashboardMsgConstructor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) {
|
public DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) {
|
||||||
imageService.inlineImagesForEdge(dashboard);
|
Dashboard copy = JacksonUtil.clone(dashboard);
|
||||||
|
imageService.inlineImagesForEdge(copy);
|
||||||
DashboardUpdateMsg.Builder builder = DashboardUpdateMsg.newBuilder()
|
DashboardUpdateMsg.Builder builder = DashboardUpdateMsg.newBuilder()
|
||||||
.setMsgType(msgType)
|
.setMsgType(msgType)
|
||||||
.setIdMSB(dashboard.getId().getId().getMostSignificantBits())
|
.setIdMSB(dashboard.getId().getId().getMostSignificantBits())
|
||||||
@ -45,7 +46,7 @@ public class DashboardMsgConstructorV1 extends BaseDashboardMsgConstructor {
|
|||||||
builder.setAssignedCustomers(JacksonUtil.toString(dashboard.getAssignedCustomers()));
|
builder.setAssignedCustomers(JacksonUtil.toString(dashboard.getAssignedCustomers()));
|
||||||
}
|
}
|
||||||
if (dashboard.getImage() != null) {
|
if (dashboard.getImage() != null) {
|
||||||
builder.setImage(dashboard.getImage());
|
builder.setImage(copy.getImage());
|
||||||
}
|
}
|
||||||
if (dashboard.getMobileOrder() != null) {
|
if (dashboard.getMobileOrder() != null) {
|
||||||
builder.setMobileOrder(dashboard.getMobileOrder());
|
builder.setMobileOrder(dashboard.getMobileOrder());
|
||||||
|
|||||||
@ -95,7 +95,8 @@ public class DeviceMsgConstructorV1 extends BaseDeviceMsgConstructor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) {
|
public DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) {
|
||||||
imageService.inlineImageForEdge(deviceProfile);
|
DeviceProfile copy = JacksonUtil.clone(deviceProfile);
|
||||||
|
imageService.inlineImageForEdge(copy);
|
||||||
DeviceProfileUpdateMsg.Builder builder = DeviceProfileUpdateMsg.newBuilder()
|
DeviceProfileUpdateMsg.Builder builder = DeviceProfileUpdateMsg.newBuilder()
|
||||||
.setMsgType(msgType)
|
.setMsgType(msgType)
|
||||||
.setIdMSB(deviceProfile.getId().getId().getMostSignificantBits())
|
.setIdMSB(deviceProfile.getId().getId().getMostSignificantBits())
|
||||||
@ -120,7 +121,7 @@ public class DeviceMsgConstructorV1 extends BaseDeviceMsgConstructor {
|
|||||||
builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
|
builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
|
||||||
}
|
}
|
||||||
if (deviceProfile.getImage() != null) {
|
if (deviceProfile.getImage() != null) {
|
||||||
builder.setImage(ByteString.copyFrom(deviceProfile.getImage().getBytes(StandardCharsets.UTF_8)));
|
builder.setImage(ByteString.copyFrom(copy.getImage().getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
if (deviceProfile.getFirmwareId() != null) {
|
if (deviceProfile.getFirmwareId() != null) {
|
||||||
builder.setFirmwareIdMSB(deviceProfile.getFirmwareId().getId().getMostSignificantBits())
|
builder.setFirmwareIdMSB(deviceProfile.getFirmwareId().getId().getMostSignificantBits())
|
||||||
|
|||||||
@ -43,7 +43,8 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List<String> widgets) {
|
public WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List<String> widgets) {
|
||||||
imageService.inlineImageForEdge(widgetsBundle);
|
WidgetsBundle copy = JacksonUtil.clone(widgetsBundle);
|
||||||
|
imageService.inlineImageForEdge(copy);
|
||||||
WidgetsBundleUpdateMsg.Builder builder = WidgetsBundleUpdateMsg.newBuilder()
|
WidgetsBundleUpdateMsg.Builder builder = WidgetsBundleUpdateMsg.newBuilder()
|
||||||
.setMsgType(msgType)
|
.setMsgType(msgType)
|
||||||
.setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits())
|
.setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits())
|
||||||
@ -51,7 +52,7 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
|||||||
.setTitle(widgetsBundle.getTitle())
|
.setTitle(widgetsBundle.getTitle())
|
||||||
.setAlias(widgetsBundle.getAlias());
|
.setAlias(widgetsBundle.getAlias());
|
||||||
if (widgetsBundle.getImage() != null) {
|
if (widgetsBundle.getImage() != null) {
|
||||||
builder.setImage(ByteString.copyFrom(widgetsBundle.getImage().getBytes(StandardCharsets.UTF_8)));
|
builder.setImage(ByteString.copyFrom(copy.getImage().getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
if (widgetsBundle.getDescription() != null) {
|
if (widgetsBundle.getDescription() != null) {
|
||||||
builder.setDescription(widgetsBundle.getDescription());
|
builder.setDescription(widgetsBundle.getDescription());
|
||||||
@ -68,7 +69,8 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails, EdgeVersion edgeVersion) {
|
public WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails, EdgeVersion edgeVersion) {
|
||||||
imageService.inlineImagesForEdge(widgetTypeDetails);
|
WidgetTypeDetails copy = JacksonUtil.clone(widgetTypeDetails);
|
||||||
|
imageService.inlineImagesForEdge(copy);
|
||||||
WidgetTypeUpdateMsg.Builder builder = WidgetTypeUpdateMsg.newBuilder()
|
WidgetTypeUpdateMsg.Builder builder = WidgetTypeUpdateMsg.newBuilder()
|
||||||
.setMsgType(msgType)
|
.setMsgType(msgType)
|
||||||
.setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits())
|
.setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits())
|
||||||
@ -93,7 +95,7 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
|||||||
builder.setIsSystem(true);
|
builder.setIsSystem(true);
|
||||||
}
|
}
|
||||||
if (widgetTypeDetails.getImage() != null) {
|
if (widgetTypeDetails.getImage() != null) {
|
||||||
builder.setImage(widgetTypeDetails.getImage());
|
builder.setImage(copy.getImage());
|
||||||
}
|
}
|
||||||
if (widgetTypeDetails.getDescription() != null) {
|
if (widgetTypeDetails.getDescription() != null) {
|
||||||
if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_0) &&
|
if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_0) &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user