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