Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-16101

Drive: test override of folder item children PageProvider

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0-HF26, 7.1
    • Component/s: Nuxeo Drive

      Description

      Default contribution sets pageSize and maxPageSize to 1000: as we don't use pagination when fetching children, getting only the current page, we need to be sure we fetch all the child documents in most of the cases, yet having a limit for obvious performance reasons.

      See DocumentBackedFolderItem#getChildren:

      public List<FileSystemItem> getChildren() throws ClientException {
              PageProviderService pageProviderService = Framework.getLocalService(PageProviderService.class);
              Map<String, Serializable> props = new HashMap<String, Serializable>();
              props.put(CORE_SESSION_PROPERTY, (Serializable) getSession());
              PageProvider<DocumentModel> childrenPageProvider = (PageProvider<DocumentModel>) pageProviderService.getPageProvider(
                      FOLDER_ITEM_CHILDREN_PAGE_PROVIDER, null, null, 0L, props,
                      docId);
              List<DocumentModel> dmChildren = childrenPageProvider.getCurrentPage();
      
              List<FileSystemItem> children = new ArrayList<FileSystemItem>(
                      dmChildren.size());
              for (DocumentModel dmChild : dmChildren) {
                  FileSystemItem child = getFileSystemItemAdapterService().getFileSystemItem(
                          dmChild, this);
                  if (child != null) {
                      children.add(child);
                  }
              }
              return children;
          }
      

      And nuxeodrive-pageproviders-contrib.xml:

          <coreQueryPageProvider name="FOLDER_ITEM_CHILDREN">
            <pattern>
              SELECT * FROM Document WHERE ecm:parentId = ?
              AND ecm:isCheckedInVersion = 0
              AND ecm:isProxy = 0
              AND ecm:currentLifeCycleState != 'deleted'
              AND ecm:mixinType != 'HiddenInNavigation'
            </pattern>
            <sort column="dc:created" ascending="true" />
            <pageSize>1000</pageSize>
            <maxPageSize>1000</maxPageSize>
            <property name="maxResults">PAGE_SIZE</property>
          </coreQueryPageProvider>
      

      In case this limit is not enough, the PageProvider can be overridden, as suggested in https://jira.nuxeo.com/browse/SUPNXP-11989?focusedCommentId=201193&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-201193

      Let's have a unit test to ensure that this overridden contribution is taken into account.

      PS: ideally we could use batching from Drive and lower page size.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: