Search in sources :

Example 11 with AbstractResultMessageProto

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

the class BranchRegisterResponseConvertor method convert2Model.

@Override
public BranchRegisterResponse convert2Model(BranchRegisterResponseProto branchRegisterResponseProto) {
    BranchRegisterResponse branchRegisterResponse = new BranchRegisterResponse();
    branchRegisterResponse.setBranchId(branchRegisterResponseProto.getBranchId());
    final AbstractResultMessageProto abstractResultMessage = branchRegisterResponseProto.getAbstractTransactionResponse().getAbstractResultMessage();
    branchRegisterResponse.setMsg(abstractResultMessage.getMsg());
    branchRegisterResponse.setResultCode(ResultCode.valueOf(abstractResultMessage.getResultCode().name()));
    branchRegisterResponse.setTransactionExceptionCode(TransactionExceptionCode.valueOf(branchRegisterResponseProto.getAbstractTransactionResponse().getTransactionExceptionCode().name()));
    return branchRegisterResponse;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) BranchRegisterResponse(io.seata.core.protocol.transaction.BranchRegisterResponse)

Example 12 with AbstractResultMessageProto

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

the class BranchReportResponseConvertor method convert2Model.

@Override
public BranchReportResponse convert2Model(BranchReportResponseProto branchReportResponseProto) {
    BranchReportResponse branchRegisterResponse = new BranchReportResponse();
    final AbstractResultMessageProto abstractResultMessage = branchReportResponseProto.getAbstractTransactionResponse().getAbstractResultMessage();
    branchRegisterResponse.setMsg(abstractResultMessage.getMsg());
    branchRegisterResponse.setResultCode(ResultCode.valueOf(abstractResultMessage.getResultCode().name()));
    branchRegisterResponse.setTransactionExceptionCode(TransactionExceptionCode.valueOf(branchReportResponseProto.getAbstractTransactionResponse().getTransactionExceptionCode().name()));
    return branchRegisterResponse;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) BranchReportResponse(io.seata.core.protocol.transaction.BranchReportResponse)

Example 13 with AbstractResultMessageProto

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

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

Example 15 with AbstractResultMessageProto

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

the class RegisterRMResponseConvertor method convert2Proto.

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