private Document createDocument(Page page, LinkRenderingDetails linkDetails, DecorationPolicy decoration) { Document xhtml; ContentTree tree = new ContentTree(); tree.addRootNode(new ContentNode(page)); try { xhtml = intermediateHtmlBuilder.buildHtml(tree, page.getSpace(), linkDetails, decoration); } catch (ImportExportException e) { log.error("error build xml dom", e); throw new RuntimeException(e); } return xhtml; }
private void createPage(String newPageTitle) throws DavException { Page thisPage = getPage(); Page newPage = new Page(); newPage.setSpace(thisPage.getSpace()); /* Check for invalid page title */ if (isPageTitleValid(newPageTitle)) { /* Check for (A Document Being Saved By Text Edit) created by TextEdit and stop the page creation */ ConfluenceDavSession confluenceDavSession = (ConfluenceDavSession) getSession(); if (isTextEditCreatingTempFolder(newPageTitle, confluenceDavSession)) throw new DavException(HttpServletResponse.SC_FORBIDDEN, "This plugin does not allow creation of page with the title \"" + TEXTEDIT_TEMP_FOLDER_NAME + "\". See http://developer.atlassian.com/jira/browse/WBDV-143 for more information."); newPage.setTitle(newPageTitle); /* Check for duplicate page creation. */ if (null == pageManager.getPage(newPage.getSpaceKey(), newPage.getTitle())) { newPage.setParentPage(thisPage); newPage.setCreatorName(AuthenticatedUserThreadLocal.getUser().getName()); thisPage.addChild(newPage); pageManager.saveContentEntity(newPage, null); } else { throw new DavException(HttpServletResponse.SC_FORBIDDEN, "Page creation denied. Page " + newPageTitle + " is not unique in space " + newPage.getSpaceKey()); } } else { throw new DavException(HttpServletResponse.SC_FORBIDDEN, "Page creation denied. New page name has invalid characters in the title: " + newPageTitle); } }
Page newChildPage = new Page(); newChildPage.setTitle(generateUniquePageTitle(childPage.getSpaceKey(), childPage.getTitle())); newChildPage.setSpace(childPage.getSpace()); newChildPage.setBodyContent(childPage.getBodyContent()); newChildPage.setParentPage(parent);
if (e instanceof PageEvent) { entityType = Page.CONTENT_TYPE; eventSpace = ((PageEvent) e).getPage().getSpace(); } else if (e instanceof SpaceEvent) { entityId = ((SpaceEvent) e).getSpace().getId();
@EventListener public void onBlueprintCreateEvent(BlueprintPageCreateEvent event) { ModuleCompleteKey moduleCompleteKey = event.getBlueprintKey(); if (!SHARELINKS_BLUEPRINT_KEY.equals(moduleCompleteKey)) { return; } Page blueprintPage = event.getPage(); Map<String, Object> context = event.getContext(); String comment = (String) context.get("comment"); String shareWith = (String) context.get("sharewith"); String label = (String) context.get("label"); if (logger.isDebugEnabled()) { logger.debug("Event caught with context {}", event.getContext()); } if (permissionManager.hasCreatePermission(getUser(), event.getPage().getSpace(), Comment.class)) { addCommentIfNotBlank(blueprintPage, comment); } addLabelIfNotBlank(blueprintPage, label); //send share-page request shareWithUsers(blueprintPage, shareWith, comment); }
Space oldBookmarkSpace = bookmarkPage.getSpace(); if (!StringUtils.equals(oldBookmarkSpace.getKey(), bookmarkSpace.getKey())) pageManager.movePageAsChild(bookmarkPage, bookmarkParent);
if (permissionManager.hasCreatePermission(user, thisPage.getSpace(), Page.class)) { ResourceStates resourceStates = ((ConfluenceDavSession) getSession()).getResourceStates();