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