/** * For <a href="http://developer.atlassian.com/jira/browse/MARK-42">MARK-42</a> * * @return Returns a page ID so that suggested labels can be shown. */ @SuppressWarnings("unused") public long getPageId() { return null == page ? 0 : page.getId(); }
private Collection<Page> getUniqueAncestors(List<Page> ancestors) { Set<Page> uniqueAncestors = new LinkedHashSet<Page>(); if (null != ancestors) { Set<Long> ancestorIds = new HashSet<Long>(); for (Page ancestor : ancestors) { long ancestorId = ancestor.getId(); if (!ancestorIds.contains(ancestorId)) { uniqueAncestors.add(ancestor); ancestorIds.add(ancestorId); } } } return uniqueAncestors; }
private void removeThisPageFromList(List<Page> pages, ContentEntityObject thisPage) { pages.removeIf(page -> page.getId() == thisPage.getId()); }
private void cancelPendingAttachmentRemovalJobs(Page thisPage, String resourceName) { AttachmentRemovalJob attachmentRemovalJob = new AttachmentRemovalJob( pageManager, attachmentManager, thisPage.getId(), resourceName ); contentJobQueue.remove(attachmentRemovalJob); }
private void shareWithUsers(Page page, String sharewith, String note) { if (StringUtils.isNotBlank(sharewith)) { Set<String> usersToShare = getUserKeys(Arrays.asList(sharewith.split(","))); ShareRequest shareContent = new ShareRequest.ShareRequestBuilder() .setEntityId(page.getId()) .setEntityTypeValue(ContentType.PAGE.getType()) .setUsers(usersToShare) .setNote(note) .build(); sharePageService.share(shareContent); } }
/** * Render each of the nodes (Pages) in the supplied List to an HTML formatted String. * * @param nodes The list of nodes to be rendered to HTML * @param tocBuilder the class to be informed as nodes relevant to the table of contents are processed * @param bookmarksBuilder the class to be informed as nodes relevant to the bookmarks are processed * @param level the level in the ContentTree currently being processed. * @param fullContentTree the full content tree from which the nodes being rendered are taken. * @param progress a class interested in progress updates about the process * @return a list of the Strings where each String is an HTML version of the page content for each note. */ private List<String> renderContentTreeNodes(List<ContentNode> nodes, TocBuilder tocBuilder, BookmarksBuilder bookmarksBuilder, int level, ContentTree fullContentTree, PdfExportProgressMonitor progress) { List<String> renderedPagesContent = new ArrayList<>(); for (ContentNode node : nodes) { Page page = node.getPage(); String renderedHtml = renderToHtml(page, fullContentTree); renderedPagesContent.add(renderedHtml); progress.completedExportedHtmlConversionForPage(String.valueOf(page.getId()), page.getTitle()); tocBuilder.addEntry(level, page.getTitle()); bookmarksBuilder.beginEntry(page.getTitle()); List<ContentNode> children = node.getChildren(); if (children != null && !children.isEmpty()) { renderedPagesContent.addAll(renderContentTreeNodes(children, tocBuilder, bookmarksBuilder, level + 1, fullContentTree, progress)); } bookmarksBuilder.endEntry(); } return renderedPagesContent; }