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