Coverage Report - org.kuali.rice.kew.mail.EmailReminderLifecycle
 
Classes in this File Line Coverage Branch Coverage Complexity
EmailReminderLifecycle
0%
0/10
0%
0/2
1.667
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.kew.mail;
 17  
 
 18  
 
 19  
 import org.kuali.rice.core.api.lifecycle.Lifecycle;
 20  
 import org.kuali.rice.kew.api.exception.WorkflowException;
 21  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 22  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 23  
 import org.quartz.Scheduler;
 24  
 
 25  
 
 26  
 /**
 27  
  * A {@link Lifecycle} which is initialized on system startup that sets up
 28  
  * the daily and weekly email reminders.
 29  
  *
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  0
 public class EmailReminderLifecycle implements Lifecycle {
 33  
 
 34  
         private boolean started;
 35  
 
 36  
         public boolean isStarted() {
 37  0
                 return started;
 38  
         }
 39  
 
 40  
         public void start() throws Exception {
 41  
                 // fetch scheduler here to initialize it outside of a transactional context, otherwise we get weird transaction errors
 42  0
             Scheduler scheduler = KSBServiceLocator.getScheduler();
 43  0
             if (scheduler == null) {
 44  0
                 throw new WorkflowException("Failed to locate Quartz Scheduler Service.");
 45  
             }
 46  0
             KEWServiceLocator.getActionListEmailService().scheduleBatchEmailReminders();
 47  0
             started = true;
 48  0
         }
 49  
 
 50  
         public void stop() throws Exception {
 51  0
                 started = false;
 52  0
         }
 53  
 
 54  
 }