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