001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.mail.service.impl;
022:
023: import com.liferay.mail.service.MailService;
024: import com.liferay.mail.service.jms.MailProducer;
025: import com.liferay.portal.SystemException;
026: import com.liferay.portal.kernel.mail.MailMessage;
027: import com.liferay.portal.kernel.util.BooleanWrapper;
028: import com.liferay.portal.kernel.util.LongWrapper;
029: import com.liferay.portal.kernel.util.MethodWrapper;
030: import com.liferay.portal.util.PropsValues;
031:
032: import java.util.List;
033:
034: import org.apache.commons.logging.Log;
035: import org.apache.commons.logging.LogFactory;
036:
037: /**
038: * <a href="MailServiceImpl.java.html"><b><i>View Source</i></b></a>
039: *
040: * @author Brian Wing Shun Chan
041: *
042: */
043: public class MailServiceImpl implements MailService {
044:
045: public void addForward(long userId, List filters,
046: List emailAddresses, boolean leaveCopy)
047: throws SystemException {
048:
049: if (_log.isDebugEnabled()) {
050: _log.debug("addForward");
051: }
052:
053: MethodWrapper methodWrapper = new MethodWrapper(
054: PropsValues.MAIL_HOOK_IMPL, "addForward", new Object[] {
055: new LongWrapper(userId), filters,
056: emailAddresses, new BooleanWrapper(leaveCopy) });
057:
058: MailProducer.produce(methodWrapper);
059: }
060:
061: public void addUser(long userId, String password, String firstName,
062: String middleName, String lastName, String emailAddress)
063: throws SystemException {
064:
065: if (_log.isDebugEnabled()) {
066: _log.debug("addUser");
067: }
068:
069: MethodWrapper methodWrapper = new MethodWrapper(
070: PropsValues.MAIL_HOOK_IMPL, "addUser", new Object[] {
071: new LongWrapper(userId), password, firstName,
072: middleName, lastName, emailAddress });
073:
074: MailProducer.produce(methodWrapper);
075: }
076:
077: public void addVacationMessage(long userId, String emailAddress,
078: String vacationMessage) throws SystemException {
079:
080: if (_log.isDebugEnabled()) {
081: _log.debug("addVacationMessage");
082: }
083:
084: MethodWrapper methodWrapper = new MethodWrapper(
085: PropsValues.MAIL_HOOK_IMPL, "addVacationMessage",
086: new Object[] { new LongWrapper(userId), emailAddress,
087: vacationMessage });
088:
089: MailProducer.produce(methodWrapper);
090: }
091:
092: public void deleteEmailAddress(long userId) throws SystemException {
093: if (_log.isDebugEnabled()) {
094: _log.debug("deleteEmailAddress");
095: }
096:
097: MethodWrapper methodWrapper = new MethodWrapper(
098: PropsValues.MAIL_HOOK_IMPL, "deleteEmailAddress",
099: new Object[] { new LongWrapper(userId) });
100:
101: MailProducer.produce(methodWrapper);
102: }
103:
104: public void deleteUser(long userId) throws SystemException {
105: if (_log.isDebugEnabled()) {
106: _log.debug("deleteUser");
107: }
108:
109: MethodWrapper methodWrapper = new MethodWrapper(
110: PropsValues.MAIL_HOOK_IMPL, "deleteUser",
111: new Object[] { new LongWrapper(userId) });
112:
113: MailProducer.produce(methodWrapper);
114: }
115:
116: public void sendEmail(MailMessage mailMessage)
117: throws SystemException {
118: if (_log.isDebugEnabled()) {
119: _log.debug("sendEmail");
120: }
121:
122: MailProducer.produce(mailMessage);
123: }
124:
125: public void updateBlocked(long userId, List blocked)
126: throws SystemException {
127:
128: if (_log.isDebugEnabled()) {
129: _log.debug("updateBlocked");
130: }
131:
132: MethodWrapper methodWrapper = new MethodWrapper(
133: PropsValues.MAIL_HOOK_IMPL, "updateBlocked",
134: new Object[] { new LongWrapper(userId), blocked });
135:
136: MailProducer.produce(methodWrapper);
137: }
138:
139: public void updateEmailAddress(long userId, String emailAddress)
140: throws SystemException {
141:
142: if (_log.isDebugEnabled()) {
143: _log.debug("updateEmailAddress");
144: }
145:
146: MethodWrapper methodWrapper = new MethodWrapper(
147: PropsValues.MAIL_HOOK_IMPL, "updateEmailAddress",
148: new Object[] { new LongWrapper(userId), emailAddress });
149:
150: MailProducer.produce(methodWrapper);
151: }
152:
153: public void updatePassword(long userId, String password)
154: throws SystemException {
155:
156: if (_log.isDebugEnabled()) {
157: _log.debug("updatePassword");
158: }
159:
160: MethodWrapper methodWrapper = new MethodWrapper(
161: PropsValues.MAIL_HOOK_IMPL, "updatePassword",
162: new Object[] { new LongWrapper(userId), password });
163:
164: MailProducer.produce(methodWrapper);
165: }
166:
167: private static Log _log = LogFactory.getLog(MailServiceImpl.class);
168:
169: }
|