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
|
||||
public AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) {
|
||||
imageService.inlineImageForEdge(assetProfile);
|
||||
AssetProfile copy = JacksonUtil.clone(assetProfile);
|
||||
imageService.inlineImageForEdge(copy);
|
||||
AssetProfileUpdateMsg.Builder builder = AssetProfileUpdateMsg.newBuilder()
|
||||
.setMsgType(msgType)
|
||||
.setIdMSB(assetProfile.getId().getId().getMostSignificantBits())
|
||||
@ -81,7 +82,7 @@ public class AssetMsgConstructorV1 extends BaseAssetMsgConstructor {
|
||||
builder.setDescription(assetProfile.getDescription());
|
||||
}
|
||||
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) {
|
||||
builder.setDefaultRuleChainIdMSB(assetProfile.getDefaultEdgeRuleChainId().getId().getMostSignificantBits())
|
||||
|
||||
@ -33,7 +33,8 @@ public class DashboardMsgConstructorV1 extends BaseDashboardMsgConstructor {
|
||||
|
||||
@Override
|
||||
public DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) {
|
||||
imageService.inlineImagesForEdge(dashboard);
|
||||
Dashboard copy = JacksonUtil.clone(dashboard);
|
||||
imageService.inlineImagesForEdge(copy);
|
||||
DashboardUpdateMsg.Builder builder = DashboardUpdateMsg.newBuilder()
|
||||
.setMsgType(msgType)
|
||||
.setIdMSB(dashboard.getId().getId().getMostSignificantBits())
|
||||
@ -45,7 +46,7 @@ public class DashboardMsgConstructorV1 extends BaseDashboardMsgConstructor {
|
||||
builder.setAssignedCustomers(JacksonUtil.toString(dashboard.getAssignedCustomers()));
|
||||
}
|
||||
if (dashboard.getImage() != null) {
|
||||
builder.setImage(dashboard.getImage());
|
||||
builder.setImage(copy.getImage());
|
||||
}
|
||||
if (dashboard.getMobileOrder() != null) {
|
||||
builder.setMobileOrder(dashboard.getMobileOrder());
|
||||
|
||||
@ -95,7 +95,8 @@ public class DeviceMsgConstructorV1 extends BaseDeviceMsgConstructor {
|
||||
|
||||
@Override
|
||||
public DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) {
|
||||
imageService.inlineImageForEdge(deviceProfile);
|
||||
DeviceProfile copy = JacksonUtil.clone(deviceProfile);
|
||||
imageService.inlineImageForEdge(copy);
|
||||
DeviceProfileUpdateMsg.Builder builder = DeviceProfileUpdateMsg.newBuilder()
|
||||
.setMsgType(msgType)
|
||||
.setIdMSB(deviceProfile.getId().getId().getMostSignificantBits())
|
||||
@ -120,7 +121,7 @@ public class DeviceMsgConstructorV1 extends BaseDeviceMsgConstructor {
|
||||
builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
|
||||
}
|
||||
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) {
|
||||
builder.setFirmwareIdMSB(deviceProfile.getFirmwareId().getId().getMostSignificantBits())
|
||||
|
||||
@ -43,7 +43,8 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
||||
|
||||
@Override
|
||||
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()
|
||||
.setMsgType(msgType)
|
||||
.setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits())
|
||||
@ -51,7 +52,7 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
||||
.setTitle(widgetsBundle.getTitle())
|
||||
.setAlias(widgetsBundle.getAlias());
|
||||
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) {
|
||||
builder.setDescription(widgetsBundle.getDescription());
|
||||
@ -68,7 +69,8 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
||||
|
||||
@Override
|
||||
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()
|
||||
.setMsgType(msgType)
|
||||
.setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits())
|
||||
@ -93,7 +95,7 @@ public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor {
|
||||
builder.setIsSystem(true);
|
||||
}
|
||||
if (widgetTypeDetails.getImage() != null) {
|
||||
builder.setImage(widgetTypeDetails.getImage());
|
||||
builder.setImage(copy.getImage());
|
||||
}
|
||||
if (widgetTypeDetails.getDescription() != null) {
|
||||
if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_0) &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user