1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.mail.service.persistence;
16  
17  import com.liferay.mail.NoSuchCyrusVirtualException;
18  import com.liferay.mail.model.CyrusVirtual;
19  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
20  import com.liferay.portal.kernel.exception.SystemException;
21  
22  import java.util.List;
23  
24  /**
25   * <a href="CyrusVirtualUtil.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class CyrusVirtualUtil {
30  
31      public static CyrusVirtual findByPrimaryKey(String emailAddress)
32          throws NoSuchCyrusVirtualException, SystemException {
33  
34          return getPersistence().findByPrimaryKey(emailAddress);
35      }
36  
37      public static List<CyrusVirtual> findByUserId(long userId)
38          throws SystemException {
39  
40          return getPersistence().findByUserId(userId);
41      }
42  
43      public static CyrusVirtualPersistence getPersistence() {
44          if (_persistence == null) {
45              _persistence =
46                  (CyrusVirtualPersistence)PortalBeanLocatorUtil.locate(
47                      CyrusVirtualPersistence.class.getName());
48          }
49  
50          return _persistence;
51      }
52  
53      public static void remove(String emailAddress)
54          throws NoSuchCyrusVirtualException, SystemException {
55  
56          getPersistence().remove(emailAddress);
57      }
58  
59      public static void removeByUserId(long userId) throws SystemException {
60          getPersistence().removeByUserId(userId);
61      }
62  
63      public static void update(CyrusVirtual user) throws SystemException {
64          getPersistence().update(user);
65      }
66  
67      public void setPersistence(CyrusVirtualPersistence persistence) {
68          _persistence = persistence;
69      }
70  
71      private static CyrusVirtualPersistence _persistence;
72  
73  }