Package org.apache.wiki

Examples of org.apache.wiki.WikiPage


   * Test with the include parameter
   *
   * @throws Exception
   */
  public void testParmInClude() throws Exception {
    context = new WikiContext(testEngine, new WikiPage(testEngine, "TestPage02"));

    String res = manager
        .execute(context,
            "{INSERT org.apache.wiki.plugin.RecentChangesPlugin include='TestPage02*'}");

 
View Full Code Here


   * Test with the exclude parameter
   *
   * @throws Exception
   */
  public void testParmExClude() throws Exception {
    context = new WikiContext(testEngine, new WikiPage(testEngine, "TestPage03"));

    String res = manager
        .execute(context,
            "{INSERT org.apache.wiki.plugin.RecentChangesPlugin exclude='TestPage03*'}");

 
View Full Code Here

        FileUtil.copyContents( new StringReader(content), out );
        out.close();
       
        Thread.sleep( 4000L ); // Make sure we wait long enough
       
        WikiPage p = engine.getPage( "Testi" );
        assertNotNull( "page did not exist?", p );
       
        String text = engine.getText( "Testi");
        assertEquals("text", "[fuufaa]", text );
       
View Full Code Here

        engine.saveText( "Foobar4", "Reference to [TestPage]." );
        engine.saveText( "Foobar5", "Reference to [TestPage]." );
        engine.saveText( "Foobar6", "Reference to [TestPage]." );
        engine.saveText( "Foobar7", "Reference to [TestPage]." );

        context = new WikiContext( engine, engine.newHttpRequest(), new WikiPage(engine,"TestPage") );
        manager = new DefaultPluginManager( engine, props );
    }
View Full Code Here

    }

    public void testSingleReferral()
        throws Exception
    {
        WikiContext context2 = new WikiContext( engine, new WikiPage(engine, "Foobar") );

        String res = manager.execute( context2,
                                      "{INSERT org.apache.wiki.plugin.ReferringPagesPlugin WHERE max=5}");

        assertEquals( mkLink( "TestPage" )+"<br />",
View Full Code Here

    }

    public void testReferenceWidth()
        throws Exception
    {
        WikiContext context2 = new WikiContext( engine, new WikiPage(engine, "Foobar") );

        String res = manager.execute( context2,
                                      "{INSERT org.apache.wiki.plugin.ReferringPagesPlugin WHERE maxwidth=5}");

        assertEquals( mkFullLink( "TestP...", "TestPage" )+"<br />",
View Full Code Here

        testEngine.saveText("TestPage01", "Some Text for testing 01 which refers [NonExistingPageA] ");
        testEngine.saveText("TestPage02", "Some Text for testing 02 which refers [NonExistingPageB] ");
    testEngine.saveText("TestPage03", "Some Text for testing 03 which refers [NonExistingPageC] ");

        context = new WikiContext( testEngine, testEngine.newHttpRequest(), new WikiPage(testEngine,"TestPage") );
        manager = new DefaultPluginManager( testEngine, props )}
View Full Code Here

   
    public final int doWikiStartTag()
        throws IOException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        WikiPage   page   = m_wikiContext.getPage();

        try
        {
            if( page != null )
            {
                long size = page.getSize();

                if( size == -1 && engine.pageExists(page) ) // should never happen with attachments
                {
                    size = engine.getPureText( page.getName(), page.getVersion() ).length();
                    page.setSize( size );
                }

                pageContext.getOut().write( Long.toString(size) );
            }
        }
View Full Code Here

       
        //
        //  Preconditions: "from" page must exist, and "to" page must not yet exist.
        //
        WikiEngine engine = context.getEngine();
        WikiPage fromPage = engine.getPage( renameFrom );
       
        if( fromPage == null )
        {
            throw new WikiException("No such page "+renameFrom);
        }
       
        WikiPage toPage = engine.getPage( renameToClean );
       
        if( toPage != null )
        {
            throw new WikiException( "Page already exists " + renameToClean );
        }
       
        //
        //  Options
        //
       
        m_camelCase = TextUtil.getBooleanProperty( engine.getWikiProperties(),
                                                   JSPWikiMarkupParser.PROP_CAMELCASELINKS,
                                                   m_camelCase );

        Set<String> referrers = getReferencesToChange( fromPage, engine );

        //
        //  Do the actual rename by changing from the frompage to the topage, including
        //  all of the attachments
        //
       
        //  Remove references to attachments under old name
        @SuppressWarnings( "unchecked" )
        Collection<Attachment> attachmentsOldName = engine.getAttachmentManager().listAttachments( fromPage );
        for (Attachment att:attachmentsOldName)
        {
            WikiPage fromAttPage = engine.getPage( att.getName() );
            engine.getReferenceManager().pageRemoved( fromAttPage );
        }

        engine.getPageManager().getProvider().movePage( renameFrom, renameToClean );

        if( engine.getAttachmentManager().attachmentsEnabled() )
        {
            engine.getAttachmentManager().getCurrentProvider().moveAttachmentsForPage( renameFrom, renameToClean );
        }
       
        //
        //  Add a comment to the page notifying what changed.  This adds a new revision
        //  to the repo with no actual change.
        //
       
        toPage = engine.getPage( renameToClean );
       
        if( toPage == null ) throw new InternalWikiException("Rename seems to have failed for some strange reason - please check logs!");

        toPage.setAttribute( WikiPage.CHANGENOTE, fromPage.getName() + " ==> " + toPage.getName() );
        toPage.setAuthor( context.getCurrentUser().getName() );
       
        engine.getPageManager().putPageText( toPage, engine.getPureText( toPage ) );

        //
        //  Update the references
        //
       
        engine.getReferenceManager().pageRemoved( fromPage );
        engine.updateReferences( toPage );

        //
        //  Update referrers
        //
        if( changeReferrers )
        {
            updateReferrers( context, fromPage, toPage, referrers );
        }

        //
        //  re-index the page including its attachments
        //
        engine.getSearchManager().reindexPage(toPage);
       
        @SuppressWarnings( "unchecked" )
        Collection<Attachment> attachmentsNewName = engine.getAttachmentManager().listAttachments( toPage );
        for (Attachment att:attachmentsNewName)
        {
            WikiPage toAttPage = engine.getPage( att.getName() );
            // add reference to attachment under new page name
            engine.updateReferences( toAttPage );
            engine.getSearchManager().reindexPage(att);
        }
View Full Code Here

            if( pageName.equals( fromPage.getName() ) )
            {
                pageName = toPage.getName();
            }
           
            WikiPage p = engine.getPage( pageName );
           
            String sourceText = engine.getPureText( p );
           
            String newText = replaceReferrerString( context, sourceText, fromPage.getName(), toPage.getName() );
           
            if( m_camelCase )
                newText = replaceCCReferrerString( context, newText, fromPage.getName(), toPage.getName() );
           
            if( !sourceText.equals( newText ) )
            {
                p.setAttribute( WikiPage.CHANGENOTE, fromPage.getName()+" ==> "+toPage.getName() );
                p.setAuthor( context.getCurrentUser().getName() );
        
                try
                {
                    engine.getPageManager().putPageText( p, newText );
                    engine.updateReferences( p );
View Full Code Here

TOP

Related Classes of org.apache.wiki.WikiPage

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.