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.Portlet;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.util.List;
025    
026    /**
027     * The persistence utility for the portlet 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 PortletPersistence
035     * @see PortletPersistenceImpl
036     * @generated
037     */
038    public class PortletUtil {
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(Portlet portlet) {
050                    getPersistence().clearCache(portlet);
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<Portlet> 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<Portlet> 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<Portlet> 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 Portlet remove(Portlet portlet) throws SystemException {
093                    return getPersistence().remove(portlet);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
098             */
099            public static Portlet update(Portlet portlet, boolean merge)
100                    throws SystemException {
101                    return getPersistence().update(portlet, merge);
102            }
103    
104            /**
105             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
106             */
107            public static Portlet update(Portlet portlet, boolean merge,
108                    ServiceContext serviceContext) throws SystemException {
109                    return getPersistence().update(portlet, merge, serviceContext);
110            }
111    
112            /**
113            * Caches the portlet in the entity cache if it is enabled.
114            *
115            * @param portlet the portlet to cache
116            */
117            public static void cacheResult(com.liferay.portal.model.Portlet portlet) {
118                    getPersistence().cacheResult(portlet);
119            }
120    
121            /**
122            * Caches the portlets in the entity cache if it is enabled.
123            *
124            * @param portlets the portlets to cache
125            */
126            public static void cacheResult(
127                    java.util.List<com.liferay.portal.model.Portlet> portlets) {
128                    getPersistence().cacheResult(portlets);
129            }
130    
131            /**
132            * Creates a new portlet with the primary key.
133            *
134            * @param id the primary key for the new portlet
135            * @return the new portlet
136            */
137            public static com.liferay.portal.model.Portlet create(long id) {
138                    return getPersistence().create(id);
139            }
140    
141            /**
142            * Removes the portlet with the primary key from the database. Also notifies the appropriate model listeners.
143            *
144            * @param id the primary key of the portlet to remove
145            * @return the portlet that was removed
146            * @throws com.liferay.portal.NoSuchPortletException if a portlet with the primary key could not be found
147            * @throws SystemException if a system exception occurred
148            */
149            public static com.liferay.portal.model.Portlet remove(long id)
150                    throws com.liferay.portal.NoSuchPortletException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    return getPersistence().remove(id);
153            }
154    
155            public static com.liferay.portal.model.Portlet updateImpl(
156                    com.liferay.portal.model.Portlet portlet, boolean merge)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getPersistence().updateImpl(portlet, merge);
159            }
160    
161            /**
162            * Finds the portlet with the primary key or throws a {@link com.liferay.portal.NoSuchPortletException} if it could not be found.
163            *
164            * @param id the primary key of the portlet to find
165            * @return the portlet
166            * @throws com.liferay.portal.NoSuchPortletException if a portlet with the primary key could not be found
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portal.model.Portlet findByPrimaryKey(long id)
170                    throws com.liferay.portal.NoSuchPortletException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    return getPersistence().findByPrimaryKey(id);
173            }
174    
175            /**
176            * Finds the portlet with the primary key or returns <code>null</code> if it could not be found.
177            *
178            * @param id the primary key of the portlet to find
179            * @return the portlet, or <code>null</code> if a portlet with the primary key could not be found
180            * @throws SystemException if a system exception occurred
181            */
182            public static com.liferay.portal.model.Portlet fetchByPrimaryKey(long id)
183                    throws com.liferay.portal.kernel.exception.SystemException {
184                    return getPersistence().fetchByPrimaryKey(id);
185            }
186    
187            /**
188            * Finds all the portlets where companyId = &#63;.
189            *
190            * @param companyId the company id to search with
191            * @return the matching portlets
192            * @throws SystemException if a system exception occurred
193            */
194            public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
195                    long companyId)
196                    throws com.liferay.portal.kernel.exception.SystemException {
197                    return getPersistence().findByCompanyId(companyId);
198            }
199    
200            /**
201            * Finds a range of all the portlets where companyId = &#63;.
202            *
203            * <p>
204            * 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.
205            * </p>
206            *
207            * @param companyId the company id to search with
208            * @param start the lower bound of the range of portlets to return
209            * @param end the upper bound of the range of portlets to return (not inclusive)
210            * @return the range of matching portlets
211            * @throws SystemException if a system exception occurred
212            */
213            public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
214                    long companyId, int start, int end)
215                    throws com.liferay.portal.kernel.exception.SystemException {
216                    return getPersistence().findByCompanyId(companyId, start, end);
217            }
218    
219            /**
220            * Finds an ordered range of all the portlets where companyId = &#63;.
221            *
222            * <p>
223            * 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.
224            * </p>
225            *
226            * @param companyId the company id to search with
227            * @param start the lower bound of the range of portlets to return
228            * @param end the upper bound of the range of portlets to return (not inclusive)
229            * @param orderByComparator the comparator to order the results by
230            * @return the ordered range of matching portlets
231            * @throws SystemException if a system exception occurred
232            */
233            public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
234                    long companyId, int start, int end,
235                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
236                    throws com.liferay.portal.kernel.exception.SystemException {
237                    return getPersistence()
238                                       .findByCompanyId(companyId, start, end, orderByComparator);
239            }
240    
241            /**
242            * Finds the first portlet in the ordered set where companyId = &#63;.
243            *
244            * <p>
245            * 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.
246            * </p>
247            *
248            * @param companyId the company id to search with
249            * @param orderByComparator the comparator to order the set by
250            * @return the first matching portlet
251            * @throws com.liferay.portal.NoSuchPortletException if a matching portlet could not be found
252            * @throws SystemException if a system exception occurred
253            */
254            public static com.liferay.portal.model.Portlet findByCompanyId_First(
255                    long companyId,
256                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
257                    throws com.liferay.portal.NoSuchPortletException,
258                            com.liferay.portal.kernel.exception.SystemException {
259                    return getPersistence()
260                                       .findByCompanyId_First(companyId, orderByComparator);
261            }
262    
263            /**
264            * Finds the last portlet in the ordered set where companyId = &#63;.
265            *
266            * <p>
267            * 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.
268            * </p>
269            *
270            * @param companyId the company id to search with
271            * @param orderByComparator the comparator to order the set by
272            * @return the last matching portlet
273            * @throws com.liferay.portal.NoSuchPortletException if a matching portlet could not be found
274            * @throws SystemException if a system exception occurred
275            */
276            public static com.liferay.portal.model.Portlet findByCompanyId_Last(
277                    long companyId,
278                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
279                    throws com.liferay.portal.NoSuchPortletException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    return getPersistence()
282                                       .findByCompanyId_Last(companyId, orderByComparator);
283            }
284    
285            /**
286            * Finds the portlets before and after the current portlet in the ordered set where companyId = &#63;.
287            *
288            * <p>
289            * 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.
290            * </p>
291            *
292            * @param id the primary key of the current portlet
293            * @param companyId the company id to search with
294            * @param orderByComparator the comparator to order the set by
295            * @return the previous, current, and next portlet
296            * @throws com.liferay.portal.NoSuchPortletException if a portlet with the primary key could not be found
297            * @throws SystemException if a system exception occurred
298            */
299            public static com.liferay.portal.model.Portlet[] findByCompanyId_PrevAndNext(
300                    long id, long companyId,
301                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
302                    throws com.liferay.portal.NoSuchPortletException,
303                            com.liferay.portal.kernel.exception.SystemException {
304                    return getPersistence()
305                                       .findByCompanyId_PrevAndNext(id, companyId, orderByComparator);
306            }
307    
308            /**
309            * Finds the portlet where companyId = &#63; and portletId = &#63; or throws a {@link com.liferay.portal.NoSuchPortletException} if it could not be found.
310            *
311            * @param companyId the company id to search with
312            * @param portletId the portlet id to search with
313            * @return the matching portlet
314            * @throws com.liferay.portal.NoSuchPortletException if a matching portlet could not be found
315            * @throws SystemException if a system exception occurred
316            */
317            public static com.liferay.portal.model.Portlet findByC_P(long companyId,
318                    java.lang.String portletId)
319                    throws com.liferay.portal.NoSuchPortletException,
320                            com.liferay.portal.kernel.exception.SystemException {
321                    return getPersistence().findByC_P(companyId, portletId);
322            }
323    
324            /**
325            * Finds the portlet where companyId = &#63; and portletId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
326            *
327            * @param companyId the company id to search with
328            * @param portletId the portlet id to search with
329            * @return the matching portlet, or <code>null</code> if a matching portlet could not be found
330            * @throws SystemException if a system exception occurred
331            */
332            public static com.liferay.portal.model.Portlet fetchByC_P(long companyId,
333                    java.lang.String portletId)
334                    throws com.liferay.portal.kernel.exception.SystemException {
335                    return getPersistence().fetchByC_P(companyId, portletId);
336            }
337    
338            /**
339            * Finds the portlet where companyId = &#63; and portletId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
340            *
341            * @param companyId the company id to search with
342            * @param portletId the portlet id to search with
343            * @return the matching portlet, or <code>null</code> if a matching portlet could not be found
344            * @throws SystemException if a system exception occurred
345            */
346            public static com.liferay.portal.model.Portlet fetchByC_P(long companyId,
347                    java.lang.String portletId, boolean retrieveFromCache)
348                    throws com.liferay.portal.kernel.exception.SystemException {
349                    return getPersistence()
350                                       .fetchByC_P(companyId, portletId, retrieveFromCache);
351            }
352    
353            /**
354            * Finds all the portlets.
355            *
356            * @return the portlets
357            * @throws SystemException if a system exception occurred
358            */
359            public static java.util.List<com.liferay.portal.model.Portlet> findAll()
360                    throws com.liferay.portal.kernel.exception.SystemException {
361                    return getPersistence().findAll();
362            }
363    
364            /**
365            * Finds a range of all the portlets.
366            *
367            * <p>
368            * 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.
369            * </p>
370            *
371            * @param start the lower bound of the range of portlets to return
372            * @param end the upper bound of the range of portlets to return (not inclusive)
373            * @return the range of portlets
374            * @throws SystemException if a system exception occurred
375            */
376            public static java.util.List<com.liferay.portal.model.Portlet> findAll(
377                    int start, int end)
378                    throws com.liferay.portal.kernel.exception.SystemException {
379                    return getPersistence().findAll(start, end);
380            }
381    
382            /**
383            * Finds an ordered range of all the portlets.
384            *
385            * <p>
386            * 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.
387            * </p>
388            *
389            * @param start the lower bound of the range of portlets to return
390            * @param end the upper bound of the range of portlets to return (not inclusive)
391            * @param orderByComparator the comparator to order the results by
392            * @return the ordered range of portlets
393            * @throws SystemException if a system exception occurred
394            */
395            public static java.util.List<com.liferay.portal.model.Portlet> findAll(
396                    int start, int end,
397                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
398                    throws com.liferay.portal.kernel.exception.SystemException {
399                    return getPersistence().findAll(start, end, orderByComparator);
400            }
401    
402            /**
403            * Removes all the portlets where companyId = &#63; from the database.
404            *
405            * @param companyId the company id to search with
406            * @throws SystemException if a system exception occurred
407            */
408            public static void removeByCompanyId(long companyId)
409                    throws com.liferay.portal.kernel.exception.SystemException {
410                    getPersistence().removeByCompanyId(companyId);
411            }
412    
413            /**
414            * Removes the portlet where companyId = &#63; and portletId = &#63; from the database.
415            *
416            * @param companyId the company id to search with
417            * @param portletId the portlet id to search with
418            * @throws SystemException if a system exception occurred
419            */
420            public static void removeByC_P(long companyId, java.lang.String portletId)
421                    throws com.liferay.portal.NoSuchPortletException,
422                            com.liferay.portal.kernel.exception.SystemException {
423                    getPersistence().removeByC_P(companyId, portletId);
424            }
425    
426            /**
427            * Removes all the portlets from the database.
428            *
429            * @throws SystemException if a system exception occurred
430            */
431            public static void removeAll()
432                    throws com.liferay.portal.kernel.exception.SystemException {
433                    getPersistence().removeAll();
434            }
435    
436            /**
437            * Counts all the portlets where companyId = &#63;.
438            *
439            * @param companyId the company id to search with
440            * @return the number of matching portlets
441            * @throws SystemException if a system exception occurred
442            */
443            public static int countByCompanyId(long companyId)
444                    throws com.liferay.portal.kernel.exception.SystemException {
445                    return getPersistence().countByCompanyId(companyId);
446            }
447    
448            /**
449            * Counts all the portlets where companyId = &#63; and portletId = &#63;.
450            *
451            * @param companyId the company id to search with
452            * @param portletId the portlet id to search with
453            * @return the number of matching portlets
454            * @throws SystemException if a system exception occurred
455            */
456            public static int countByC_P(long companyId, java.lang.String portletId)
457                    throws com.liferay.portal.kernel.exception.SystemException {
458                    return getPersistence().countByC_P(companyId, portletId);
459            }
460    
461            /**
462            * Counts all the portlets.
463            *
464            * @return the number of portlets
465            * @throws SystemException if a system exception occurred
466            */
467            public static int countAll()
468                    throws com.liferay.portal.kernel.exception.SystemException {
469                    return getPersistence().countAll();
470            }
471    
472            public static PortletPersistence getPersistence() {
473                    if (_persistence == null) {
474                            _persistence = (PortletPersistence)PortalBeanLocatorUtil.locate(PortletPersistence.class.getName());
475                    }
476    
477                    return _persistence;
478            }
479    
480            public void setPersistence(PortletPersistence persistence) {
481                    _persistence = persistence;
482            }
483    
484            private static PortletPersistence _persistence;
485    }