001    /**
002     * Copyright (c) 2000-2013 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.kernel.util.ReferenceRegistry;
022    import com.liferay.portal.model.Contact;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the contact service. This utility wraps {@link ContactPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
029     *
030     * <p>
031     * Caching information and settings can be found in <code>portal.properties</code>
032     * </p>
033     *
034     * @author Brian Wing Shun Chan
035     * @see ContactPersistence
036     * @see ContactPersistenceImpl
037     * @generated
038     */
039    public class ContactUtil {
040            /*
041             * NOTE FOR DEVELOPERS:
042             *
043             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
044             */
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
048             */
049            public static void clearCache() {
050                    getPersistence().clearCache();
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
055             */
056            public static void clearCache(Contact contact) {
057                    getPersistence().clearCache(contact);
058            }
059    
060            /**
061             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
062             */
063            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
064                    throws SystemException {
065                    return getPersistence().countWithDynamicQuery(dynamicQuery);
066            }
067    
068            /**
069             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
070             */
071            public static List<Contact> findWithDynamicQuery(DynamicQuery dynamicQuery)
072                    throws SystemException {
073                    return getPersistence().findWithDynamicQuery(dynamicQuery);
074            }
075    
076            /**
077             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
078             */
079            public static List<Contact> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end)
081                    throws SystemException {
082                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
083            }
084    
085            /**
086             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
087             */
088            public static List<Contact> findWithDynamicQuery(
089                    DynamicQuery dynamicQuery, int start, int end,
090                    OrderByComparator orderByComparator) throws SystemException {
091                    return getPersistence()
092                                       .findWithDynamicQuery(dynamicQuery, start, end,
093                            orderByComparator);
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
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
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. Does not add the contact to the database.
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
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            * Returns 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
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            * Returns 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
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            * Returns all the contacts where companyId = &#63;.
191            *
192            * @param companyId the company ID
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            * Returns 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
210            * @param start the lower bound of the range of contacts
211            * @param end the upper bound of the range of contacts (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            * Returns 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
229            * @param start the lower bound of the range of contacts
230            * @param end the upper bound of the range of contacts (not inclusive)
231            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
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            * Returns the first contact in the ordered set where companyId = &#63;.
245            *
246            * @param companyId the company ID
247            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
248            * @return the first matching contact
249            * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found
250            * @throws SystemException if a system exception occurred
251            */
252            public static com.liferay.portal.model.Contact findByCompanyId_First(
253                    long companyId,
254                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
255                    throws com.liferay.portal.NoSuchContactException,
256                            com.liferay.portal.kernel.exception.SystemException {
257                    return getPersistence()
258                                       .findByCompanyId_First(companyId, orderByComparator);
259            }
260    
261            /**
262            * Returns the first contact in the ordered set where companyId = &#63;.
263            *
264            * @param companyId the company ID
265            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
266            * @return the first matching contact, or <code>null</code> if a matching contact could not be found
267            * @throws SystemException if a system exception occurred
268            */
269            public static com.liferay.portal.model.Contact fetchByCompanyId_First(
270                    long companyId,
271                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
272                    throws com.liferay.portal.kernel.exception.SystemException {
273                    return getPersistence()
274                                       .fetchByCompanyId_First(companyId, orderByComparator);
275            }
276    
277            /**
278            * Returns the last contact in the ordered set where companyId = &#63;.
279            *
280            * @param companyId the company ID
281            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
282            * @return the last matching contact
283            * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found
284            * @throws SystemException if a system exception occurred
285            */
286            public static com.liferay.portal.model.Contact findByCompanyId_Last(
287                    long companyId,
288                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
289                    throws com.liferay.portal.NoSuchContactException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    return getPersistence()
292                                       .findByCompanyId_Last(companyId, orderByComparator);
293            }
294    
295            /**
296            * Returns the last contact in the ordered set where companyId = &#63;.
297            *
298            * @param companyId the company ID
299            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
300            * @return the last matching contact, or <code>null</code> if a matching contact could not be found
301            * @throws SystemException if a system exception occurred
302            */
303            public static com.liferay.portal.model.Contact fetchByCompanyId_Last(
304                    long companyId,
305                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getPersistence()
308                                       .fetchByCompanyId_Last(companyId, orderByComparator);
309            }
310    
311            /**
312            * Returns the contacts before and after the current contact in the ordered set where companyId = &#63;.
313            *
314            * @param contactId the primary key of the current contact
315            * @param companyId the company ID
316            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
317            * @return the previous, current, and next contact
318            * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found
319            * @throws SystemException if a system exception occurred
320            */
321            public static com.liferay.portal.model.Contact[] findByCompanyId_PrevAndNext(
322                    long contactId, long companyId,
323                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
324                    throws com.liferay.portal.NoSuchContactException,
325                            com.liferay.portal.kernel.exception.SystemException {
326                    return getPersistence()
327                                       .findByCompanyId_PrevAndNext(contactId, companyId,
328                            orderByComparator);
329            }
330    
331            /**
332            * Returns all the contacts.
333            *
334            * @return the contacts
335            * @throws SystemException if a system exception occurred
336            */
337            public static java.util.List<com.liferay.portal.model.Contact> findAll()
338                    throws com.liferay.portal.kernel.exception.SystemException {
339                    return getPersistence().findAll();
340            }
341    
342            /**
343            * Returns a range of all the contacts.
344            *
345            * <p>
346            * 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.
347            * </p>
348            *
349            * @param start the lower bound of the range of contacts
350            * @param end the upper bound of the range of contacts (not inclusive)
351            * @return the range of contacts
352            * @throws SystemException if a system exception occurred
353            */
354            public static java.util.List<com.liferay.portal.model.Contact> findAll(
355                    int start, int end)
356                    throws com.liferay.portal.kernel.exception.SystemException {
357                    return getPersistence().findAll(start, end);
358            }
359    
360            /**
361            * Returns an ordered range of all the contacts.
362            *
363            * <p>
364            * 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.
365            * </p>
366            *
367            * @param start the lower bound of the range of contacts
368            * @param end the upper bound of the range of contacts (not inclusive)
369            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
370            * @return the ordered range of contacts
371            * @throws SystemException if a system exception occurred
372            */
373            public static java.util.List<com.liferay.portal.model.Contact> findAll(
374                    int start, int end,
375                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
376                    throws com.liferay.portal.kernel.exception.SystemException {
377                    return getPersistence().findAll(start, end, orderByComparator);
378            }
379    
380            /**
381            * Removes all the contacts where companyId = &#63; from the database.
382            *
383            * @param companyId the company ID
384            * @throws SystemException if a system exception occurred
385            */
386            public static void removeByCompanyId(long companyId)
387                    throws com.liferay.portal.kernel.exception.SystemException {
388                    getPersistence().removeByCompanyId(companyId);
389            }
390    
391            /**
392            * Removes all the contacts from the database.
393            *
394            * @throws SystemException if a system exception occurred
395            */
396            public static void removeAll()
397                    throws com.liferay.portal.kernel.exception.SystemException {
398                    getPersistence().removeAll();
399            }
400    
401            /**
402            * Returns the number of contacts where companyId = &#63;.
403            *
404            * @param companyId the company ID
405            * @return the number of matching contacts
406            * @throws SystemException if a system exception occurred
407            */
408            public static int countByCompanyId(long companyId)
409                    throws com.liferay.portal.kernel.exception.SystemException {
410                    return getPersistence().countByCompanyId(companyId);
411            }
412    
413            /**
414            * Returns the number of contacts.
415            *
416            * @return the number of contacts
417            * @throws SystemException if a system exception occurred
418            */
419            public static int countAll()
420                    throws com.liferay.portal.kernel.exception.SystemException {
421                    return getPersistence().countAll();
422            }
423    
424            public static ContactPersistence getPersistence() {
425                    if (_persistence == null) {
426                            _persistence = (ContactPersistence)PortalBeanLocatorUtil.locate(ContactPersistence.class.getName());
427    
428                            ReferenceRegistry.registerReference(ContactUtil.class,
429                                    "_persistence");
430                    }
431    
432                    return _persistence;
433            }
434    
435            /**
436             * @deprecated
437             */
438            public void setPersistence(ContactPersistence persistence) {
439            }
440    
441            private static ContactPersistence _persistence;
442    }