use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class GlobalLockQueryResponseConvertor method convert2Proto.
@Override
public GlobalLockQueryResponseProto convert2Proto(GlobalLockQueryResponse globalLockQueryResponse) {
final short typeCode = globalLockQueryResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = globalLockQueryResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalLockQueryResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalLockQueryResponse.getTransactionExceptionCode().name())).build();
GlobalLockQueryResponseProto result = GlobalLockQueryResponseProto.newBuilder().setLockable(globalLockQueryResponse.isLockable()).setAbstractTransactionResponse(abstractTransactionResponseProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto 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.AbstractMessageProto in project seata by seata.
the class RegisterRMRequestConvertor method convert2Proto.
@Override
public RegisterRMRequestProto convert2Proto(RegisterRMRequest registerRMRequest) {
final short typeCode = registerRMRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String extraData = registerRMRequest.getExtraData();
AbstractIdentifyRequestProto abstractIdentifyRequestProto = AbstractIdentifyRequestProto.newBuilder().setAbstractMessage(abstractMessage).setApplicationId(registerRMRequest.getApplicationId()).setExtraData(extraData == null ? "" : extraData).setTransactionServiceGroup(registerRMRequest.getTransactionServiceGroup()).setVersion(registerRMRequest.getVersion()).build();
RegisterRMRequestProto result = RegisterRMRequestProto.newBuilder().setAbstractIdentifyRequest(abstractIdentifyRequestProto).setResourceIds(registerRMRequest.getResourceIds() == null ? "" : registerRMRequest.getResourceIds()).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class BranchCommitRequestConvertor method convert2Proto.
@Override
public BranchCommitRequestProto convert2Proto(BranchCommitRequest branchCommitRequest) {
final short typeCode = branchCommitRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String applicationData = branchCommitRequest.getApplicationData();
final AbstractBranchEndRequestProto abstractBranchEndRequestProto = AbstractBranchEndRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(branchCommitRequest.getXid()).setBranchId(branchCommitRequest.getBranchId()).setBranchType(BranchTypeProto.valueOf(branchCommitRequest.getBranchType().name())).setApplicationData(applicationData == null ? "" : applicationData).setResourceId(branchCommitRequest.getResourceId()).build();
BranchCommitRequestProto result = BranchCommitRequestProto.newBuilder().setAbstractBranchEndRequest(abstractBranchEndRequestProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class BranchRegisterRequestConvertor method convert2Proto.
@Override
public BranchRegisterRequestProto convert2Proto(BranchRegisterRequest branchRegisterRequest) {
final short typeCode = branchRegisterRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String applicationData = branchRegisterRequest.getApplicationData();
final String resourceId = branchRegisterRequest.getResourceId();
final String lockKey = branchRegisterRequest.getLockKey();
BranchRegisterRequestProto result = BranchRegisterRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setApplicationData(applicationData == null ? "" : applicationData).setBranchType(BranchTypeProto.valueOf(branchRegisterRequest.getBranchType().name())).setLockKey(lockKey == null ? "" : lockKey).setResourceId(resourceId == null ? "" : resourceId).setXid(branchRegisterRequest.getXid()).build();
return result;
}
Aggregations