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.asyncservices;
18:
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.kuali.rice.definition.DataDefinition;
23:
24: import edu.iu.uis.eden.KEWServiceLocator;
25: import edu.iu.uis.eden.actions.ActionTakenEvent;
26: import edu.iu.uis.eden.exception.WorkflowRuntimeException;
27: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
28: import edu.iu.uis.eden.user.WorkflowUser;
29:
30: /**
31: * Service for doing the actual work of a mass action in the action list. Represents
32: * a single action on a single document.
33: *
34: * @author ewestfal
35: * @author rkirkend
36: */
37: public class ActionInvocationProcessor implements
38: ActionInvocationService { // implements RouteQueueProcessor {
39:
40: public void invokeAction(WorkflowUser user, Long documentId,
41: ActionInvocation invocation) {
42: List<Object> parameters = new ArrayList<Object>();
43: DocumentRouteHeaderValue document = KEWServiceLocator
44: .getRouteHeaderService().getRouteHeader(documentId);
45: parameters.add(new DataDefinition(document));
46: parameters.add(new DataDefinition(user));
47: parameters.add(new DataDefinition(""));
48: ActionTakenEvent action;
49: try {
50: action = KEWServiceLocator.getActionRegistry()
51: .createAction(invocation.getActionCode(),
52: parameters);
53: action.recordAction();
54: action.queueDocument();
55: } catch (Exception e) {
56: throw new WorkflowRuntimeException(e);
57: }
58:
59: }
60:
61: }
|