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