1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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.SystemException;
20  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
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  }