use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class BranchReportRequestConvertor method convert2Proto.
@Override
public BranchReportRequestProto convert2Proto(BranchReportRequest branchReportRequest) {
final short typeCode = branchReportRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String applicationData = branchReportRequest.getApplicationData();
final String resourceId = branchReportRequest.getResourceId();
BranchReportRequestProto result = BranchReportRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(branchReportRequest.getXid()).setBranchId(branchReportRequest.getBranchId()).setBranchType(BranchTypeProto.valueOf(branchReportRequest.getBranchType().name())).setApplicationData(applicationData == null ? "" : applicationData).setResourceId(resourceId == null ? "" : resourceId).setStatus(BranchStatusProto.valueOf(branchReportRequest.getStatus().name())).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class GlobalReportRequestConvertor method convert2Proto.
@Override
public GlobalReportRequestProto convert2Proto(GlobalReportRequest globalReportRequest) {
final short typeCode = globalReportRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String extraData = globalReportRequest.getExtraData();
AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(globalReportRequest.getXid()).setExtraData(extraData == null ? "" : extraData).build();
GlobalReportRequestProto result = GlobalReportRequestProto.newBuilder().setAbstractGlobalEndRequest(abstractGlobalEndRequestProto).setGlobalStatus(GlobalStatusProto.valueOf(globalReportRequest.getGlobalStatus().name())).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class GlobalStatusRequestConvertor method convert2Proto.
@Override
public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) {
final short typeCode = globalStatusRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String extraData = globalStatusRequest.getExtraData();
AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(globalStatusRequest.getXid()).setExtraData(extraData == null ? "" : extraData).build();
GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest(abstractGlobalEndRequestProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.
the class BranchCommitResponseConvertor method convert2Proto.
@Override
public BranchCommitResponseProto convert2Proto(BranchCommitResponse branchCommitResponse) {
final short typeCode = branchCommitResponse.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final String msg = branchCommitResponse.getMsg();
final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(branchCommitResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
final AbstractTransactionResponseProto abstractTransactionRequestProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(branchCommitResponse.getTransactionExceptionCode().name())).build();
final AbstractBranchEndResponseProto abstractBranchEndResponse = AbstractBranchEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionRequestProto).setXid(branchCommitResponse.getXid()).setBranchId(branchCommitResponse.getBranchId()).setBranchStatus(BranchStatusProto.forNumber(branchCommitResponse.getBranchStatus().getCode())).build();
BranchCommitResponseProto result = BranchCommitResponseProto.newBuilder().setAbstractBranchEndResponse(abstractBranchEndResponse).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractMessageProto 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;
}
Aggregations