001    /**
002     * Copyright (c) 2000-2012 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            * <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
251            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
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            * Returns 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
273            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
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            * Returns 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
296            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
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            * Returns 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            * Returns 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
330            * @param end the upper bound of the range of contacts (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            * Returns 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
348            * @param end the upper bound of the range of contacts (not inclusive)
349            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
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
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            * Returns the number of contacts where companyId = &#63;.
383            *
384            * @param companyId the company ID
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            * Returns the number of 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                            ReferenceRegistry.registerReference(ContactUtil.class,
409                                    "_persistence");
410                    }
411    
412                    return _persistence;
413            }
414    
415            public void setPersistence(ContactPersistence persistence) {
416                    _persistence = persistence;
417    
418                    ReferenceRegistry.registerReference(ContactUtil.class, "_persistence");
419            }
420    
421            private static ContactPersistence _persistence;
422    }