private void setRSM() {
      RSMPacketExtension pagingInfo = new RSMPacketExtension();
      pagingInfo.setCount(pagingData.getCount());

      if (pagingData.getCount() > 0) {
        List<T> dataItems = pagingData.getItems();

        if (dataItems.size() > 0) {
          pagingInfo.setFirstValue(
              delegate.getPrimaryProperty(dataItems.get(0)), pagingData.getOffset());

          pagingInfo.setLastValue(delegate.getPrimaryProperty(dataItems.get(dataItems.size() - 1)));
        }
      }
      this.element.add(pagingInfo.getElement());
    }
  @Override
  public void process(IQ packet) {
    Paging<GroupInfo> paging;
    try {
      /* 分页查询圈子数据 */
      RSMPacketExtension rsm = QueryInfo.getRSM(packet);
      paging = groupManager.search(QueryInfo.getQuery(packet), rsm.getIndex(0), rsm.getMax(10));
    } catch (Exception e) {
      handleException(e, "搜索圈子失败");
      replyError(packet, PacketError.Condition.internal_server_error);
      return;
    }

    /* 构建分页数据包 */
    PagingPacket pagingPacket =
        new PagingPacket(
            SEARCH_NAMESPACE,
            paging,
            new GroupSummaryProcessDelegate(groupService.getServiceDomain()));

    IQ reply = IQ.createResultIQ(packet);
    reply.setChildElement(pagingPacket.getElement());
    routePacket(reply);
  }
 public static RSMPacketExtension getRSM(IQ packet) {
   RSMPacketExtension rsm = RSMPacketExtension.getRSM(packet);
   return rsm != null ? rsm : new RSMPacketExtension();
 }