private File checkWriteToTempFile() throws IOException { Page thisPage = getPage(); File exportedContent = new File(GeneralUtil.getConfluenceTempDirectory(), "webdav-" + thisPage.getIdAsString() + getExportSuffix()); if (!exportedContent.exists() || exportedContent.lastModified() < thisPage.getLastModificationDate().getTime()) { InputStream in = null; OutputStream out = null; try { in = getContentInternal(); out = new BufferedOutputStream(new FileOutputStream(exportedContent)); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(out); IOUtils.closeQuietly(in); } } return exportedContent; }
private void populateLinkFixer(LinkFixer linkFixer, ContentTree contentTree, Collection<Page> additionalInternalPages) { List<ContentNode> contentNodes = contentTree.getAllContentNodes(); for (ContentNode node : contentNodes) { Page p = node.getPage(); linkFixer.addPage(p.getIdAsString(), p.getTitle()); } additionalInternalPages.forEach(p -> linkFixer.addPage(p.getIdAsString(), p.getTitle())); }
@Override public Map<String, ?> getPage(String authenticationToken, String pageId) { Page page = pageManager.getPage(Long.parseLong(pageId)); Map<String, Object> pageStruct = null; if (null != page && permissionManager.hasPermission(AuthenticatedUserThreadLocal.getUser(), Permission.VIEW, page)) { pageStruct = new Hashtable<String, Object>(); pageStruct.put("id", page.getIdAsString()); pageStruct.put("spaceKey", page.getSpaceKey()); Page parentPage = page.getParent(); if (null != parentPage) pageStruct.put("parentId", page.getParent().getIdAsString()); pageStruct.put("title", page.getTitle()); pageStruct.put("version", page.getVersion()); pageStruct.put("content", page.getBodyAsString()); if (StringUtils.isNotBlank(page.getCreatorName())) pageStruct.put("creator", page.getCreatorName()); pageStruct.put("created", page.getCreationDate()); if (StringUtils.isNotBlank(page.getLastModifierName())) pageStruct.put("lastModifier", page.getLastModifierName()); pageStruct.put("lastModified", page.getLastModificationDate()); } return pageStruct; }
LOG.debug(String.format("Create new bookmark page with ID %s", bookmarkPage.getIdAsString())); LOG.debug(String.format("Updated bookmark page with ID %s", bookmarkPage.getIdAsString()));