01: /*
02: * Copyright 2005-2007 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.engine;
18:
19: import org.apache.commons.lang.StringUtils;
20:
21: import edu.iu.uis.eden.ActionTakenEvent;
22: import edu.iu.uis.eden.DocumentRouteLevelChange;
23: import edu.iu.uis.eden.DocumentRouteStatusChange;
24: import edu.iu.uis.eden.EdenConstants;
25: import edu.iu.uis.eden.clientapp.DeleteEvent;
26: import edu.iu.uis.eden.clientapp.WorkflowDocument;
27: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
28: import edu.iu.uis.eden.postprocessor.PostProcessor;
29: import edu.iu.uis.eden.postprocessor.ProcessDocReport;
30:
31: /**
32: * Tests a new document being spawned from the post processing of an existing document
33: *
34: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
35: */
36: public class PostProcessorSpawnDocument implements PostProcessor {
37: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
38: .getLogger(PostProcessorSpawnDocument.class);
39:
40: public ProcessDocReport doRouteStatusChange(
41: DocumentRouteStatusChange statusChangeEvent)
42: throws Exception {
43: LOG.info("Moving document "
44: + statusChangeEvent.getRouteHeaderId()
45: + " from status '"
46: + statusChangeEvent.getOldRouteStatus()
47: + "' to status '"
48: + statusChangeEvent.getNewRouteStatus() + "'");
49: if (StringUtils.equals(EdenConstants.ROUTE_HEADER_PROCESSED_CD,
50: statusChangeEvent.getNewRouteStatus())) {
51: // spawn and route a new document
52: WorkflowDocument document = new WorkflowDocument(
53: new NetworkIdVO("ewestfal"), "SpawnedDocumentType");
54: document.routeDocument("");
55: }
56: return new ProcessDocReport(true, "");
57: }
58:
59: public ProcessDocReport doRouteLevelChange(
60: DocumentRouteLevelChange levelChangeEvent) throws Exception {
61: return new ProcessDocReport(true, "");
62: }
63:
64: public ProcessDocReport doDeleteRouteHeader(DeleteEvent event)
65: throws Exception {
66: return new ProcessDocReport(false, "");
67: }
68:
69: public ProcessDocReport doActionTaken(ActionTakenEvent event)
70: throws Exception {
71: return new ProcessDocReport(true, "");
72: }
73:
74: }
|