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.tasks;
020
021import org.apache.wiki.api.core.Context;
022import org.apache.wiki.api.core.Engine;
023import org.apache.wiki.workflow.Step;
024
025import java.security.Principal;
026import java.util.Locale;
027
028/**
029 * Manager responsible of creation of the different JSPWiki {@link Step}s.
030 * 
031 * Instances of classes generated by this TasksManager are assumed to have been added to an approval workflow via 
032 * {@link org.apache.wiki.workflow.WorkflowBuilder#buildApprovalWorkflow(Principal, String, Step, String, org.apache.wiki.workflow.Fact[], Step, String)};
033 * they will not function correctly otherwise.
034 */
035public interface TasksManager {
036
037    /** The message key for storing the text for the presave task.  Value is <tt>{@value}</tt>. */
038    String WIKIPAGE_PRESAVE_TASK_MESSAGE_KEY = "task.preSaveWikiPage";
039    /** The message key of the text to finally approve a page save.  Value is <tt>{@value}</tt>. */
040    String WIKIPAGE_SAVE_TASK_MESSAGE_KEY = "task.saveWikiPage";
041    /** The message key of the text to finally approve a user profile save.  Value is <tt>{@value}</tt>. */
042    String USER_PROFILE_SAVE_TASK_MESSAGE_KEY = "task.createUserProfile";
043    
044    /**
045     * Builds a pre-save WikiPage task.
046     * 
047     * @param context associated wiki context.
048     * @param proposedText text proposed to be saved on the wiki page.
049     * @return a pre-save WikiPage task.
050     */
051    Step buildPreSaveWikiPageTask( Context context, String proposedText );
052    
053    /**
054     * Builds a save WikiPage task.
055     *
056     * @param context associated wiki context.
057     * @return a save WikiPage task.
058     */
059    Step buildSaveWikiPageTask( Context context );
060    
061    /**
062     * Builds a save user profile task.
063     * 
064     * @param engine associated wiki context.
065     * @param loc text proposed to be saved on the wiki page.
066     * @return a save user profile task.
067     */
068    Step buildSaveUserProfileTask( Engine engine, Locale loc );
069    
070}