1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.mail.service;
16  
17  import com.liferay.mail.model.Filter;
18  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
19  import com.liferay.portal.kernel.exception.SystemException;
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 }