Search in sources :

Example 1 with AbstractBranchEndResponseProto

use of io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto in project seata by seata.

the class BranchRollbackResponseConvertor method convert2Proto.

@Override
public BranchRollbackResponseProto convert2Proto(BranchRollbackResponse branchRollbackResponse) {
    final short typeCode = branchRollbackResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = branchRollbackResponse.getMsg();
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(branchRollbackResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    final AbstractTransactionResponseProto abstractTransactionRequestProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(branchRollbackResponse.getTransactionExceptionCode().name())).build();
    final AbstractBranchEndResponseProto abstractBranchEndResponse = AbstractBranchEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionRequestProto).setXid(branchRollbackResponse.getXid()).setBranchId(branchRollbackResponse.getBranchId()).setBranchStatus(BranchStatusProto.forNumber(branchRollbackResponse.getBranchStatus().getCode())).build();
    BranchRollbackResponseProto result = BranchRollbackResponseProto.newBuilder().setAbstractBranchEndResponse(abstractBranchEndResponse).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) BranchRollbackResponseProto(io.seata.serializer.protobuf.generated.BranchRollbackResponseProto) AbstractBranchEndResponseProto(io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 2 with AbstractBranchEndResponseProto

use of io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto 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;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) BranchCommitResponseProto(io.seata.serializer.protobuf.generated.BranchCommitResponseProto) AbstractBranchEndResponseProto(io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Aggregations

AbstractBranchEndResponseProto (io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto)2 AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)2 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)2 AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)2 BranchCommitResponseProto (io.seata.serializer.protobuf.generated.BranchCommitResponseProto)1 BranchRollbackResponseProto (io.seata.serializer.protobuf.generated.BranchRollbackResponseProto)1