Fix ComponentLifecycleMsg: message and builder
This commit is contained in:
parent
85f2fcd4d5
commit
44a7bf82c4
@ -26,6 +26,7 @@ import org.thingsboard.server.common.msg.MsgType;
|
||||
import org.thingsboard.server.common.msg.aware.TenantAwareMsg;
|
||||
import org.thingsboard.server.common.msg.cluster.ToAllNodesMsg;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@ -33,6 +34,8 @@ import java.util.Optional;
|
||||
*/
|
||||
@Data
|
||||
public class ComponentLifecycleMsg implements TenantAwareMsg, ToAllNodesMsg {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5303421482781273062L;
|
||||
|
||||
private final TenantId tenantId;
|
||||
@ -66,4 +69,5 @@ public class ComponentLifecycleMsg implements TenantAwareMsg, ToAllNodesMsg {
|
||||
public MsgType getMsgType() {
|
||||
return MsgType.COMPONENT_LIFE_CYCLE_MSG;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ public class ProtoUtils {
|
||||
builder.setName(msg.getName());
|
||||
}
|
||||
if (msg.getOldName() != null) {
|
||||
builder.setName(msg.getOldName());
|
||||
builder.setOldName(msg.getOldName());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
@ -149,8 +149,8 @@ public class ProtoUtils {
|
||||
.tenantId(TenantId.fromUUID(new UUID(proto.getTenantIdMSB(), proto.getTenantIdLSB())))
|
||||
.entityId(entityId)
|
||||
.event(ComponentLifecycleEvent.values()[proto.getEventValue()])
|
||||
.name(proto.getName())
|
||||
.oldName(proto.getOldName());
|
||||
.name(proto.hasName() ? proto.getName() : null)
|
||||
.oldName(proto.hasOldName() ? proto.getOldName() : null);
|
||||
if (proto.getProfileIdMSB() != 0 || proto.getProfileIdLSB() != 0) {
|
||||
var profileType = EntityType.DEVICE.equals(entityId.getEntityType()) ? EntityType.DEVICE_PROFILE : EntityType.ASSET_PROFILE;
|
||||
builder.profileId(EntityIdFactory.getByTypeAndUuid(profileType, new UUID(proto.getProfileIdMSB(), proto.getProfileIdLSB())));
|
||||
@ -166,7 +166,6 @@ public class ProtoUtils {
|
||||
return entityTypeByProtoNumber[entityType.getNumber()];
|
||||
}
|
||||
|
||||
|
||||
public static TransportProtos.ToEdgeSyncRequestMsgProto toProto(ToEdgeSyncRequest request) {
|
||||
return TransportProtos.ToEdgeSyncRequestMsgProto.newBuilder()
|
||||
.setTenantIdMSB(request.getTenantId().getId().getMostSignificantBits())
|
||||
|
||||
@ -1188,8 +1188,8 @@ message ComponentLifecycleMsgProto {
|
||||
int64 entityIdLSB = 5;
|
||||
ComponentLifecycleEvent event = 6;
|
||||
//Since 4.0. To replace the
|
||||
string oldName = 7;
|
||||
string name = 8;
|
||||
optional string oldName = 7;
|
||||
optional string name = 8;
|
||||
int64 oldProfileIdMSB = 9;
|
||||
int64 oldProfileIdLSB = 10;
|
||||
int64 profileIdMSB = 11;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user