001
014
015 package com.liferay.mail.service;
016
017 import com.liferay.mail.model.Filter;
018 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.kernel.mail.MailMessage;
021 import com.liferay.portal.kernel.util.MethodCache;
022 import com.liferay.portal.kernel.util.ReferenceRegistry;
023
024 import java.util.List;
025
026 import javax.mail.Session;
027
028
031 public class MailServiceUtil {
032
033 public static void addForward(
034 long companyId, long userId, List<Filter> filters,
035 List<String> emailAddresses, boolean leaveCopy) {
036
037 getService().addForward(
038 companyId, userId, filters, emailAddresses, leaveCopy);
039 }
040
041 public static void addUser(
042 long companyId, long userId, String password, String firstName,
043 String middleName, String lastName, String emailAddress) {
044
045 getService().addUser(
046 companyId, userId, password, firstName, middleName, lastName,
047 emailAddress);
048 }
049
050 public static void addVacationMessage(
051 long companyId, long userId, String emailAddress,
052 String vacationMessage) {
053
054 getService().addVacationMessage(
055 companyId, userId, emailAddress, vacationMessage);
056 }
057
058 public static void clearSession() {
059 getService().clearSession();
060 }
061
062 public static void deleteEmailAddress(long companyId, long userId) {
063 getService().deleteEmailAddress(companyId, userId);
064 }
065
066 public static void deleteUser(long companyId, long userId) {
067 getService().deleteUser(companyId, userId);
068 }
069
070 public static MailService getService() {
071 if (_service == null) {
072 _service = (MailService)PortalBeanLocatorUtil.locate(
073 MailService.class.getName());
074
075 ReferenceRegistry.registerReference(
076 MailServiceUtil.class, "_service");
077
078 MethodCache.remove(MailService.class);
079 }
080
081 return _service;
082 }
083
084 public static Session getSession() throws SystemException {
085 return getService().getSession();
086 }
087
088 public static void sendEmail(MailMessage mailMessage) {
089 getService().sendEmail(mailMessage);
090 }
091
092 public static void updateBlocked(
093 long companyId, long userId, List<String> blocked) {
094
095 getService().updateBlocked(companyId, userId, blocked);
096 }
097
098 public static void updateEmailAddress(
099 long companyId, long userId, String emailAddress) {
100
101 getService().updateEmailAddress(companyId, userId, emailAddress);
102 }
103
104 public static void updatePassword(
105 long companyId, long userId, String password) {
106
107 getService().updatePassword(companyId, userId, password);
108 }
109
110 public void setService(MailService service) {
111 _service = service;
112
113 ReferenceRegistry.registerReference(MailServiceUtil.class, "_service");
114
115 MethodCache.remove(MailService.class);
116 }
117
118 private static MailService _service;
119
120 }