Package org.codehaus.swizzle.confluence

Examples of org.codehaus.swizzle.confluence.Page


        } catch (Exception e) {
            // Now we throw exception if the space already exists
        }

        pageTitle = "SomeContainerPage";
        Page p = new Page();
        p.setSpace(spaceKey);
        p.setTitle(pageTitle);
        p.setContent("");
        // no id in pageProperties means storePage will add
        Page resultPage = rpc.storePage(p);
        pageId = resultPage.getId();

        // add and remove one comment (makes test more realistic)
        Comment comment = new Comment();
        comment.setPageId(pageId);
        comment.setContent("Dummy Comment");
View Full Code Here


        return "Checking orphans for " + fullPageName;
    }

    public void testPageIsOrphaned() throws Exception
    {
        Page page = this.rpc.getPage(fullPageName);
        assertTrue("Page " + page.getId() + " is orphaned!", isRoot(page) || hasParent(page));
    }
View Full Code Here

        if (validate(username) && validate(password)) {
            try {
                String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

        if (validate(username) && validate(password)) {
            try {
                String endpoint = "https://cwiki.apache.org/confluence/rpc/xmlrpc";
                Confluence confluence = new Confluence(endpoint);
                confluence.login(username, password);
                Page page = confluence.getPage("OPENEJB", "Validation Keys Audit Report");
                page.setContent(confluenceOutput);
                confluence.storePage(page);
                confluence.logout();
            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

            } catch (Exception e) {
                throw new RuntimeException("Failed to connect to Confluence endpoint [" + endpointURL + "].", e);
            }

            try {
                Page basePage = publishConfluenceBasePage(confluence);
                //removeDescendantPages(confluence, basePage);
                publishPluginPage(plugin, confluencePluginOutputFile, confluence, basePage);
                publishConfluenceResourceTypePages(null, resourceTypes, plugin, confluenceOutputDir, confluence);
            } catch (Exception e) {
                throw new RuntimeException("Failed to publish plugin docs to Confluence endpoint [" + endpointURL
View Full Code Here

        }
    }

    private void removeDescendantPages(Confluence confluence, Page basePage) throws Exception {
        List<PageSummary> descendantPages = confluence.getDescendents(basePage.getId());
        Page trashbin = getPage(confluence, "TRASHBIN");
        for (PageSummary descendantPage : descendantPages) {
            Page page = confluence.getPage(descendantPage);
            page.setParentId(trashbin.getId());
            page = storePage(confluence, page);
            confluence.removePage(page.getId());
        }
    }
View Full Code Here

    }

    private void publishPluginPage(Plugin plugin, File confluencePluginOutputFile, Confluence confluence, Page basePage)
            throws Exception {
        String pluginPageTitle = getPageTitle(plugin);
        Page pluginPage = getPage(confluence, pluginPageTitle);
        if (pluginPage == null) {
            pluginPage = createPage(pluginPageTitle);
        } else {
            log.warn("Page with title '" + pluginPageTitle + "' already exists - overwriting it...");
        }
        pluginPage.setContent(getContentAsString(confluencePluginOutputFile));
        pluginPage.setParentId(basePage.getId());
        storePage(confluence, pluginPage);
    }
View Full Code Here

                                                   ResourceType parentType, Confluence confluence)
        throws PluginDocGeneratorException {
        System.out.println("*** Publishing plugin doc page for " + resourceType + " Resource type to Confluence...");
        String pageTitle = getPageTitle(resourceType, parentType);
        try {
            Page page = getPage(confluence, pageTitle);
            if (page == null) {
                page = createPage(pageTitle);
            } else {
                log.warn("Page with title '" + pageTitle + "' already exists - overwriting it...");
            }

            String parentPageTitle;
            if (resourceType.getParentResourceTypes().isEmpty()) {
                // root platform or server
                parentPageTitle = getPageTitle(plugin);
            } else {
                if (parentType == null) {
                    parentType = resourceType.getParentResourceTypes().iterator().next();
                }
                parentPageTitle = getPageTitle(parentType, null);
            }
            Page parentPage = getPage(confluence, parentPageTitle);
            if (parentPage != null) {
                page.setParentId(parentPage.getId());
            } else {
                log.warn("Parent page [" + parentPageTitle + "] for page [" + pageTitle + "] not found - page will have no parent for now.");
            }
            File contentFile = getConfluenceResourceTypeOutputFile(outputDir, plugin, resourceType);
            page.setContent(getContentAsString(contentFile));
View Full Code Here

            throw new PluginDocGeneratorException("Failed to publish page [" + pageTitle + "] to Confluence.", e);
        }
    }

    private Page publishConfluenceBasePage(Confluence confluence) throws Exception {
        Page baseParentPage = getPage(confluence, this.confluenceParentPageTitle);
        if (baseParentPage == null) {
            baseParentPage = createPage(this.confluenceParentPageTitle);
        } else {
            log.warn("Page with title '" + this.confluenceParentPageTitle + "' already exists - overwriting it...");
        }
        baseParentPage.setContent("{children}\n");
        Page homePage = getPage(confluence, "Home");
        baseParentPage.setParentId(homePage.getId());
        baseParentPage = storePage(confluence, baseParentPage);

        return baseParentPage;
    }
View Full Code Here

        confluence.login(this.confluenceUserName, this.confluencePassword);
        return confluence;
    }

    private Page storePage(Confluence confluence, Page page) throws Exception {
        Page parentPage = getParentPage(confluence, page);
        String parentPageTitle = (parentPage != null) ? parentPage.getTitle() : null;

        System.out.println("Storing page [" + page.getTitle() + "] with parent page [" + parentPageTitle + "]...");
        Page storedPage;
        try {
            storedPage = confluence.storePage(page);
        } catch (SwizzleException e) {
            throw new Exception("Failed to publish page [" + page.getTitle() + "] with parent page [" + parentPageTitle
                    + "]: " + e.getMessage());
        }

        parentPage = getParentPage(confluence, storedPage);
        parentPageTitle = (parentPage != null) ? parentPage.getTitle() : null;
        System.out.println("Stored page [" + storedPage.getTitle() + "] with ID [" + storedPage.getId()
                + "] and parent page [" + parentPageTitle + "].");
        return storedPage;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.swizzle.confluence.Page

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.