use of io.seata.serializer.protobuf.generated.AbstractBranchEndRequestProto in project seata by seata.
the class BranchRollbackRequestConvertor method convert2Proto.
@Override
public BranchRollbackRequestProto convert2Proto(BranchRollbackRequest branchRollbackRequest) {
final short typeCode = branchRollbackRequest.getTypeCode();
final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
final String applicationData = branchRollbackRequest.getApplicationData();
final String resourceId = branchRollbackRequest.getResourceId();
final AbstractBranchEndRequestProto abstractBranchEndRequestProto = AbstractBranchEndRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(branchRollbackRequest.getXid()).setBranchId(branchRollbackRequest.getBranchId()).setBranchType(BranchTypeProto.valueOf(branchRollbackRequest.getBranchType().name())).setApplicationData(applicationData == null ? "" : applicationData).setResourceId(resourceId == null ? "" : resourceId).build();
BranchRollbackRequestProto result = BranchRollbackRequestProto.newBuilder().setAbstractBranchEndRequest(abstractBranchEndRequestProto).build();
return result;
}
use of io.seata.serializer.protobuf.generated.AbstractBranchEndRequestProto 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;
}
Aggregations