use of io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto in project seata by seata.
the class GlobalStatusResponseConvertor method convert2Proto.
@Override
public GlobalStatusResponseProto convert2Proto(GlobalStatusResponse 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();
GlobalStatusResponseProto result = GlobalStatusResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto in project seata by seata.
the class GlobalStatusResponseConvertor method convert2Model.
@Override
public GlobalStatusResponse convert2Model(GlobalStatusResponseProto globalStatusResponseProto) {
GlobalStatusResponse branchRegisterResponse = new GlobalStatusResponse();
final AbstractGlobalEndResponseProto abstractGlobalEndResponse = globalStatusResponseProto.getAbstractGlobalEndResponse();
AbstractTransactionResponseProto abstractResultMessage = abstractGlobalEndResponse.getAbstractTransactionResponse();
branchRegisterResponse.setMsg(abstractResultMessage.getAbstractResultMessage().getMsg());
branchRegisterResponse.setResultCode(ResultCode.valueOf(abstractResultMessage.getAbstractResultMessage().getResultCode().name()));
branchRegisterResponse.setTransactionExceptionCode(TransactionExceptionCode.valueOf(abstractResultMessage.getTransactionExceptionCode().name()));
branchRegisterResponse.setGlobalStatus(GlobalStatus.valueOf(abstractGlobalEndResponse.getGlobalStatus().name()));
return branchRegisterResponse;
}
use of io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto in project seata by seata.
the class BranchCommitResponseConvertor method convert2Proto.
@Override
public BranchCommitResponseProto convert2Proto(BranchCommitResponse branchCommitResponse) {
final short typeCode = branchCommitResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = branchCommitResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(branchCommitResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
final AbstractTransactionResponseProto abstractTransactionRequestProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(branchCommitResponse.getTransactionExceptionCode().name())).build();
final AbstractBranchEndResponseProto abstractBranchEndResponse = AbstractBranchEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionRequestProto).setXid(branchCommitResponse.getXid()).setBranchId(branchCommitResponse.getBranchId()).setBranchStatus(BranchStatusProto.forNumber(branchCommitResponse.getBranchStatus().getCode())).build();
BranchCommitResponseProto result = BranchCommitResponseProto.newBuilder().setAbstractBranchEndResponse(abstractBranchEndResponse).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto in project seata by seata.
the class GlobalBeginResponseConvertor method convert2Proto.
@Override
public GlobalBeginResponseProto convert2Proto(GlobalBeginResponse globalBeginResponse) {
final short typeCode = globalBeginResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = globalBeginResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalBeginResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
final AbstractTransactionResponseProto abstractTransactionRequestProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalBeginResponse.getTransactionExceptionCode().name())).build();
final String extraData = globalBeginResponse.getExtraData();
GlobalBeginResponseProto result = GlobalBeginResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionRequestProto).setExtraData(extraData == null ? "" : extraData).setXid(globalBeginResponse.getXid()).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto in project seata by seata.
the class GlobalCommitResponseConvertor method convert2Proto.
@Override
public GlobalCommitResponseProto convert2Proto(GlobalCommitResponse globalCommitResponse) {
final short typeCode = globalCommitResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = globalCommitResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalCommitResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalCommitResponse.getTransactionExceptionCode().name())).build();
AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalCommitResponse.getGlobalStatus().name())).build();
GlobalCommitResponseProto result = GlobalCommitResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
return result;
}
Aggregations