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