Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AddAdHocRouteWorkgroupEvent |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * Copyright 2006-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 org.kuali.rice.kns.bo.AdHocRouteWorkgroup; | |
19 | import org.kuali.rice.kns.document.Document; | |
20 | import org.kuali.rice.kns.rule.AddAdHocRouteWorkgroupRule; | |
21 | import org.kuali.rice.kns.rule.BusinessRule; | |
22 | import org.kuali.rice.kns.util.ObjectUtils; | |
23 | ||
24 | /** | |
25 | * This class represents the add AdHocRouteWorkgroup event that is part of an eDoc in Kuali. This is triggered when a user presses | |
26 | * the add button for a given adHocRouteWorkgroup. | |
27 | * | |
28 | * | |
29 | */ | |
30 | public final class AddAdHocRouteWorkgroupEvent extends KualiDocumentEventBase { | |
31 | private AdHocRouteWorkgroup adHocRouteWorkgroup; | |
32 | ||
33 | /** | |
34 | * Constructs an AddAdHocRouteWorkgroupEvent with the specified errorPathPrefix, document, and adHocRouteWorkgroup | |
35 | * | |
36 | * @param document | |
37 | * @param adHocRouteWorkgroup | |
38 | * @param errorPathPrefix | |
39 | */ | |
40 | public AddAdHocRouteWorkgroupEvent(String errorPathPrefix, Document document, AdHocRouteWorkgroup adHocRouteWorkgroup) { | |
41 | 0 | super("creating add ad hoc route workgroup event for document " + getDocumentId(document), errorPathPrefix, document); |
42 | 0 | this.adHocRouteWorkgroup = adHocRouteWorkgroup; |
43 | 0 | } |
44 | ||
45 | /** | |
46 | * Constructs an AddAdHocRouteWorkgroupEvent with the given document | |
47 | * | |
48 | * @param document | |
49 | * @param adHocRouteWorkgroup | |
50 | */ | |
51 | public AddAdHocRouteWorkgroupEvent(Document document, AdHocRouteWorkgroup adHocRouteWorkgroup) { | |
52 | 0 | this("", document, adHocRouteWorkgroup); |
53 | 0 | } |
54 | ||
55 | /** | |
56 | * This method retrieves the document adHocRouteWorkgroup associated with this event. | |
57 | * | |
58 | * @return AdHocRouteWorkgroup | |
59 | */ | |
60 | public AdHocRouteWorkgroup getAdHocRouteWorkgroup() { | |
61 | 0 | return adHocRouteWorkgroup; |
62 | } | |
63 | ||
64 | /** | |
65 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#validate() | |
66 | */ | |
67 | public void validate() { | |
68 | 0 | super.validate(); |
69 | 0 | if (this.adHocRouteWorkgroup == null) { |
70 | 0 | throw new IllegalArgumentException("invalid (null) document adHocRouteWorkgroup"); |
71 | } | |
72 | 0 | } |
73 | ||
74 | /** | |
75 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass() | |
76 | */ | |
77 | public Class getRuleInterfaceClass() { | |
78 | 0 | return AddAdHocRouteWorkgroupRule.class; |
79 | } | |
80 | ||
81 | /** | |
82 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule) | |
83 | */ | |
84 | public boolean invokeRuleMethod(BusinessRule rule) { | |
85 | 0 | return ((AddAdHocRouteWorkgroupRule) rule).processAddAdHocRouteWorkgroup(getDocument(), this.adHocRouteWorkgroup); |
86 | } | |
87 | } |