001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.announcements.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.util.OrderByComparator;
021    import com.liferay.portal.kernel.util.ReferenceRegistry;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.announcements.model.AnnouncementsFlag;
025    
026    import java.util.List;
027    
028    /**
029     * The persistence utility for the announcements flag service. This utility wraps {@link AnnouncementsFlagPersistenceImpl} 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 AnnouncementsFlagPersistence
037     * @see AnnouncementsFlagPersistenceImpl
038     * @generated
039     */
040    public class AnnouncementsFlagUtil {
041            /*
042             * NOTE FOR DEVELOPERS:
043             *
044             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
045             */
046    
047            /**
048             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
049             */
050            public static void clearCache() {
051                    getPersistence().clearCache();
052            }
053    
054            /**
055             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
056             */
057            public static void clearCache(AnnouncementsFlag announcementsFlag) {
058                    getPersistence().clearCache(announcementsFlag);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
063             */
064            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<AnnouncementsFlag> findWithDynamicQuery(
073                    DynamicQuery dynamicQuery) throws SystemException {
074                    return getPersistence().findWithDynamicQuery(dynamicQuery);
075            }
076    
077            /**
078             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
079             */
080            public static List<AnnouncementsFlag> findWithDynamicQuery(
081                    DynamicQuery dynamicQuery, int start, int end)
082                    throws SystemException {
083                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
084            }
085    
086            /**
087             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
088             */
089            public static List<AnnouncementsFlag> findWithDynamicQuery(
090                    DynamicQuery dynamicQuery, int start, int end,
091                    OrderByComparator orderByComparator) throws SystemException {
092                    return getPersistence()
093                                       .findWithDynamicQuery(dynamicQuery, start, end,
094                            orderByComparator);
095            }
096    
097            /**
098             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
099             */
100            public static AnnouncementsFlag update(
101                    AnnouncementsFlag announcementsFlag, boolean merge)
102                    throws SystemException {
103                    return getPersistence().update(announcementsFlag, merge);
104            }
105    
106            /**
107             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
108             */
109            public static AnnouncementsFlag update(
110                    AnnouncementsFlag announcementsFlag, boolean merge,
111                    ServiceContext serviceContext) throws SystemException {
112                    return getPersistence().update(announcementsFlag, merge, serviceContext);
113            }
114    
115            /**
116            * Caches the announcements flag in the entity cache if it is enabled.
117            *
118            * @param announcementsFlag the announcements flag
119            */
120            public static void cacheResult(
121                    com.liferay.portlet.announcements.model.AnnouncementsFlag announcementsFlag) {
122                    getPersistence().cacheResult(announcementsFlag);
123            }
124    
125            /**
126            * Caches the announcements flags in the entity cache if it is enabled.
127            *
128            * @param announcementsFlags the announcements flags
129            */
130            public static void cacheResult(
131                    java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> announcementsFlags) {
132                    getPersistence().cacheResult(announcementsFlags);
133            }
134    
135            /**
136            * Creates a new announcements flag with the primary key. Does not add the announcements flag to the database.
137            *
138            * @param flagId the primary key for the new announcements flag
139            * @return the new announcements flag
140            */
141            public static com.liferay.portlet.announcements.model.AnnouncementsFlag create(
142                    long flagId) {
143                    return getPersistence().create(flagId);
144            }
145    
146            /**
147            * Removes the announcements flag with the primary key from the database. Also notifies the appropriate model listeners.
148            *
149            * @param flagId the primary key of the announcements flag
150            * @return the announcements flag that was removed
151            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a announcements flag with the primary key could not be found
152            * @throws SystemException if a system exception occurred
153            */
154            public static com.liferay.portlet.announcements.model.AnnouncementsFlag remove(
155                    long flagId)
156                    throws com.liferay.portal.kernel.exception.SystemException,
157                            com.liferay.portlet.announcements.NoSuchFlagException {
158                    return getPersistence().remove(flagId);
159            }
160    
161            public static com.liferay.portlet.announcements.model.AnnouncementsFlag updateImpl(
162                    com.liferay.portlet.announcements.model.AnnouncementsFlag announcementsFlag,
163                    boolean merge)
164                    throws com.liferay.portal.kernel.exception.SystemException {
165                    return getPersistence().updateImpl(announcementsFlag, merge);
166            }
167    
168            /**
169            * Returns the announcements flag with the primary key or throws a {@link com.liferay.portlet.announcements.NoSuchFlagException} if it could not be found.
170            *
171            * @param flagId the primary key of the announcements flag
172            * @return the announcements flag
173            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a announcements flag with the primary key could not be found
174            * @throws SystemException if a system exception occurred
175            */
176            public static com.liferay.portlet.announcements.model.AnnouncementsFlag findByPrimaryKey(
177                    long flagId)
178                    throws com.liferay.portal.kernel.exception.SystemException,
179                            com.liferay.portlet.announcements.NoSuchFlagException {
180                    return getPersistence().findByPrimaryKey(flagId);
181            }
182    
183            /**
184            * Returns the announcements flag with the primary key or returns <code>null</code> if it could not be found.
185            *
186            * @param flagId the primary key of the announcements flag
187            * @return the announcements flag, or <code>null</code> if a announcements flag with the primary key could not be found
188            * @throws SystemException if a system exception occurred
189            */
190            public static com.liferay.portlet.announcements.model.AnnouncementsFlag fetchByPrimaryKey(
191                    long flagId) throws com.liferay.portal.kernel.exception.SystemException {
192                    return getPersistence().fetchByPrimaryKey(flagId);
193            }
194    
195            /**
196            * Returns all the announcements flags where entryId = &#63;.
197            *
198            * @param entryId the entry ID
199            * @return the matching announcements flags
200            * @throws SystemException if a system exception occurred
201            */
202            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findByEntryId(
203                    long entryId)
204                    throws com.liferay.portal.kernel.exception.SystemException {
205                    return getPersistence().findByEntryId(entryId);
206            }
207    
208            /**
209            * Returns a range of all the announcements flags where entryId = &#63;.
210            *
211            * <p>
212            * 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.
213            * </p>
214            *
215            * @param entryId the entry ID
216            * @param start the lower bound of the range of announcements flags
217            * @param end the upper bound of the range of announcements flags (not inclusive)
218            * @return the range of matching announcements flags
219            * @throws SystemException if a system exception occurred
220            */
221            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findByEntryId(
222                    long entryId, int start, int end)
223                    throws com.liferay.portal.kernel.exception.SystemException {
224                    return getPersistence().findByEntryId(entryId, start, end);
225            }
226    
227            /**
228            * Returns an ordered range of all the announcements flags where entryId = &#63;.
229            *
230            * <p>
231            * 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.
232            * </p>
233            *
234            * @param entryId the entry ID
235            * @param start the lower bound of the range of announcements flags
236            * @param end the upper bound of the range of announcements flags (not inclusive)
237            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
238            * @return the ordered range of matching announcements flags
239            * @throws SystemException if a system exception occurred
240            */
241            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findByEntryId(
242                    long entryId, int start, int end,
243                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
244                    throws com.liferay.portal.kernel.exception.SystemException {
245                    return getPersistence()
246                                       .findByEntryId(entryId, start, end, orderByComparator);
247            }
248    
249            /**
250            * Returns the first announcements flag in the ordered set where entryId = &#63;.
251            *
252            * <p>
253            * 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.
254            * </p>
255            *
256            * @param entryId the entry ID
257            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
258            * @return the first matching announcements flag
259            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a matching announcements flag could not be found
260            * @throws SystemException if a system exception occurred
261            */
262            public static com.liferay.portlet.announcements.model.AnnouncementsFlag findByEntryId_First(
263                    long entryId,
264                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
265                    throws com.liferay.portal.kernel.exception.SystemException,
266                            com.liferay.portlet.announcements.NoSuchFlagException {
267                    return getPersistence().findByEntryId_First(entryId, orderByComparator);
268            }
269    
270            /**
271            * Returns the last announcements flag in the ordered set where entryId = &#63;.
272            *
273            * <p>
274            * 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.
275            * </p>
276            *
277            * @param entryId the entry ID
278            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
279            * @return the last matching announcements flag
280            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a matching announcements flag could not be found
281            * @throws SystemException if a system exception occurred
282            */
283            public static com.liferay.portlet.announcements.model.AnnouncementsFlag findByEntryId_Last(
284                    long entryId,
285                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
286                    throws com.liferay.portal.kernel.exception.SystemException,
287                            com.liferay.portlet.announcements.NoSuchFlagException {
288                    return getPersistence().findByEntryId_Last(entryId, orderByComparator);
289            }
290    
291            /**
292            * Returns the announcements flags before and after the current announcements flag in the ordered set where entryId = &#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 flagId the primary key of the current announcements flag
299            * @param entryId the entry ID
300            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
301            * @return the previous, current, and next announcements flag
302            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a announcements flag with the primary key could not be found
303            * @throws SystemException if a system exception occurred
304            */
305            public static com.liferay.portlet.announcements.model.AnnouncementsFlag[] findByEntryId_PrevAndNext(
306                    long flagId, long entryId,
307                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
308                    throws com.liferay.portal.kernel.exception.SystemException,
309                            com.liferay.portlet.announcements.NoSuchFlagException {
310                    return getPersistence()
311                                       .findByEntryId_PrevAndNext(flagId, entryId, orderByComparator);
312            }
313    
314            /**
315            * Returns the announcements flag where userId = &#63; and entryId = &#63; and value = &#63; or throws a {@link com.liferay.portlet.announcements.NoSuchFlagException} if it could not be found.
316            *
317            * @param userId the user ID
318            * @param entryId the entry ID
319            * @param value the value
320            * @return the matching announcements flag
321            * @throws com.liferay.portlet.announcements.NoSuchFlagException if a matching announcements flag could not be found
322            * @throws SystemException if a system exception occurred
323            */
324            public static com.liferay.portlet.announcements.model.AnnouncementsFlag findByU_E_V(
325                    long userId, long entryId, int value)
326                    throws com.liferay.portal.kernel.exception.SystemException,
327                            com.liferay.portlet.announcements.NoSuchFlagException {
328                    return getPersistence().findByU_E_V(userId, entryId, value);
329            }
330    
331            /**
332            * Returns the announcements flag where userId = &#63; and entryId = &#63; and value = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
333            *
334            * @param userId the user ID
335            * @param entryId the entry ID
336            * @param value the value
337            * @return the matching announcements flag, or <code>null</code> if a matching announcements flag could not be found
338            * @throws SystemException if a system exception occurred
339            */
340            public static com.liferay.portlet.announcements.model.AnnouncementsFlag fetchByU_E_V(
341                    long userId, long entryId, int value)
342                    throws com.liferay.portal.kernel.exception.SystemException {
343                    return getPersistence().fetchByU_E_V(userId, entryId, value);
344            }
345    
346            /**
347            * Returns the announcements flag where userId = &#63; and entryId = &#63; and value = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
348            *
349            * @param userId the user ID
350            * @param entryId the entry ID
351            * @param value the value
352            * @param retrieveFromCache whether to use the finder cache
353            * @return the matching announcements flag, or <code>null</code> if a matching announcements flag could not be found
354            * @throws SystemException if a system exception occurred
355            */
356            public static com.liferay.portlet.announcements.model.AnnouncementsFlag fetchByU_E_V(
357                    long userId, long entryId, int value, boolean retrieveFromCache)
358                    throws com.liferay.portal.kernel.exception.SystemException {
359                    return getPersistence()
360                                       .fetchByU_E_V(userId, entryId, value, retrieveFromCache);
361            }
362    
363            /**
364            * Returns all the announcements flags.
365            *
366            * @return the announcements flags
367            * @throws SystemException if a system exception occurred
368            */
369            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findAll()
370                    throws com.liferay.portal.kernel.exception.SystemException {
371                    return getPersistence().findAll();
372            }
373    
374            /**
375            * Returns a range of all the announcements flags.
376            *
377            * <p>
378            * 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.
379            * </p>
380            *
381            * @param start the lower bound of the range of announcements flags
382            * @param end the upper bound of the range of announcements flags (not inclusive)
383            * @return the range of announcements flags
384            * @throws SystemException if a system exception occurred
385            */
386            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findAll(
387                    int start, int end)
388                    throws com.liferay.portal.kernel.exception.SystemException {
389                    return getPersistence().findAll(start, end);
390            }
391    
392            /**
393            * Returns an ordered range of all the announcements flags.
394            *
395            * <p>
396            * 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.
397            * </p>
398            *
399            * @param start the lower bound of the range of announcements flags
400            * @param end the upper bound of the range of announcements flags (not inclusive)
401            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
402            * @return the ordered range of announcements flags
403            * @throws SystemException if a system exception occurred
404            */
405            public static java.util.List<com.liferay.portlet.announcements.model.AnnouncementsFlag> findAll(
406                    int start, int end,
407                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
408                    throws com.liferay.portal.kernel.exception.SystemException {
409                    return getPersistence().findAll(start, end, orderByComparator);
410            }
411    
412            /**
413            * Removes all the announcements flags where entryId = &#63; from the database.
414            *
415            * @param entryId the entry ID
416            * @throws SystemException if a system exception occurred
417            */
418            public static void removeByEntryId(long entryId)
419                    throws com.liferay.portal.kernel.exception.SystemException {
420                    getPersistence().removeByEntryId(entryId);
421            }
422    
423            /**
424            * Removes the announcements flag where userId = &#63; and entryId = &#63; and value = &#63; from the database.
425            *
426            * @param userId the user ID
427            * @param entryId the entry ID
428            * @param value the value
429            * @throws SystemException if a system exception occurred
430            */
431            public static void removeByU_E_V(long userId, long entryId, int value)
432                    throws com.liferay.portal.kernel.exception.SystemException,
433                            com.liferay.portlet.announcements.NoSuchFlagException {
434                    getPersistence().removeByU_E_V(userId, entryId, value);
435            }
436    
437            /**
438            * Removes all the announcements flags from the database.
439            *
440            * @throws SystemException if a system exception occurred
441            */
442            public static void removeAll()
443                    throws com.liferay.portal.kernel.exception.SystemException {
444                    getPersistence().removeAll();
445            }
446    
447            /**
448            * Returns the number of announcements flags where entryId = &#63;.
449            *
450            * @param entryId the entry ID
451            * @return the number of matching announcements flags
452            * @throws SystemException if a system exception occurred
453            */
454            public static int countByEntryId(long entryId)
455                    throws com.liferay.portal.kernel.exception.SystemException {
456                    return getPersistence().countByEntryId(entryId);
457            }
458    
459            /**
460            * Returns the number of announcements flags where userId = &#63; and entryId = &#63; and value = &#63;.
461            *
462            * @param userId the user ID
463            * @param entryId the entry ID
464            * @param value the value
465            * @return the number of matching announcements flags
466            * @throws SystemException if a system exception occurred
467            */
468            public static int countByU_E_V(long userId, long entryId, int value)
469                    throws com.liferay.portal.kernel.exception.SystemException {
470                    return getPersistence().countByU_E_V(userId, entryId, value);
471            }
472    
473            /**
474            * Returns the number of announcements flags.
475            *
476            * @return the number of announcements flags
477            * @throws SystemException if a system exception occurred
478            */
479            public static int countAll()
480                    throws com.liferay.portal.kernel.exception.SystemException {
481                    return getPersistence().countAll();
482            }
483    
484            public static AnnouncementsFlagPersistence getPersistence() {
485                    if (_persistence == null) {
486                            _persistence = (AnnouncementsFlagPersistence)PortalBeanLocatorUtil.locate(AnnouncementsFlagPersistence.class.getName());
487    
488                            ReferenceRegistry.registerReference(AnnouncementsFlagUtil.class,
489                                    "_persistence");
490                    }
491    
492                    return _persistence;
493            }
494    
495            public void setPersistence(AnnouncementsFlagPersistence persistence) {
496                    _persistence = persistence;
497    
498                    ReferenceRegistry.registerReference(AnnouncementsFlagUtil.class,
499                            "_persistence");
500            }
501    
502            private static AnnouncementsFlagPersistence _persistence;
503    }