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