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.persistence;
016    
017    import com.liferay.mail.NoSuchCyrusVirtualException;
018    import com.liferay.mail.model.CyrusVirtual;
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    
021    import java.util.List;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class CyrusVirtualUtil {
027    
028            public static CyrusVirtual findByPrimaryKey(String emailAddress)
029                    throws NoSuchCyrusVirtualException {
030    
031                    return getPersistence().findByPrimaryKey(emailAddress);
032            }
033    
034            public static List<CyrusVirtual> findByUserId(long userId) {
035                    return getPersistence().findByUserId(userId);
036            }
037    
038            public static CyrusVirtualPersistence getPersistence() {
039                    if (_persistence == null) {
040                            _persistence =
041                                    (CyrusVirtualPersistence)PortalBeanLocatorUtil.locate(
042                                            CyrusVirtualPersistence.class.getName());
043                    }
044    
045                    return _persistence;
046            }
047    
048            public static void remove(String emailAddress)
049                    throws NoSuchCyrusVirtualException {
050    
051                    getPersistence().remove(emailAddress);
052            }
053    
054            public static void removeByUserId(long userId) {
055                    getPersistence().removeByUserId(userId);
056            }
057    
058            public static void update(CyrusVirtual user) {
059                    getPersistence().update(user);
060            }
061    
062            public void setPersistence(CyrusVirtualPersistence persistence) {
063                    _persistence = persistence;
064            }
065    
066            private static CyrusVirtualPersistence _persistence;
067    
068    }