001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kew.impl.mail;
017    
018    import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019    import org.kuali.rice.kew.api.action.ActionItem;
020    import org.kuali.rice.kew.api.mail.ImmediateEmailReminderQueue;
021    import org.kuali.rice.kew.mail.service.ActionListEmailService;
022    import org.kuali.rice.kew.service.KEWServiceLocator;
023    
024    /**
025     * Reference implementation of an {@code ImmediateEmailReminderQueue}.
026     * 
027     * @author Kuali Rice Team (rice.collab@kuali.org)
028     */
029    public class ImmediateEmailReminderQueueImpl implements ImmediateEmailReminderQueue {
030    
031        private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
032                .getLogger(ImmediateEmailReminderQueueImpl.class);
033    
034        private ActionListEmailService actionListEmailService;
035    
036        public void sendReminder(ActionItem actionItem, Boolean skipOnApprovals) {
037            if (actionItem == null) {
038                            throw new RiceIllegalArgumentException("actionItem was null");
039                    }
040    
041            if (skipOnApprovals == null) {
042                skipOnApprovals = false;
043                    }
044    
045            getActionListEmailService().sendImmediateReminder(actionItem, skipOnApprovals);
046        }
047    
048        private ActionListEmailService getActionListEmailService() {
049            if (actionListEmailService == null)
050                actionListEmailService = (ActionListEmailService) KEWServiceLocator.getService(KEWServiceLocator.ACTION_LIST_EMAIL_SERVICE);
051        
052            return actionListEmailService;
053        }
054        
055        /**
056         * @param actionListEmailService the actionListEmailService to set
057         */
058        public void setActionListEmailService(ActionListEmailService actionListEmailService) {
059            this.actionListEmailService = actionListEmailService;
060        }
061        
062    }