use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class GlobalReportResponseConvertor method convert2Proto.
@Override
public GlobalReportResponseProto convert2Proto(GlobalReportResponse globalStatusResponse) {
final short typeCode = globalStatusResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = globalStatusResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalStatusResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalStatusResponse.getTransactionExceptionCode().name())).build();
AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalStatusResponse.getGlobalStatus().name())).build();
GlobalReportResponseProto result = GlobalReportResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class GlobalRollbackResponseConvertor method convert2Proto.
@Override
public GlobalRollbackResponseProto convert2Proto(GlobalRollbackResponse globalRollbackResponse) {
final short typeCode = globalRollbackResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = globalRollbackResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalRollbackResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalRollbackResponse.getTransactionExceptionCode().name())).build();
AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalRollbackResponse.getGlobalStatus().name())).build();
GlobalRollbackResponseProto result = GlobalRollbackResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class MergedWarpMessageConvertor method convert2Proto.
@Override
public MergedWarpMessageProto convert2Proto(MergedWarpMessage mergedWarpMessage) {
final short typeCode = mergedWarpMessage.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
List<Any> lists = new ArrayList<>();
for (AbstractMessage msg : mergedWarpMessage.msgs) {
final PbConvertor pbConvertor = ProtobufConvertManager.getInstance().fetchConvertor(msg.getClass().getName());
lists.add(Any.pack((Message) pbConvertor.convert2Proto(msg)));
}
MergedWarpMessageProto mergedWarpMessageProto = MergedWarpMessageProto.newBuilder().setAbstractMessage(abstractMessage).addAllMsgs(lists).addAllMsgIds(mergedWarpMessage.msgIds).build();
return mergedWarpMessageProto;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class RegisterTMRequestConvertor method convert2Proto.
@Override
public RegisterTMRequestProto convert2Proto(RegisterTMRequest registerTMRequest) {
final short typeCode = registerTMRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String extraData = registerTMRequest.getExtraData();
AbstractIdentifyRequestProto abstractIdentifyRequestProto = AbstractIdentifyRequestProto.newBuilder().setAbstractMessage(abstractMessage).setApplicationId(registerTMRequest.getApplicationId()).setExtraData(extraData == null ? "" : extraData).setTransactionServiceGroup(registerTMRequest.getTransactionServiceGroup()).setVersion(registerTMRequest.getVersion()).build();
RegisterTMRequestProto result = RegisterTMRequestProto.newBuilder().setAbstractIdentifyRequest(abstractIdentifyRequestProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class UndoLogDeleteRequestConvertor method convert2Proto.
@Override
public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) {
final short typeCode = undoLogDeleteRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setSaveDays(undoLogDeleteRequest.getSaveDays()).setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())).setResourceId(undoLogDeleteRequest.getResourceId()).build();
return undoLogDeleteRequestProto;
}
Aggregations