1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.mail.service;
16  
17  import com.liferay.mail.model.Filter;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
20  import com.liferay.portal.kernel.mail.MailMessage;
21  
22  import java.util.List;
23  
24  import javax.mail.Session;
25  
26  /**
27   * <a href="MailServiceUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class MailServiceUtil {
32  
33      public static void addForward(
34          long companyId, long userId, List<Filter> filters,
35          List<String> emailAddresses, boolean leaveCopy) {
36  
37          getService().addForward(
38              companyId, userId, filters, emailAddresses, leaveCopy);
39      }
40  
41      public static void addUser(
42          long companyId, long userId, String password, String firstName,
43          String middleName, String lastName, String emailAddress) {
44  
45          getService().addUser(
46              companyId, userId, password, firstName, middleName, lastName,
47              emailAddress);
48      }
49  
50      public static void addVacationMessage(
51          long companyId, long userId, String emailAddress,
52          String vacationMessage) {
53  
54          getService().addVacationMessage(
55              companyId, userId, emailAddress, vacationMessage);
56      }
57  
58      public static void clearSession() {
59          getService().clearSession();
60      }
61  
62      public static void deleteEmailAddress(long companyId, long userId) {
63          getService().deleteEmailAddress(companyId, userId);
64      }
65  
66      public static void deleteUser(long companyId, long userId) {
67          getService().deleteUser(companyId, userId);
68      }
69  
70      public static MailService getService() {
71          if (_service == null) {
72              _service = (MailService)PortalBeanLocatorUtil.locate(
73                  MailService.class.getName());
74          }
75  
76          return _service;
77      }
78  
79      public static Session getSession() throws SystemException {
80          return getService().getSession();
81      }
82  
83      public static void sendEmail(MailMessage mailMessage) {
84          getService().sendEmail(mailMessage);
85      }
86  
87      public static void updateBlocked(
88          long companyId, long userId, List<String> blocked) {
89  
90          getService().updateBlocked(companyId, userId, blocked);
91      }
92  
93      public static void updateEmailAddress(
94          long companyId, long userId, String emailAddress) {
95  
96          getService().updateEmailAddress(companyId, userId, emailAddress);
97      }
98  
99      public static void updatePassword(
100         long companyId, long userId, String password) {
101 
102         getService().updatePassword(companyId, userId, password);
103     }
104 
105     public void setService(MailService service) {
106         _service = service;
107     }
108 
109     private static MailService _service;
110 
111 }