Refactor TenantMsgConstructorFactory to be in sync with others

This commit is contained in:
Andrii Landiak 2023-11-27 16:42:05 +02:00
parent d83d1fe720
commit 1e40daa420

View File

@ -15,31 +15,12 @@
*/ */
package org.thingsboard.server.service.edge.rpc.constructor.tenant; package org.thingsboard.server.service.edge.rpc.constructor.tenant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.thingsboard.server.gen.edge.v1.EdgeVersion;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructorFactory;
@Component @Component
@TbCoreComponent @TbCoreComponent
public class TenantMsgConstructorFactory { public class TenantMsgConstructorFactory extends MsgConstructorFactory<TenantMsgConstructorV1, TenantMsgConstructorV2> {
@Autowired
protected TenantMsgConstructorV1 tenantMsgConstructorV1;
@Autowired
protected TenantMsgConstructorV2 tenantMsgConstructorV2;
public TenantMsgConstructor getMsgConstructorByEdgeVersion(EdgeVersion edgeVersion) {
switch (edgeVersion) {
case V_3_3_0:
case V_3_3_3:
case V_3_4_0:
case V_3_6_0:
case V_3_6_1:
return tenantMsgConstructorV1;
default:
return tenantMsgConstructorV2;
}
}
} }