Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RouteDocumentEvent |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2005-2008 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
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.rice.kns.rule.event; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.kuali.rice.kns.document.Document; | |
22 | import org.kuali.rice.kns.rule.BusinessRule; | |
23 | import org.kuali.rice.kns.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 | 0 | super("creating route event for document " + getDocumentId(document), errorPathPrefix, document); |
40 | 0 | } |
41 | ||
42 | /** | |
43 | * Constructs a RouteDocumentEvent with the given document | |
44 | * | |
45 | * @param document | |
46 | */ | |
47 | public RouteDocumentEvent(Document document) { | |
48 | 0 | this("", document); |
49 | 0 | } |
50 | ||
51 | /** | |
52 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass() | |
53 | */ | |
54 | public Class<? extends BusinessRule> getRuleInterfaceClass() { | |
55 | 0 | return RouteDocumentRule.class; |
56 | } | |
57 | ||
58 | /** | |
59 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule) | |
60 | */ | |
61 | public boolean invokeRuleMethod(BusinessRule rule) { | |
62 | 0 | return ((RouteDocumentRule) rule).processRouteDocument(document); |
63 | } | |
64 | ||
65 | /** | |
66 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#generateEvents() | |
67 | */ | |
68 | @Override | |
69 | public List<KualiDocumentEvent> generateEvents() { | |
70 | 0 | List<KualiDocumentEvent> events = new ArrayList<KualiDocumentEvent>(); |
71 | 0 | events.add(new SaveDocumentEvent(getDocument())); |
72 | 0 | return events; |
73 | } | |
74 | } |