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