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