001    /**
002     * Copyright (c) 2000-present 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.util.ReferenceRegistry;
019    
020    /**
021     * @author Alexander Chow
022     */
023    public class CyrusServiceUtil {
024    
025            public static void addUser(
026                    long userId, String emailAddress, String password) {
027    
028                    getService().addUser(userId, emailAddress, password);
029            }
030    
031            public static void deleteEmailAddress(long companyId, long userId) {
032                    getService().deleteEmailAddress(companyId, userId);
033            }
034    
035            public static void deleteUser(long userId) {
036                    getService().deleteUser(userId);
037            }
038    
039            public static CyrusService getService() {
040                    if (_service == null) {
041                            _service = (CyrusService)PortalBeanLocatorUtil.locate(
042                                    CyrusService.class.getName());
043    
044                            ReferenceRegistry.registerReference(
045                                    CyrusServiceUtil.class, "_service");
046                    }
047    
048                    return _service;
049            }
050    
051            public static void updateEmailAddress(
052                    long companyId, long userId, String emailAddress) {
053    
054                    getService().updateEmailAddress(companyId, userId, emailAddress);
055            }
056    
057            public static void updatePassword(
058                    long companyId, long userId, String password) {
059    
060                    getService().updatePassword(companyId, userId, password);
061            }
062    
063            public void setService(CyrusService service) {
064                    _service = service;
065    
066                    ReferenceRegistry.registerReference(CyrusServiceUtil.class, "_service");
067            }
068    
069            private static CyrusService _service;
070    
071    }