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.EdenConstants;
22: import edu.iu.uis.eden.KEWServiceLocator;
23: import edu.iu.uis.eden.actions.MoveDocumentAction;
24: import edu.iu.uis.eden.actiontaken.ActionTakenValue;
25: import edu.iu.uis.eden.exception.WorkflowRuntimeException;
26: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
27: import edu.iu.uis.eden.user.WorkflowUser;
28:
29: /**
30: * Service to do the async work of moving a document.
31: *
32: * @author ewestfal
33: * @author rkirkend
34: */
35: public class MoveDocumentProcessor implements MoveDocumentService {
36:
37: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
38: .getLogger(MoveDocumentProcessor.class);
39:
40: public void moveDocument(WorkflowUser user,
41: DocumentRouteHeaderValue document,
42: ActionTakenValue actionTaken, Set nodeNames) {
43: KEWServiceLocator.getRouteHeaderService().lockRouteHeader(
44: document.getRouteHeaderId(), true);
45: MoveDocumentAction moveAction = new MoveDocumentAction(
46: document, user, "", null);
47: moveAction.setActionTaken(actionTaken);
48: moveAction
49: .setActionTakenCode(EdenConstants.ACTION_TAKEN_MOVE_CD);
50: LOG.debug("Doing move document work "
51: + document.getRouteHeaderId());
52: try {
53: moveAction.doMoveDocumentWork(nodeNames);
54: } catch (Exception e) {
55: throw new WorkflowRuntimeException(e);
56: }
57: moveAction.queueDocument();
58: LOG.debug("Work done and document requeued, document "
59: + document.getRouteHeaderId());
60: }
61: }
|