1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.mail.service;
24  
25  import com.liferay.mail.model.Filter;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.mail.MailMessage;
28  
29  import java.rmi.RemoteException;
30  
31  import java.util.List;
32  
33  /**
34   * <a href="MailServiceUtil.java.html"><b><i>View Source</i></b></a>
35   *
36   * @author Brian Wing Shun Chan
37   *
38   */
39  public class MailServiceUtil {
40  
41      public static void addForward(
42              long userId, List<Filter> filters, List<String> emailAddresses,
43              boolean leaveCopy)
44          throws RemoteException, SystemException {
45  
46          MailService mailService = MailServiceFactory.getService();
47  
48          mailService.addForward(userId, filters, emailAddresses, leaveCopy);
49      }
50  
51      public static void addUser(
52              long userId, String password, String firstName, String middleName,
53              String lastName, String emailAddress)
54          throws RemoteException, SystemException {
55  
56          MailService mailService = MailServiceFactory.getService();
57  
58          mailService.addUser(
59              userId, password, firstName, middleName, lastName, emailAddress);
60      }
61  
62      public static void addVacationMessage(
63              long userId, String emailAddress, String vacationMessage)
64          throws RemoteException, SystemException {
65  
66          MailService mailService = MailServiceFactory.getService();
67  
68          mailService.addVacationMessage(userId, emailAddress, vacationMessage);
69      }
70  
71      public static void deleteEmailAddress(long userId)
72          throws RemoteException, SystemException {
73  
74          MailService mailService = MailServiceFactory.getService();
75  
76          mailService.deleteEmailAddress(userId);
77      }
78  
79      public static void deleteUser(long userId)
80          throws RemoteException, SystemException {
81  
82          MailService mailService = MailServiceFactory.getService();
83  
84          mailService.deleteUser(userId);
85      }
86  
87      public static void sendEmail(MailMessage mailMessage)
88          throws RemoteException, SystemException {
89  
90          MailService mailService = MailServiceFactory.getService();
91  
92          mailService.sendEmail(mailMessage);
93      }
94  
95      public static void updateBlocked(long userId, List<String> blocked)
96          throws RemoteException, SystemException {
97  
98          MailService mailService = MailServiceFactory.getService();
99  
100         mailService.updateBlocked(userId, blocked);
101     }
102 
103     public static void updateEmailAddress(long userId, String emailAddress)
104         throws RemoteException, SystemException {
105 
106         MailService mailService = MailServiceFactory.getService();
107 
108         mailService.updateEmailAddress(userId, emailAddress);
109     }
110 
111     public static void updatePassword(long userId, String password)
112         throws RemoteException, SystemException {
113 
114         MailService mailService = MailServiceFactory.getService();
115 
116         mailService.updatePassword(userId, password);
117     }
118 
119 }