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