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