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.Set;
20:
21: import edu.iu.uis.eden.KEWServiceLocator;
22: import edu.iu.uis.eden.actions.BlanketApproveAction;
23: import edu.iu.uis.eden.actiontaken.ActionTakenValue;
24: import edu.iu.uis.eden.exception.WorkflowRuntimeException;
25: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
26: import edu.iu.uis.eden.user.WorkflowUser;
27:
28: /**
29: * Responsible for invoking the async piece of BlanketApprove
30: *
31: * @author rkirkend
32: */
33: public class BlanketApproveProcessor implements
34: BlanketApproveProcessorService {
35:
36: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
37: .getLogger(BlanketApproveProcessor.class);
38:
39: public void doBlanketApproveWork(Long documentId,
40: WorkflowUser user, Long actionTakenId, Set<String> nodeNames) {
41: KEWServiceLocator.getRouteHeaderService().lockRouteHeader(
42: documentId, true);
43: DocumentRouteHeaderValue document = KEWServiceLocator
44: .getRouteHeaderService().getRouteHeader(documentId);
45: ActionTakenValue actionTaken = KEWServiceLocator
46: .getActionTakenService().findByActionTakenId(
47: actionTakenId);
48: BlanketApproveAction blanketApprove = new BlanketApproveAction(
49: document, user, "", nodeNames);
50: blanketApprove.setActionTaken(actionTaken);
51: LOG.debug("Doing blanket approve work document "
52: + document.getRouteHeaderId());
53: try {
54: blanketApprove.doBlanketApproveWork();
55: } catch (Exception e) {
56: throw new WorkflowRuntimeException(e);
57: }
58: blanketApprove.queueDocument();
59: LOG.debug("Work done and document requeued, document "
60: + document.getRouteHeaderId());
61: }
62: }
|