01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.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 edu.iu.uis.eden.actions;
18:
19: import java.util.List;
20: import java.util.Map;
21:
22: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
23: import edu.iu.uis.eden.exception.ResourceUnavailableException;
24: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
25: import edu.iu.uis.eden.user.WorkflowUser;
26:
27: /**
28: * Maintains the registry of Workflow Actions. Actions are (currently) identified by a one-letter
29: * action code and map to a Class which should extend the edu.iu.uis.eden.actions.ActionTakenEvent class.
30: *
31: * @author ewestfal
32: */
33: public interface ActionRegistry {
34:
35: /**
36: * Registers the given Action.
37: *
38: * @param actionCode Should be a one-letter unique code
39: * @param actionClass the fully-qualified Java classname of the ActionTakenEvent implementation
40: *
41: * @throws IllegalArgumentException if the actionCode is not one character or already in use,
42: * also throws this exception if the actionClass is null
43: */
44: public void registerAction(String actionCode, String actionClass);
45:
46: /**
47: * Unregisters the Action with the given code.
48: */
49: public void unregisterAction(String actionCode);
50:
51: /**
52: * Returns an immutable map of the Action Code to Action Class mappings in this registry.
53: */
54: public Map getActionMap();
55:
56: /**
57: * Constructs and returns the ActionTakenEvent implementation which can be used to invoke the
58: * Action with the given parameters.
59:
60: * @throws ResourceUnavailableException if the action class cannot be constructed
61: * @throws IllegalArgumentException if the given actionCode has not been registered
62: */
63: public ActionTakenEvent createAction(String actionCode,
64: List 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: * @throws EdenUserNotFoundException if the given user is invalid
71: */
72: public ValidActions getValidActions(WorkflowUser user,
73: DocumentRouteHeaderValue document)
74: throws ResourceUnavailableException,
75: EdenUserNotFoundException;
76: }
|