Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EmailReminderLifecycle |
|
| 1.6666666666666667;1.667 |
1 | /* | |
2 | * Copyright 2005-2007 The Kuali Foundation | |
3 | * | |
4 | * | |
5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.opensource.org/licenses/ecl2.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 org.kuali.rice.kew.mail; | |
18 | ||
19 | ||
20 | import org.kuali.rice.core.api.lifecycle.Lifecycle; | |
21 | import org.kuali.rice.kew.exception.WorkflowException; | |
22 | import org.kuali.rice.kew.service.KEWServiceLocator; | |
23 | import org.kuali.rice.ksb.service.KSBServiceLocator; | |
24 | import org.quartz.Scheduler; | |
25 | ||
26 | ||
27 | /** | |
28 | * A {@link Lifecycle} which is initialized on system startup that sets up | |
29 | * the daily and weekly email reminders. | |
30 | * | |
31 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
32 | */ | |
33 | 0 | public class EmailReminderLifecycle implements Lifecycle { |
34 | ||
35 | private boolean started; | |
36 | ||
37 | public boolean isStarted() { | |
38 | 0 | return started; |
39 | } | |
40 | ||
41 | public void start() throws Exception { | |
42 | // fetch scheduler here to initialize it outside of a transactional context, otherwise we get weird transaction errors | |
43 | 0 | Scheduler scheduler = KSBServiceLocator.getScheduler(); |
44 | 0 | if (scheduler == null) { |
45 | 0 | throw new WorkflowException("Failed to locate Quartz Scheduler Service."); |
46 | } | |
47 | 0 | KEWServiceLocator.getActionListEmailService().scheduleBatchEmailReminders(); |
48 | 0 | started = true; |
49 | 0 | } |
50 | ||
51 | public void stop() throws Exception { | |
52 | 0 | started = false; |
53 | 0 | } |
54 | ||
55 | } |