Esempio n. 1
0
    public PagingPacket(
        String namespace,
        Paging<T> pagingData,
        DataItemProcessDelegate<T> dataItemProcessDelegate) {

      super(namespace, pagingData.getItems(), dataItemProcessDelegate);
      this.pagingData = pagingData;
      this.setRSM();
    }
Esempio n. 2
0
    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());
    }