Search in sources :

Example 1 with AbstractIdentifyResponseProto

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;
}
Also used : AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterTMResponse(io.seata.core.protocol.RegisterTMResponse)

Example 2 with AbstractIdentifyResponseProto

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;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterTMResponseProto(io.seata.serializer.protobuf.generated.RegisterTMResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 3 with AbstractIdentifyResponseProto

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;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterRMResponseProto(io.seata.serializer.protobuf.generated.RegisterRMResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 4 with AbstractIdentifyResponseProto

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;
}
Also used : AbstractIdentifyResponseProto(io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto) RegisterRMResponse(io.seata.core.protocol.RegisterRMResponse)

Aggregations

AbstractIdentifyResponseProto (io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto)4 AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)2 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)2 RegisterRMResponse (io.seata.core.protocol.RegisterRMResponse)1 RegisterTMResponse (io.seata.core.protocol.RegisterTMResponse)1 RegisterRMResponseProto (io.seata.serializer.protobuf.generated.RegisterRMResponseProto)1 RegisterTMResponseProto (io.seata.serializer.protobuf.generated.RegisterTMResponseProto)1