001    /**
002     * Copyright (c) 2000-2010 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.portal.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.util.OrderByComparator;
021    import com.liferay.portal.model.Contact;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.util.List;
025    
026    /**
027     * The persistence utility for the contact service.
028     *
029     * <p>
030     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this class.
031     * </p>
032     *
033     * @author Brian Wing Shun Chan
034     * @see ContactPersistence
035     * @see ContactPersistenceImpl
036     * @generated
037     */
038    public class ContactUtil {
039            /**
040             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
041             */
042            public static void clearCache() {
043                    getPersistence().clearCache();
044            }
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
048             */
049            public static void clearCache(Contact contact) {
050                    getPersistence().clearCache(contact);
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
055             */
056            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
057                    throws SystemException {
058                    return getPersistence().countWithDynamicQuery(dynamicQuery);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
063             */
064            public static List<Contact> findWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().findWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
071             */
072            public static List<Contact> findWithDynamicQuery(
073                    DynamicQuery dynamicQuery, int start, int end)
074                    throws SystemException {
075                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
076            }
077    
078            /**
079             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
080             */
081            public static List<Contact> findWithDynamicQuery(
082                    DynamicQuery dynamicQuery, int start, int end,
083                    OrderByComparator orderByComparator) throws SystemException {
084                    return getPersistence()
085                                       .findWithDynamicQuery(dynamicQuery, start, end,
086                            orderByComparator);
087            }
088    
089            /**
090             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
091             */
092            public static Contact remove(Contact contact) throws SystemException {
093                    return getPersistence().remove(contact);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
098             */
099            public static Contact update(Contact contact, boolean merge)
100                    throws SystemException {
101                    return getPersistence().update(contact, merge);
102            }
103    
104            /**
105             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
106             */
107            public static Contact update(Contact contact, boolean merge,
108                    ServiceContext serviceContext) throws SystemException {
109                    return getPersistence().update(contact, merge, serviceContext);
110            }
111    
112            /**
113            * Caches the contact in the entity cache if it is enabled.
114            *
115            * @param contact the contact to cache
116            */
117            public static void cacheResult(com.liferay.portal.model.Contact contact) {
118                    getPersistence().cacheResult(contact);
119            }
120    
121            /**
122            * Caches the contacts in the entity cache if it is enabled.
123            *
124            * @param contacts the contacts to cache
125            */
126            public static void cacheResult(
127                    java.util.List<com.liferay.portal.model.Contact> contacts) {
128                    getPersistence().cacheResult(contacts);
129            }
130    
131            /**
132            * Creates a new contact with the primary key.
133            *
134            * @param contactId the primary key for the new contact
135            * @return the new contact
136            */
137            public static com.liferay.portal.model.Contact create(long contactId) {
138                    return getPersistence().create(contactId);
139            }
140    
141            /**
142            * Removes the contact with the primary key from the database. Also notifies the appropriate model listeners.
143            *
144            * @param contactId the primary key of the contact to remove
145            * @return the contact that was removed
146            * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found
147            * @throws SystemException if a system exception occurred
148            */
149            public static com.liferay.portal.model.Contact remove(long contactId)
150                    throws com.liferay.portal.NoSuchContactException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    return getPersistence().remove(contactId);
153            }
154    
155            public static com.liferay.portal.model.Contact updateImpl(
156                    com.liferay.portal.model.Contact contact, boolean merge)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getPersistence().updateImpl(contact, merge);
159            }
160    
161            /**
162            * Finds the contact with the primary key or throws a {@link com.liferay.portal.NoSuchContactException} if it could not be found.
163            *
164            * @param contactId the primary key of the contact to find
165            * @return the contact
166            * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portal.model.Contact findByPrimaryKey(
170                    long contactId)
171                    throws com.liferay.portal.NoSuchContactException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getPersistence().findByPrimaryKey(contactId);
174            }
175    
176            /**
177            * Finds the contact with the primary key or returns <code>null</code> if it could not be found.
178            *
179            * @param contactId the primary key of the contact to find
180            * @return the contact, or <code>null</code> if a contact with the primary key could not be found
181            * @throws SystemException if a system exception occurred
182            */
183            public static com.liferay.portal.model.Contact fetchByPrimaryKey(
184                    long contactId)
185                    throws com.liferay.portal.kernel.exception.SystemException {
186                    return getPersistence().fetchByPrimaryKey(contactId);
187            }
188    
189            /**
190            * Finds all the contacts where companyId = &#63;.
191            *
192            * @param companyId the company id to search with
193            * @return the matching contacts
194            * @throws SystemException if a system exception occurred
195            */
196            public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
197                    long companyId)
198                    throws com.liferay.portal.kernel.exception.SystemException {
199                    return getPersistence().findByCompanyId(companyId);
200            }
201    
202            /**
203            * Finds a range of all the contacts where companyId = &#63;.
204            *
205            * <p>
206            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
207            * </p>
208            *
209            * @param companyId the company id to search with
210            * @param start the lower bound of the range of contacts to return
211            * @param end the upper bound of the range of contacts to return (not inclusive)
212            * @return the range of matching contacts
213            * @throws SystemException if a system exception occurred
214            */
215            public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
216                    long companyId, int start, int end)
217                    throws com.liferay.portal.kernel.exception.SystemException {
218                    return getPersistence().findByCompanyId(companyId, start, end);
219            }
220    
221            /**
222            * Finds an ordered range of all the contacts where companyId = &#63;.
223            *
224            * <p>
225            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
226            * </p>
227            *
228            * @param companyId the company id to search with
229            * @param start the lower bound of the range of contacts to return
230            * @param end the upper bound of the range of contacts to return (not inclusive)
231            * @param orderByComparator the comparator to order the results by
232            * @return the ordered range of matching contacts
233            * @throws SystemException if a system exception occurred
234            */
235            public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId(
236                    long companyId, int start, int end,
237                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
238                    throws com.liferay.portal.kernel.exception.SystemException {
239                    return getPersistence()
240                                       .findByCompanyId(companyId, start, end, orderByComparator);
241            }
242    
243            /**
244            * Finds the first contact in the ordered set where companyId = &#63;.
245            *
246            * <p>
247            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
248            * </p>
249            *
250            * @param companyId the company id to search with
251            * @param orderByComparator the comparator to order the set by
252            * @return the first matching contact
253            * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found
254            * @throws SystemException if a system exception occurred
255            */
256            public static com.liferay.portal.model.Contact findByCompanyId_First(
257                    long companyId,
258                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
259                    throws com.liferay.portal.NoSuchContactException,
260                            com.liferay.portal.kernel.exception.SystemException {
261                    return getPersistence()
262                                       .findByCompanyId_First(companyId, orderByComparator);
263            }
264    
265            /**
266            * Finds the last contact in the ordered set where companyId = &#63;.
267            *
268            * <p>
269            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
270            * </p>
271            *
272            * @param companyId the company id to search with
273            * @param orderByComparator the comparator to order the set by
274            * @return the last matching contact
275            * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found
276            * @throws SystemException if a system exception occurred
277            */
278            public static com.liferay.portal.model.Contact findByCompanyId_Last(
279                    long companyId,
280                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
281                    throws com.liferay.portal.NoSuchContactException,
282                            com.liferay.portal.kernel.exception.SystemException {
283                    return getPersistence()
284                                       .findByCompanyId_Last(companyId, orderByComparator);
285            }
286    
287            /**
288            * Finds the contacts before and after the current contact in the ordered set where companyId = &#63;.
289            *
290            * <p>
291            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
292            * </p>
293            *
294            * @param contactId the primary key of the current contact
295            * @param companyId the company id to search with
296            * @param orderByComparator the comparator to order the set by
297            * @return the previous, current, and next contact
298            * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found
299            * @throws SystemException if a system exception occurred
300            */
301            public static com.liferay.portal.model.Contact[] findByCompanyId_PrevAndNext(
302                    long contactId, long companyId,
303                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
304                    throws com.liferay.portal.NoSuchContactException,
305                            com.liferay.portal.kernel.exception.SystemException {
306                    return getPersistence()
307                                       .findByCompanyId_PrevAndNext(contactId, companyId,
308                            orderByComparator);
309            }
310    
311            /**
312            * Finds all the contacts.
313            *
314            * @return the contacts
315            * @throws SystemException if a system exception occurred
316            */
317            public static java.util.List<com.liferay.portal.model.Contact> findAll()
318                    throws com.liferay.portal.kernel.exception.SystemException {
319                    return getPersistence().findAll();
320            }
321    
322            /**
323            * Finds a range of all the contacts.
324            *
325            * <p>
326            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
327            * </p>
328            *
329            * @param start the lower bound of the range of contacts to return
330            * @param end the upper bound of the range of contacts to return (not inclusive)
331            * @return the range of contacts
332            * @throws SystemException if a system exception occurred
333            */
334            public static java.util.List<com.liferay.portal.model.Contact> findAll(
335                    int start, int end)
336                    throws com.liferay.portal.kernel.exception.SystemException {
337                    return getPersistence().findAll(start, end);
338            }
339    
340            /**
341            * Finds an ordered range of all the contacts.
342            *
343            * <p>
344            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
345            * </p>
346            *
347            * @param start the lower bound of the range of contacts to return
348            * @param end the upper bound of the range of contacts to return (not inclusive)
349            * @param orderByComparator the comparator to order the results by
350            * @return the ordered range of contacts
351            * @throws SystemException if a system exception occurred
352            */
353            public static java.util.List<com.liferay.portal.model.Contact> findAll(
354                    int start, int end,
355                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
356                    throws com.liferay.portal.kernel.exception.SystemException {
357                    return getPersistence().findAll(start, end, orderByComparator);
358            }
359    
360            /**
361            * Removes all the contacts where companyId = &#63; from the database.
362            *
363            * @param companyId the company id to search with
364            * @throws SystemException if a system exception occurred
365            */
366            public static void removeByCompanyId(long companyId)
367                    throws com.liferay.portal.kernel.exception.SystemException {
368                    getPersistence().removeByCompanyId(companyId);
369            }
370    
371            /**
372            * Removes all the contacts from the database.
373            *
374            * @throws SystemException if a system exception occurred
375            */
376            public static void removeAll()
377                    throws com.liferay.portal.kernel.exception.SystemException {
378                    getPersistence().removeAll();
379            }
380    
381            /**
382            * Counts all the contacts where companyId = &#63;.
383            *
384            * @param companyId the company id to search with
385            * @return the number of matching contacts
386            * @throws SystemException if a system exception occurred
387            */
388            public static int countByCompanyId(long companyId)
389                    throws com.liferay.portal.kernel.exception.SystemException {
390                    return getPersistence().countByCompanyId(companyId);
391            }
392    
393            /**
394            * Counts all the contacts.
395            *
396            * @return the number of contacts
397            * @throws SystemException if a system exception occurred
398            */
399            public static int countAll()
400                    throws com.liferay.portal.kernel.exception.SystemException {
401                    return getPersistence().countAll();
402            }
403    
404            public static ContactPersistence getPersistence() {
405                    if (_persistence == null) {
406                            _persistence = (ContactPersistence)PortalBeanLocatorUtil.locate(ContactPersistence.class.getName());
407                    }
408    
409                    return _persistence;
410            }
411    
412            public void setPersistence(ContactPersistence persistence) {
413                    _persistence = persistence;
414            }
415    
416            private static ContactPersistence _persistence;
417    }