Tabnine Logo
PartialList.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.nuxeo.ecm.core.api.PartialList
constructor

Best Java code snippets using org.nuxeo.ecm.core.api.PartialList.<init> (Showing top 8 results out of 315)

origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public PartialList<E> subList(int fromIndex, int toIndex) {
  return new PartialList<>(list.subList(fromIndex, toIndex), totalSize);
}
origin: org.nuxeo.ecm.platform/nuxeo-platform-comment

@Override
public PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize,
    Long currentPageIndex, boolean sortAscending) throws CommentSecurityException {
  List<Comment> firstComments = first.getComments(session, documentId, pageSize, currentPageIndex, sortAscending);
  List<Comment> secondComments = second.getComments(session, documentId, pageSize, currentPageIndex,
      sortAscending);
  List<Comment> allComments = Stream.concat(firstComments.stream(), secondComments.stream())
                   .distinct()
                   .collect(Collectors.toList());
  return new PartialList<>(allComments, allComments.size());
}
origin: org.nuxeo.ecm.platform/nuxeo-platform-comment

@Override
@SuppressWarnings("unchecked")
public PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize,
    Long currentPageIndex, boolean sortAscending) throws CommentSecurityException {
  DocumentRef docRef = new IdRef(documentId);
  if (!session.exists(docRef)) {
    return new PartialList<>(Collections.emptyList(), 0);
  }
  DocumentModel commentedDoc = session.getDocument(docRef);
  // do a dummy implementation of pagination for former comment manager implementation
  List<DocumentModel> comments = getComments(commentedDoc);
  long maxSize = pageSize == null || pageSize <= 0 ? comments.size() : pageSize;
  long offset = currentPageIndex == null || currentPageIndex <= 0 ? 0 : currentPageIndex * pageSize;
  return comments.stream()
          .sorted(Comparator.comparing(doc -> (Calendar) doc.getPropertyValue("dc:created")))
          .skip(offset)
          .limit(maxSize)
          .map(Comments::newComment)
          .collect(collectingAndThen(toList(), list -> new PartialList<>(list, comments.size())));
}
origin: org.nuxeo.ecm.core/nuxeo-core-storage-mem

  log.trace("Mem:    -> " + projections.size());
return new PartialList<>(projections, totalSize);
origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql

return new PartialList<>(list, pl.totalSize());
origin: org.nuxeo.ecm.platform/nuxeo-platform-comment

@Override
@SuppressWarnings("unchecked")
public PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize,
    Long currentPageIndex, boolean sortAscending) throws CommentSecurityException {
  DocumentRef docRef = new IdRef(documentId);
  PageProviderService ppService = Framework.getService(PageProviderService.class);
  NuxeoPrincipal principal = session.getPrincipal();
  return CoreInstance.doPrivileged(session, s -> {
    if (s.exists(docRef)) {
      DocumentRef ancestorRef = getAncestorRef(s, s.getDocument(docRef));
      if (s.exists(ancestorRef) && !s.hasPermission(principal, ancestorRef, SecurityConstants.READ)) {
        throw new CommentSecurityException("The user " + principal.getName()
            + " does not have access to the comments of document " + documentId);
      }
    }
    Map<String, Serializable> props = Collections.singletonMap(CORE_SESSION_PROPERTY, (Serializable) s);
    PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) ppService.getPageProvider(
        GET_COMMENTS_FOR_DOC_PAGEPROVIDER_NAME,
        singletonList(new SortInfo(COMMENT_CREATION_DATE, sortAscending)), pageSize, currentPageIndex,
        props, documentId);
    List<DocumentModel> commentList = pageProvider.getCurrentPage();
    return commentList.stream()
             .map(Comments::newComment)
             .collect(collectingAndThen(toList(),
                 list -> new PartialList<>(list, pageProvider.getResultsCount())));
  });
}
origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql

return new PartialList<>(Collections.emptyList(), 0);
  return new PartialList<>(projections, totalSize);
origin: org.nuxeo.ecm.core/nuxeo-core-storage-mongodb

  log.trace("MongoDB:    -> " + projections.size());
return new PartialList<>(projections, totalSize);
org.nuxeo.ecm.core.apiPartialList<init>

Javadoc

Constructs a partial list.

Popular methods of PartialList

  • size
  • totalSize
    Returns the total size of the bigger list this is a part of.
  • get
  • isEmpty
  • stream

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now