Search in sources :

Example 6 with AbstractResultMessageProto

use of io.seata.serializer.protobuf.generated.AbstractResultMessageProto 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 7 with AbstractResultMessageProto

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

the class RegisterTMResponseConvertor method convert2Proto.

@Override
public RegisterTMResponseProto convert2Proto(RegisterTMResponse registerTMResponse) {
    final short typeCode = registerTMResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = registerTMResponse.getMsg();
    // for code
    if (registerTMResponse.getResultCode() == null) {
        if (registerTMResponse.isIdentified()) {
            registerTMResponse.setResultCode(ResultCode.Success);
        } else {
            registerTMResponse.setResultCode(ResultCode.Failed);
        }
    }
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(registerTMResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    final String extraData = registerTMResponse.getExtraData();
    AbstractIdentifyResponseProto abstractIdentifyResponseProto = AbstractIdentifyResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setExtraData(extraData == null ? "" : extraData).setVersion(registerTMResponse.getVersion()).setIdentified(registerTMResponse.isIdentified()).build();
    RegisterTMResponseProto result = RegisterTMResponseProto.newBuilder().setAbstractIdentifyResponse(abstractIdentifyResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterTMResponseProto(io.seata.serializer.protobuf.generated.RegisterTMResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 8 with AbstractResultMessageProto

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

the class GlobalLockQueryResponseConvertor method convert2Proto.

@Override
public GlobalLockQueryResponseProto convert2Proto(GlobalLockQueryResponse globalLockQueryResponse) {
    final short typeCode = globalLockQueryResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = globalLockQueryResponse.getMsg();
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalLockQueryResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalLockQueryResponse.getTransactionExceptionCode().name())).build();
    GlobalLockQueryResponseProto result = GlobalLockQueryResponseProto.newBuilder().setLockable(globalLockQueryResponse.isLockable()).setAbstractTransactionResponse(abstractTransactionResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) GlobalLockQueryResponseProto(io.seata.serializer.protobuf.generated.GlobalLockQueryResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 9 with AbstractResultMessageProto

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

Example 10 with AbstractResultMessageProto

use of io.seata.serializer.protobuf.generated.AbstractResultMessageProto 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

AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)15 AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)12 AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)11 AbstractGlobalEndResponseProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto)4 AbstractBranchEndResponseProto (io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto)2 AbstractIdentifyResponseProto (io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto)2 BranchRegisterResponse (io.seata.core.protocol.transaction.BranchRegisterResponse)1 BranchReportResponse (io.seata.core.protocol.transaction.BranchReportResponse)1 GlobalLockQueryResponse (io.seata.core.protocol.transaction.GlobalLockQueryResponse)1 BranchCommitResponseProto (io.seata.serializer.protobuf.generated.BranchCommitResponseProto)1 BranchRegisterResponseProto (io.seata.serializer.protobuf.generated.BranchRegisterResponseProto)1 BranchReportResponseProto (io.seata.serializer.protobuf.generated.BranchReportResponseProto)1 BranchRollbackResponseProto (io.seata.serializer.protobuf.generated.BranchRollbackResponseProto)1 GlobalBeginResponseProto (io.seata.serializer.protobuf.generated.GlobalBeginResponseProto)1 GlobalCommitResponseProto (io.seata.serializer.protobuf.generated.GlobalCommitResponseProto)1 GlobalLockQueryResponseProto (io.seata.serializer.protobuf.generated.GlobalLockQueryResponseProto)1 GlobalReportResponseProto (io.seata.serializer.protobuf.generated.GlobalReportResponseProto)1 GlobalRollbackResponseProto (io.seata.serializer.protobuf.generated.GlobalRollbackResponseProto)1 GlobalStatusResponseProto (io.seata.serializer.protobuf.generated.GlobalStatusResponseProto)1 RegisterRMResponseProto (io.seata.serializer.protobuf.generated.RegisterRMResponseProto)1