View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.actions;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  import org.kuali.rice.core.api.reflect.DataDefinition;
22  import org.kuali.rice.kew.api.exception.ResourceUnavailableException;
23  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
24  import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
25  
26  
27  
28  /**
29   * Maintains the registry of Workflow Actions.  Actions are (currently) identified by a one-letter
30   * action code and map to a Class which should extend the org.kuali.rice.kew.actions.ActionTakenEvent class.
31   * 
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public interface ActionRegistry {
35  	
36  	/**
37  	 * Registers the given Action.
38  	 * 
39  	 * @param actionCode Should be a one-letter unique code 
40  	 * @param actionClass the fully-qualified Java classname of the ActionTakenEvent implementation
41  	 * 
42  	 * @throws IllegalArgumentException if the actionCode is not one character or already in use,
43  	 * 	also throws this exception if the actionClass is null
44  	 */
45  	public void registerAction(String actionCode, String actionClass);
46  	
47  	/**
48  	 * Unregisters the Action with the given code.
49  	 */
50  	public void unregisterAction(String actionCode);
51  	
52  	/**
53  	 * Returns an immutable map of the Action Code to Action Class mappings in this registry.
54  	 */
55  	public Map getActionMap();
56  
57  	/**
58  	 * Constructs and returns the ActionTakenEvent implementation which can be used to invoke the
59  	 * Action with the given parameters.
60  
61  	 * @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException if the action class cannot be constructed
62  	 * @throws IllegalArgumentException if the given actionCode has not been registered
63  	 */
64  	public ActionTakenEvent createAction(String actionCode, List<DataDefinition> parameters) throws ResourceUnavailableException;
65  	
66      /**
67       * Returns a List of valid action codes for the given user on the document.
68       *
69       * @throws ResourceUnavailableException if an action class cannot be constructed
70       */
71      public org.kuali.rice.kew.api.action.ValidActions getValidActions(PrincipalContract principal, DocumentRouteHeaderValue document);
72  
73  }