use of io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto in project seata by seata.
the class RegisterTMResponseConvertor method convert2Model.
@Override
public RegisterTMResponse convert2Model(RegisterTMResponseProto registerTMResponseProto) {
RegisterTMResponse registerRMRequest = new RegisterTMResponse();
AbstractIdentifyResponseProto abstractIdentifyRequestProto = registerTMResponseProto.getAbstractIdentifyResponse();
registerRMRequest.setExtraData(abstractIdentifyRequestProto.getExtraData());
registerRMRequest.setVersion(abstractIdentifyRequestProto.getVersion());
registerRMRequest.setIdentified(abstractIdentifyRequestProto.getIdentified());
registerRMRequest.setMsg(abstractIdentifyRequestProto.getAbstractResultMessage().getMsg());
registerRMRequest.setResultCode(ResultCode.valueOf(abstractIdentifyRequestProto.getAbstractResultMessage().getResultCode().name()));
return registerRMRequest;
}
use of io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto in project seata by seata.
the class RegisterTMResponseConvertor method convert2Proto.
@Override
public RegisterTMResponseProto convert2Proto(RegisterTMResponse registerTMResponse) {
final short typeCode = registerTMResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = registerTMResponse.getMsg();
// for code
if (registerTMResponse.getResultCode() == null) {
if (registerTMResponse.isIdentified()) {
registerTMResponse.setResultCode(ResultCode.Success);
} else {
registerTMResponse.setResultCode(ResultCode.Failed);
}
}
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(registerTMResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
final String extraData = registerTMResponse.getExtraData();
AbstractIdentifyResponseProto abstractIdentifyResponseProto = AbstractIdentifyResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setExtraData(extraData == null ? "" : extraData).setVersion(registerTMResponse.getVersion()).setIdentified(registerTMResponse.isIdentified()).build();
RegisterTMResponseProto result = RegisterTMResponseProto.newBuilder().setAbstractIdentifyResponse(abstractIdentifyResponseProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto 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;
}
use of io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto in project seata by seata.
the class RegisterRMResponseConvertor method convert2Model.
@Override
public RegisterRMResponse convert2Model(RegisterRMResponseProto registerRMResponseProto) {
RegisterRMResponse registerRMRequest = new RegisterRMResponse();
AbstractIdentifyResponseProto abstractIdentifyRequestProto = registerRMResponseProto.getAbstractIdentifyResponse();
registerRMRequest.setExtraData(abstractIdentifyRequestProto.getExtraData());
registerRMRequest.setVersion(abstractIdentifyRequestProto.getVersion());
registerRMRequest.setIdentified(abstractIdentifyRequestProto.getIdentified());
registerRMRequest.setMsg(abstractIdentifyRequestProto.getAbstractResultMessage().getMsg());
registerRMRequest.setResultCode(ResultCode.valueOf(abstractIdentifyRequestProto.getAbstractResultMessage().getResultCode().name()));
return registerRMRequest;
}
Aggregations