|
|
|
@ -21,6 +21,7 @@ import org.springframework.stereotype.Component; |
|
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
|
import org.thingsboard.server.common.data.Tenant; |
|
|
|
import org.thingsboard.server.common.data.TenantProfile; |
|
|
|
import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; |
|
|
|
import org.thingsboard.server.gen.edge.v1.EdgeVersion; |
|
|
|
import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; |
|
|
|
import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; |
|
|
|
@ -78,6 +79,23 @@ public class TenantMsgConstructorV1 implements TenantMsgConstructor { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TenantProfileUpdateMsg constructTenantProfileUpdateMsg(UpdateMsgType msgType, TenantProfile tenantProfile, EdgeVersion edgeVersion) { |
|
|
|
tenantProfile = JacksonUtil.clone(tenantProfile); |
|
|
|
// clear all config
|
|
|
|
DefaultTenantProfileConfiguration configuration = |
|
|
|
(DefaultTenantProfileConfiguration) tenantProfile.getProfileData().getConfiguration(); |
|
|
|
configuration.setRpcTtlDays(0); |
|
|
|
configuration.setMaxJSExecutions(0); |
|
|
|
configuration.setMaxREExecutions(0); |
|
|
|
configuration.setMaxDPStorageDays(0); |
|
|
|
configuration.setMaxTbelExecutions(0); |
|
|
|
configuration.setQueueStatsTtlDays(0); |
|
|
|
configuration.setMaxTransportMessages(0); |
|
|
|
configuration.setDefaultStorageTtlDays(0); |
|
|
|
configuration.setMaxTransportDataPoints(0); |
|
|
|
configuration.setRuleEngineExceptionsTtlDays(0); |
|
|
|
configuration.setMaxRuleNodeExecutionsPerMessage(0); |
|
|
|
tenantProfile.getProfileData().setConfiguration(configuration); |
|
|
|
|
|
|
|
ByteString profileData = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_2) ? |
|
|
|
ByteString.empty() : ByteString.copyFrom(dataDecodingEncodingService.encode(tenantProfile.getProfileData())); |
|
|
|
TenantProfileUpdateMsg.Builder builder = TenantProfileUpdateMsg.newBuilder() |
|
|
|
@ -93,4 +111,5 @@ public class TenantMsgConstructorV1 implements TenantMsgConstructor { |
|
|
|
} |
|
|
|
return builder.build(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|