001    /**
002     * Copyright (c) 2000-2010 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.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    }