001/* 
002    Licensed to the Apache Software Foundation (ASF) under one
003    or more contributor license agreements.  See the NOTICE file
004    distributed with this work for additional information
005    regarding copyright ownership.  The ASF licenses this file
006    to you under the Apache License, Version 2.0 (the
007    "License"); you may not use this file except in compliance
008    with the License.  You may obtain a copy of the License at
009
010       http://www.apache.org/licenses/LICENSE-2.0
011
012    Unless required by applicable law or agreed to in writing,
013    software distributed under the License is distributed on an
014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015    KIND, either express or implied.  See the License for the
016    specific language governing permissions and limitations
017    under the License.  
018 */
019package org.apache.wiki.content;
020
021import org.apache.wiki.api.core.Context;
022import org.apache.wiki.api.exceptions.WikiException;
023
024/**
025 * Provides page renaming functionality. Note that there used to be a similarly named class in 2.6, but due to unclear copyright, the
026 * class was completely rewritten from scratch for 2.8.
027 *
028 * @since 2.8
029 */
030public interface PageRenamer {
031
032    /**
033     *  Renames a page.
034     *  
035     *  @param context The current context.
036     *  @param renameFrom The name from which to rename.
037     *  @param renameTo The new name.
038     *  @param changeReferrers If true, also changes all the referrers.
039     *  @return The final new name (in case it had to be modified)
040     *  @throws WikiException If the page cannot be renamed.
041     */
042    String renamePage( Context context, String renameFrom, String renameTo, boolean changeReferrers ) throws WikiException;
043
044    /**
045     * Fires a WikiPageRenameEvent to all registered listeners. Currently not used internally by JSPWiki itself, but you can use it for
046     * something else.
047     *
048     * @param oldName the former page name
049     * @param newName the new page name
050     */
051    void firePageRenameEvent( String oldName, String newName );
052
053}