001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kew.actions;
017    
018    import java.util.List;
019    import java.util.Map;
020    
021    import org.kuali.rice.core.api.reflect.DataDefinition;
022    import org.kuali.rice.kew.api.exception.ResourceUnavailableException;
023    import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
024    import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
025    
026    
027    
028    /**
029     * Maintains the registry of Workflow Actions.  Actions are (currently) identified by a one-letter
030     * action code and map to a Class which should extend the org.kuali.rice.kew.actions.ActionTakenEvent class.
031     * 
032     * @author Kuali Rice Team (rice.collab@kuali.org)
033     */
034    public interface ActionRegistry {
035            
036            /**
037             * Registers the given Action.
038             * 
039             * @param actionCode Should be a one-letter unique code 
040             * @param actionClass the fully-qualified Java classname of the ActionTakenEvent implementation
041             * 
042             * @throws IllegalArgumentException if the actionCode is not one character or already in use,
043             *      also throws this exception if the actionClass is null
044             */
045            public void registerAction(String actionCode, String actionClass);
046            
047            /**
048             * Unregisters the Action with the given code.
049             */
050            public void unregisterAction(String actionCode);
051            
052            /**
053             * Returns an immutable map of the Action Code to Action Class mappings in this registry.
054             */
055            public Map getActionMap();
056    
057            /**
058             * Constructs and returns the ActionTakenEvent implementation which can be used to invoke the
059             * Action with the given parameters.
060    
061             * @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException if the action class cannot be constructed
062             * @throws IllegalArgumentException if the given actionCode has not been registered
063             */
064            public ActionTakenEvent createAction(String actionCode, List<DataDefinition> parameters) throws ResourceUnavailableException;
065            
066        /**
067         * Returns a List of valid action codes for the given user on the document.
068         *
069         * @throws ResourceUnavailableException if an action class cannot be constructed
070         */
071        public org.kuali.rice.kew.api.action.ValidActions getValidActions(PrincipalContract principal, DocumentRouteHeaderValue document);
072    
073    }