01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.rule.event;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.document.Document;
22: import org.kuali.core.rule.BusinessRule;
23: import org.kuali.core.rule.RouteDocumentRule;
24:
25: /**
26: * This class represents the route event that is part of an eDoc in Kuali. This could be triggered when a user presses the route
27: * button for a given document or it could happen when another piece of code calls the route method in the document service.
28: *
29: *
30: */
31: public final class RouteDocumentEvent extends KualiDocumentEventBase {
32: /**
33: * Constructs a RouteDocumentEvent with the specified errorPathPrefix and document
34: *
35: * @param errorPathPrefix
36: * @param document
37: */
38: public RouteDocumentEvent(String errorPathPrefix, Document document) {
39: super ("creating route event for document "
40: + getDocumentId(document), errorPathPrefix, document);
41: }
42:
43: /**
44: * Constructs a RouteDocumentEvent with the given document
45: *
46: * @param document
47: */
48: public RouteDocumentEvent(Document document) {
49: this ("", document);
50: }
51:
52: /**
53: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
54: */
55: public Class getRuleInterfaceClass() {
56: return RouteDocumentRule.class;
57: }
58:
59: /**
60: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
61: */
62: public boolean invokeRuleMethod(BusinessRule rule) {
63: return ((RouteDocumentRule) rule)
64: .processRouteDocument(document);
65: }
66:
67: /**
68: * @see org.kuali.core.rule.event.KualiDocumentEvent#generateEvents()
69: */
70: public List generateEvents() {
71: List events = new ArrayList();
72: events.add(new SaveDocumentEvent(getDocument()));
73: return events;
74: }
75: }
|