001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }