Search in sources :

Example 11 with AbstractTransactionResponseProto

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;
}
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 12 with AbstractTransactionResponseProto

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;
}
Also used : AbstractGlobalEndResponseProto(io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) GlobalStatusResponse(io.seata.core.protocol.transaction.GlobalStatusResponse)

Example 13 with AbstractTransactionResponseProto

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;
}
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)

Example 14 with AbstractTransactionResponseProto

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

Example 15 with AbstractTransactionResponseProto

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

Aggregations

AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)15 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)11 AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)10 AbstractGlobalEndResponseProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto)8 AbstractBranchEndResponseProto (io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto)2 GlobalCommitResponse (io.seata.core.protocol.transaction.GlobalCommitResponse)1 GlobalLockQueryResponse (io.seata.core.protocol.transaction.GlobalLockQueryResponse)1 GlobalReportResponse (io.seata.core.protocol.transaction.GlobalReportResponse)1 GlobalRollbackResponse (io.seata.core.protocol.transaction.GlobalRollbackResponse)1 GlobalStatusResponse (io.seata.core.protocol.transaction.GlobalStatusResponse)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