1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  /**
26   * <a href="ContactUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ContactUtil {
32      public static com.liferay.portal.model.Contact create(long contactId) {
33          return getPersistence().create(contactId);
34      }
35  
36      public static com.liferay.portal.model.Contact remove(long contactId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchContactException {
39          return getPersistence().remove(contactId);
40      }
41  
42      public static com.liferay.portal.model.Contact remove(
43          com.liferay.portal.model.Contact contact)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(contact);
46      }
47  
48      /**
49       * @deprecated Use <code>update(Contact contact, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.Contact update(
52          com.liferay.portal.model.Contact contact)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(contact);
55      }
56  
57      /**
58       * Add, update, or merge, the entity. This method also calls the model
59       * listeners to trigger the proper events associated with adding, deleting,
60       * or updating an entity.
61       *
62       * @param        contact the entity to add, update, or merge
63       * @param        merge boolean value for whether to merge the entity. The
64       *                default value is false. Setting merge to true is more
65       *                expensive and should only be true when contact is
66       *                transient. See LEP-5473 for a detailed discussion of this
67       *                method.
68       * @return        true if the portlet can be displayed via Ajax
69       */
70      public static com.liferay.portal.model.Contact update(
71          com.liferay.portal.model.Contact contact, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(contact, merge);
74      }
75  
76      public static com.liferay.portal.model.Contact updateImpl(
77          com.liferay.portal.model.Contact contact, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(contact, merge);
80      }
81  
82      public static com.liferay.portal.model.Contact findByPrimaryKey(
83          long contactId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portal.NoSuchContactException {
86          return getPersistence().findByPrimaryKey(contactId);
87      }
88  
89      public static com.liferay.portal.model.Contact fetchByPrimaryKey(
90          long contactId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(contactId);
92      }
93  
94      public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
95          long companyId) throws com.liferay.portal.SystemException {
96          return getPersistence().findByCompanyId(companyId);
97      }
98  
99      public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
100         long companyId, int begin, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByCompanyId(companyId, begin, end);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
106         long companyId, int begin, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByCompanyId(companyId, begin, end, obc);
110     }
111 
112     public static com.liferay.portal.model.Contact findByCompanyId_First(
113         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
114         throws com.liferay.portal.SystemException,
115             com.liferay.portal.NoSuchContactException {
116         return getPersistence().findByCompanyId_First(companyId, obc);
117     }
118 
119     public static com.liferay.portal.model.Contact findByCompanyId_Last(
120         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException,
122             com.liferay.portal.NoSuchContactException {
123         return getPersistence().findByCompanyId_Last(companyId, obc);
124     }
125 
126     public static com.liferay.portal.model.Contact[] findByCompanyId_PrevAndNext(
127         long contactId, long companyId,
128         com.liferay.portal.kernel.util.OrderByComparator obc)
129         throws com.liferay.portal.SystemException,
130             com.liferay.portal.NoSuchContactException {
131         return getPersistence()
132                    .findByCompanyId_PrevAndNext(contactId, companyId, obc);
133     }
134 
135     public static java.util.List<com.liferay.portal.model.Contact> findWithDynamicQuery(
136         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
137         throws com.liferay.portal.SystemException {
138         return getPersistence().findWithDynamicQuery(queryInitializer);
139     }
140 
141     public static java.util.List<com.liferay.portal.model.Contact> findWithDynamicQuery(
142         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
143         int begin, int end) throws com.liferay.portal.SystemException {
144         return getPersistence()
145                    .findWithDynamicQuery(queryInitializer, begin, end);
146     }
147 
148     public static java.util.List<com.liferay.portal.model.Contact> findAll()
149         throws com.liferay.portal.SystemException {
150         return getPersistence().findAll();
151     }
152 
153     public static java.util.List<com.liferay.portal.model.Contact> findAll(
154         int begin, int end) throws com.liferay.portal.SystemException {
155         return getPersistence().findAll(begin, end);
156     }
157 
158     public static java.util.List<com.liferay.portal.model.Contact> findAll(
159         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
160         throws com.liferay.portal.SystemException {
161         return getPersistence().findAll(begin, end, obc);
162     }
163 
164     public static void removeByCompanyId(long companyId)
165         throws com.liferay.portal.SystemException {
166         getPersistence().removeByCompanyId(companyId);
167     }
168 
169     public static void removeAll() throws com.liferay.portal.SystemException {
170         getPersistence().removeAll();
171     }
172 
173     public static int countByCompanyId(long companyId)
174         throws com.liferay.portal.SystemException {
175         return getPersistence().countByCompanyId(companyId);
176     }
177 
178     public static int countAll() throws com.liferay.portal.SystemException {
179         return getPersistence().countAll();
180     }
181 
182     public static ContactPersistence getPersistence() {
183         return _getUtil()._persistence;
184     }
185 
186     public void setPersistence(ContactPersistence persistence) {
187         _persistence = persistence;
188     }
189 
190     private static ContactUtil _getUtil() {
191         if (_util == null) {
192             _util = (ContactUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
193         }
194 
195         return _util;
196     }
197 
198     private static final String _UTIL = ContactUtil.class.getName();
199     private static ContactUtil _util;
200     private ContactPersistence _persistence;
201 }