| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SendAdHocRequestsEvent |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007-2009 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.SendAdHocRequestsRule; | |
| 24 | import org.kuali.rice.kns.service.KNSServiceLocator; | |
| 25 | import org.kuali.rice.kns.service.KualiRuleService; | |
| 26 | ||
| 27 | /** | |
| 28 | * This is a description of what this class does - wliang don't forget to fill this in. | |
| 29 | * | |
| 30 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 31 | * | |
| 32 | */ | |
| 33 | public class SendAdHocRequestsEvent extends KualiDocumentEventBase { | |
| 34 | ||
| 35 | public SendAdHocRequestsEvent(String errorPathPrefix, Document document) { | |
| 36 | 0 | this("creating send adhoc requests event for document " + getDocumentId(document), errorPathPrefix, document); |
| 37 | 0 | } |
| 38 | ||
| 39 | /** | |
| 40 | * Constructs a SaveDocumentEvent with the given document | |
| 41 | * | |
| 42 | * @param document | |
| 43 | */ | |
| 44 | public SendAdHocRequestsEvent(Document document) { | |
| 45 | 0 | this("", document); |
| 46 | 0 | } |
| 47 | ||
| 48 | public SendAdHocRequestsEvent(String description, String errorPathPrefix, Document document) { | |
| 49 | 0 | super(description, errorPathPrefix, document); |
| 50 | 0 | } |
| 51 | ||
| 52 | /** | |
| 53 | * This overridden method ... | |
| 54 | * | |
| 55 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass() | |
| 56 | */ | |
| 57 | public Class getRuleInterfaceClass() { | |
| 58 | 0 | return SendAdHocRequestsRule.class; |
| 59 | } | |
| 60 | ||
| 61 | /** | |
| 62 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule) | |
| 63 | */ | |
| 64 | public boolean invokeRuleMethod(BusinessRule rule) { | |
| 65 | 0 | return ((SendAdHocRequestsRule) rule).processSendAdHocRequests(document); |
| 66 | } | |
| 67 | ||
| 68 | /** | |
| 69 | * @see org.kuali.rice.kns.rule.event.KualiDocumentEventBase#generateEvents() | |
| 70 | */ | |
| 71 | @Override | |
| 72 | public List generateEvents() { | |
| 73 | 0 | KualiRuleService ruleService = KNSServiceLocator.getKualiRuleService(); |
| 74 | ||
| 75 | 0 | List events = new ArrayList(); |
| 76 | 0 | events.addAll(ruleService.generateAdHocRoutePersonEvents(getDocument())); |
| 77 | 0 | events.addAll(ruleService.generateAdHocRouteWorkgroupEvents(getDocument())); |
| 78 | 0 | return events; |
| 79 | } | |
| 80 | } |