001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.mail.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * @author Alexander Chow
023     */
024    public class CyrusServiceUtil {
025    
026            public static void addUser(
027                            long userId, String emailAddress, String password)
028                    throws SystemException {
029    
030                    getService().addUser(userId, emailAddress, password);
031            }
032    
033            public static void deleteEmailAddress(long companyId, long userId)
034                    throws SystemException {
035    
036                    getService().deleteEmailAddress(companyId, userId);
037            }
038    
039            public static void deleteUser(long userId) throws SystemException {
040                    getService().deleteUser(userId);
041            }
042    
043            public static CyrusService getService() {
044                    if (_service == null) {
045                            _service = (CyrusService)PortalBeanLocatorUtil.locate(
046                                    CyrusService.class.getName());
047    
048                            ReferenceRegistry.registerReference(
049                                    CyrusServiceUtil.class, "_service");
050                    }
051    
052                    return _service;
053            }
054    
055            public static void updateEmailAddress(
056                            long companyId, long userId, String emailAddress)
057                    throws SystemException {
058    
059                    getService().updateEmailAddress(companyId, userId, emailAddress);
060            }
061    
062            public static void updatePassword(
063                            long companyId, long userId, String password)
064                    throws SystemException {
065    
066                    getService().updatePassword(companyId, userId, password);
067            }
068    
069            public void setService(CyrusService service) {
070                    _service = service;
071    
072                    ReferenceRegistry.registerReference(CyrusServiceUtil.class, "_service");
073            }
074    
075            private static CyrusService _service;
076    
077    }