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.persistence;
016    
017    import com.liferay.mail.NoSuchCyrusUserException;
018    import com.liferay.mail.model.CyrusUser;
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.exception.SystemException;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class CyrusUserUtil {
026    
027            public static CyrusUser findByPrimaryKey(long userId)
028                    throws NoSuchCyrusUserException, SystemException {
029    
030                    return getPersistence().findByPrimaryKey(userId);
031            }
032    
033            public static CyrusUserPersistence getPersistence() {
034                    if (_persistence == null) {
035                            _persistence = (CyrusUserPersistence)PortalBeanLocatorUtil.locate(
036                                    CyrusUserPersistence.class.getName());
037                    }
038    
039                    return _persistence;
040            }
041    
042            public static void remove(long userId)
043                    throws NoSuchCyrusUserException, SystemException {
044    
045                    getPersistence().remove(userId);
046            }
047    
048            public static void update(CyrusUser user) throws SystemException {
049                    getPersistence().update(user);
050            }
051    
052            public void setPersistence(CyrusUserPersistence persistence) {
053                    _persistence = persistence;
054            }
055    
056            private static CyrusUserPersistence _persistence;
057    
058    }