View Javadoc

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.krad.service.impl;
17  
18  import javax.mail.MessagingException;
19  
20  import org.kuali.rice.core.mail.MailMessage;
21  import org.kuali.rice.core.mail.Mailer;
22  import org.kuali.rice.krad.exception.InvalidAddressException;
23  import org.kuali.rice.krad.service.MailService;
24  
25  public class MailServiceImpl implements MailService {
26      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(MailServiceImpl.class);
27  
28      private String batchMailingList;
29      private Mailer mailer;
30      
31      /**
32       * The injected Mailer.
33       */
34      public void setMailer(Mailer mailer) {
35      	this.mailer = mailer;
36      }
37      
38      /**
39       * 
40       */
41      public MailServiceImpl() {
42          super();
43      }
44  
45      /**
46       * Sets the batchMailingList attribute value.
47       * @param batchMailingList The batchMailingList to set.
48       */
49      public void setBatchMailingList(String batchMailingList) {
50          this.batchMailingList = batchMailingList;
51      }
52  
53      /**
54       * @see org.kuali.rice.krad.service.MailService#getBatchMailingList()
55       */
56      public String getBatchMailingList() {
57          return batchMailingList;
58      }
59  
60  	/**
61  	 * This overridden method ...
62  	 * @throws MessagingException 
63  	 * 
64  	 * @see org.kuali.rice.krad.service.MailService#sendMessage(org.kuali.rice.core.mail.MailMessage)
65  	 */
66  	@Override
67  	public void sendMessage(MailMessage message) throws InvalidAddressException, MessagingException {
68  		mailer.sendEmail(message);		
69  	}
70  }