Search in sources :

Example 6 with AbstractTransactionResponseProto

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

the class BranchRegisterResponseConvertor method convert2Proto.

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

Example 7 with AbstractTransactionResponseProto

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

the class BranchReportResponseConvertor method convert2Proto.

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

Example 8 with AbstractTransactionResponseProto

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

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

the class GlobalCommitResponseConvertor method convert2Model.

@Override
public GlobalCommitResponse convert2Model(GlobalCommitResponseProto globalCommitResponseProto) {
    GlobalCommitResponse branchRegisterResponse = new GlobalCommitResponse();
    final AbstractGlobalEndResponseProto abstractGlobalEndResponse = globalCommitResponseProto.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) GlobalCommitResponse(io.seata.core.protocol.transaction.GlobalCommitResponse) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)

Example 10 with AbstractTransactionResponseProto

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

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