001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.util.OrderByComparator;
022    import com.liferay.portal.kernel.util.ReferenceRegistry;
023    import com.liferay.portal.model.Portlet;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.util.List;
027    
028    /**
029     * The persistence utility for the portlet service. This utility wraps {@link com.liferay.portal.service.persistence.impl.PortletPersistenceImpl} 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.
030     *
031     * <p>
032     * Caching information and settings can be found in <code>portal.properties</code>
033     * </p>
034     *
035     * @author Brian Wing Shun Chan
036     * @see PortletPersistence
037     * @see com.liferay.portal.service.persistence.impl.PortletPersistenceImpl
038     * @generated
039     */
040    @ProviderType
041    public class PortletUtil {
042            /*
043             * NOTE FOR DEVELOPERS:
044             *
045             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
046             */
047    
048            /**
049             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
050             */
051            public static void clearCache() {
052                    getPersistence().clearCache();
053            }
054    
055            /**
056             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
057             */
058            public static void clearCache(Portlet portlet) {
059                    getPersistence().clearCache(portlet);
060            }
061    
062            /**
063             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
064             */
065            public static long countWithDynamicQuery(DynamicQuery dynamicQuery) {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery) {
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<Portlet> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end) {
081                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
082            }
083    
084            /**
085             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
086             */
087            public static List<Portlet> findWithDynamicQuery(
088                    DynamicQuery dynamicQuery, int start, int end,
089                    OrderByComparator<Portlet> orderByComparator) {
090                    return getPersistence()
091                                       .findWithDynamicQuery(dynamicQuery, start, end,
092                            orderByComparator);
093            }
094    
095            /**
096             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel)
097             */
098            public static Portlet update(Portlet portlet) {
099                    return getPersistence().update(portlet);
100            }
101    
102            /**
103             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
104             */
105            public static Portlet update(Portlet portlet, ServiceContext serviceContext) {
106                    return getPersistence().update(portlet, serviceContext);
107            }
108    
109            /**
110            * Returns all the portlets where companyId = &#63;.
111            *
112            * @param companyId the company ID
113            * @return the matching portlets
114            */
115            public static List<Portlet> findByCompanyId(long companyId) {
116                    return getPersistence().findByCompanyId(companyId);
117            }
118    
119            /**
120            * Returns a range of all the portlets where companyId = &#63;.
121            *
122            * <p>
123            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
124            * </p>
125            *
126            * @param companyId the company ID
127            * @param start the lower bound of the range of portlets
128            * @param end the upper bound of the range of portlets (not inclusive)
129            * @return the range of matching portlets
130            */
131            public static List<Portlet> findByCompanyId(long companyId, int start,
132                    int end) {
133                    return getPersistence().findByCompanyId(companyId, start, end);
134            }
135    
136            /**
137            * Returns an ordered range of all the portlets where companyId = &#63;.
138            *
139            * <p>
140            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
141            * </p>
142            *
143            * @param companyId the company ID
144            * @param start the lower bound of the range of portlets
145            * @param end the upper bound of the range of portlets (not inclusive)
146            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
147            * @return the ordered range of matching portlets
148            */
149            public static List<Portlet> findByCompanyId(long companyId, int start,
150                    int end, OrderByComparator<Portlet> orderByComparator) {
151                    return getPersistence()
152                                       .findByCompanyId(companyId, start, end, orderByComparator);
153            }
154    
155            /**
156            * Returns an ordered range of all the portlets where companyId = &#63;.
157            *
158            * <p>
159            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
160            * </p>
161            *
162            * @param companyId the company ID
163            * @param start the lower bound of the range of portlets
164            * @param end the upper bound of the range of portlets (not inclusive)
165            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
166            * @param retrieveFromCache whether to retrieve from the finder cache
167            * @return the ordered range of matching portlets
168            */
169            public static List<Portlet> findByCompanyId(long companyId, int start,
170                    int end, OrderByComparator<Portlet> orderByComparator,
171                    boolean retrieveFromCache) {
172                    return getPersistence()
173                                       .findByCompanyId(companyId, start, end, orderByComparator,
174                            retrieveFromCache);
175            }
176    
177            /**
178            * Returns the first portlet in the ordered set where companyId = &#63;.
179            *
180            * @param companyId the company ID
181            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
182            * @return the first matching portlet
183            * @throws NoSuchPortletException if a matching portlet could not be found
184            */
185            public static Portlet findByCompanyId_First(long companyId,
186                    OrderByComparator<Portlet> orderByComparator)
187                    throws com.liferay.portal.exception.NoSuchPortletException {
188                    return getPersistence()
189                                       .findByCompanyId_First(companyId, orderByComparator);
190            }
191    
192            /**
193            * Returns the first portlet in the ordered set where companyId = &#63;.
194            *
195            * @param companyId the company ID
196            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
197            * @return the first matching portlet, or <code>null</code> if a matching portlet could not be found
198            */
199            public static Portlet fetchByCompanyId_First(long companyId,
200                    OrderByComparator<Portlet> orderByComparator) {
201                    return getPersistence()
202                                       .fetchByCompanyId_First(companyId, orderByComparator);
203            }
204    
205            /**
206            * Returns the last portlet in the ordered set where companyId = &#63;.
207            *
208            * @param companyId the company ID
209            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
210            * @return the last matching portlet
211            * @throws NoSuchPortletException if a matching portlet could not be found
212            */
213            public static Portlet findByCompanyId_Last(long companyId,
214                    OrderByComparator<Portlet> orderByComparator)
215                    throws com.liferay.portal.exception.NoSuchPortletException {
216                    return getPersistence()
217                                       .findByCompanyId_Last(companyId, orderByComparator);
218            }
219    
220            /**
221            * Returns the last portlet in the ordered set where companyId = &#63;.
222            *
223            * @param companyId the company ID
224            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
225            * @return the last matching portlet, or <code>null</code> if a matching portlet could not be found
226            */
227            public static Portlet fetchByCompanyId_Last(long companyId,
228                    OrderByComparator<Portlet> orderByComparator) {
229                    return getPersistence()
230                                       .fetchByCompanyId_Last(companyId, orderByComparator);
231            }
232    
233            /**
234            * Returns the portlets before and after the current portlet in the ordered set where companyId = &#63;.
235            *
236            * @param id the primary key of the current portlet
237            * @param companyId the company ID
238            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
239            * @return the previous, current, and next portlet
240            * @throws NoSuchPortletException if a portlet with the primary key could not be found
241            */
242            public static Portlet[] findByCompanyId_PrevAndNext(long id,
243                    long companyId, OrderByComparator<Portlet> orderByComparator)
244                    throws com.liferay.portal.exception.NoSuchPortletException {
245                    return getPersistence()
246                                       .findByCompanyId_PrevAndNext(id, companyId, orderByComparator);
247            }
248    
249            /**
250            * Removes all the portlets where companyId = &#63; from the database.
251            *
252            * @param companyId the company ID
253            */
254            public static void removeByCompanyId(long companyId) {
255                    getPersistence().removeByCompanyId(companyId);
256            }
257    
258            /**
259            * Returns the number of portlets where companyId = &#63;.
260            *
261            * @param companyId the company ID
262            * @return the number of matching portlets
263            */
264            public static int countByCompanyId(long companyId) {
265                    return getPersistence().countByCompanyId(companyId);
266            }
267    
268            /**
269            * Returns the portlet where companyId = &#63; and portletId = &#63; or throws a {@link NoSuchPortletException} if it could not be found.
270            *
271            * @param companyId the company ID
272            * @param portletId the portlet ID
273            * @return the matching portlet
274            * @throws NoSuchPortletException if a matching portlet could not be found
275            */
276            public static Portlet findByC_P(long companyId, java.lang.String portletId)
277                    throws com.liferay.portal.exception.NoSuchPortletException {
278                    return getPersistence().findByC_P(companyId, portletId);
279            }
280    
281            /**
282            * Returns the portlet where companyId = &#63; and portletId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
283            *
284            * @param companyId the company ID
285            * @param portletId the portlet ID
286            * @return the matching portlet, or <code>null</code> if a matching portlet could not be found
287            */
288            public static Portlet fetchByC_P(long companyId, java.lang.String portletId) {
289                    return getPersistence().fetchByC_P(companyId, portletId);
290            }
291    
292            /**
293            * Returns the portlet where companyId = &#63; and portletId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
294            *
295            * @param companyId the company ID
296            * @param portletId the portlet ID
297            * @param retrieveFromCache whether to retrieve from the finder cache
298            * @return the matching portlet, or <code>null</code> if a matching portlet could not be found
299            */
300            public static Portlet fetchByC_P(long companyId,
301                    java.lang.String portletId, boolean retrieveFromCache) {
302                    return getPersistence()
303                                       .fetchByC_P(companyId, portletId, retrieveFromCache);
304            }
305    
306            /**
307            * Removes the portlet where companyId = &#63; and portletId = &#63; from the database.
308            *
309            * @param companyId the company ID
310            * @param portletId the portlet ID
311            * @return the portlet that was removed
312            */
313            public static Portlet removeByC_P(long companyId, java.lang.String portletId)
314                    throws com.liferay.portal.exception.NoSuchPortletException {
315                    return getPersistence().removeByC_P(companyId, portletId);
316            }
317    
318            /**
319            * Returns the number of portlets where companyId = &#63; and portletId = &#63;.
320            *
321            * @param companyId the company ID
322            * @param portletId the portlet ID
323            * @return the number of matching portlets
324            */
325            public static int countByC_P(long companyId, java.lang.String portletId) {
326                    return getPersistence().countByC_P(companyId, portletId);
327            }
328    
329            /**
330            * Caches the portlet in the entity cache if it is enabled.
331            *
332            * @param portlet the portlet
333            */
334            public static void cacheResult(Portlet portlet) {
335                    getPersistence().cacheResult(portlet);
336            }
337    
338            /**
339            * Caches the portlets in the entity cache if it is enabled.
340            *
341            * @param portlets the portlets
342            */
343            public static void cacheResult(List<Portlet> portlets) {
344                    getPersistence().cacheResult(portlets);
345            }
346    
347            /**
348            * Creates a new portlet with the primary key. Does not add the portlet to the database.
349            *
350            * @param id the primary key for the new portlet
351            * @return the new portlet
352            */
353            public static Portlet create(long id) {
354                    return getPersistence().create(id);
355            }
356    
357            /**
358            * Removes the portlet with the primary key from the database. Also notifies the appropriate model listeners.
359            *
360            * @param id the primary key of the portlet
361            * @return the portlet that was removed
362            * @throws NoSuchPortletException if a portlet with the primary key could not be found
363            */
364            public static Portlet remove(long id)
365                    throws com.liferay.portal.exception.NoSuchPortletException {
366                    return getPersistence().remove(id);
367            }
368    
369            public static Portlet updateImpl(Portlet portlet) {
370                    return getPersistence().updateImpl(portlet);
371            }
372    
373            /**
374            * Returns the portlet with the primary key or throws a {@link NoSuchPortletException} if it could not be found.
375            *
376            * @param id the primary key of the portlet
377            * @return the portlet
378            * @throws NoSuchPortletException if a portlet with the primary key could not be found
379            */
380            public static Portlet findByPrimaryKey(long id)
381                    throws com.liferay.portal.exception.NoSuchPortletException {
382                    return getPersistence().findByPrimaryKey(id);
383            }
384    
385            /**
386            * Returns the portlet with the primary key or returns <code>null</code> if it could not be found.
387            *
388            * @param id the primary key of the portlet
389            * @return the portlet, or <code>null</code> if a portlet with the primary key could not be found
390            */
391            public static Portlet fetchByPrimaryKey(long id) {
392                    return getPersistence().fetchByPrimaryKey(id);
393            }
394    
395            public static java.util.Map<java.io.Serializable, Portlet> fetchByPrimaryKeys(
396                    java.util.Set<java.io.Serializable> primaryKeys) {
397                    return getPersistence().fetchByPrimaryKeys(primaryKeys);
398            }
399    
400            /**
401            * Returns all the portlets.
402            *
403            * @return the portlets
404            */
405            public static List<Portlet> findAll() {
406                    return getPersistence().findAll();
407            }
408    
409            /**
410            * Returns a range of all the portlets.
411            *
412            * <p>
413            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
414            * </p>
415            *
416            * @param start the lower bound of the range of portlets
417            * @param end the upper bound of the range of portlets (not inclusive)
418            * @return the range of portlets
419            */
420            public static List<Portlet> findAll(int start, int end) {
421                    return getPersistence().findAll(start, end);
422            }
423    
424            /**
425            * Returns an ordered range of all the portlets.
426            *
427            * <p>
428            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
429            * </p>
430            *
431            * @param start the lower bound of the range of portlets
432            * @param end the upper bound of the range of portlets (not inclusive)
433            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
434            * @return the ordered range of portlets
435            */
436            public static List<Portlet> findAll(int start, int end,
437                    OrderByComparator<Portlet> orderByComparator) {
438                    return getPersistence().findAll(start, end, orderByComparator);
439            }
440    
441            /**
442            * Returns an ordered range of all the portlets.
443            *
444            * <p>
445            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PortletModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
446            * </p>
447            *
448            * @param start the lower bound of the range of portlets
449            * @param end the upper bound of the range of portlets (not inclusive)
450            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
451            * @param retrieveFromCache whether to retrieve from the finder cache
452            * @return the ordered range of portlets
453            */
454            public static List<Portlet> findAll(int start, int end,
455                    OrderByComparator<Portlet> orderByComparator, boolean retrieveFromCache) {
456                    return getPersistence()
457                                       .findAll(start, end, orderByComparator, retrieveFromCache);
458            }
459    
460            /**
461            * Removes all the portlets from the database.
462            */
463            public static void removeAll() {
464                    getPersistence().removeAll();
465            }
466    
467            /**
468            * Returns the number of portlets.
469            *
470            * @return the number of portlets
471            */
472            public static int countAll() {
473                    return getPersistence().countAll();
474            }
475    
476            public static java.util.Set<java.lang.String> getBadColumnNames() {
477                    return getPersistence().getBadColumnNames();
478            }
479    
480            public static PortletPersistence getPersistence() {
481                    if (_persistence == null) {
482                            _persistence = (PortletPersistence)PortalBeanLocatorUtil.locate(PortletPersistence.class.getName());
483    
484                            ReferenceRegistry.registerReference(PortletUtil.class,
485                                    "_persistence");
486                    }
487    
488                    return _persistence;
489            }
490    
491            private static PortletPersistence _persistence;
492    }