Search in sources :

Example 6 with AbstractGlobalEndResponseProto

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

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

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

AbstractGlobalEndResponseProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto)8 AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)8 AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)4 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)4 GlobalCommitResponse (io.seata.core.protocol.transaction.GlobalCommitResponse)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 GlobalCommitResponseProto (io.seata.serializer.protobuf.generated.GlobalCommitResponseProto)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