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.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.kernel.util.ReferenceRegistry;
022    import com.liferay.portal.model.Region;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the region service. This utility wraps {@link RegionPersistenceImpl} 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.
029     *
030     * <p>
031     * Caching information and settings can be found in <code>portal.properties</code>
032     * </p>
033     *
034     * @author Brian Wing Shun Chan
035     * @see RegionPersistence
036     * @see RegionPersistenceImpl
037     * @generated
038     */
039    public class RegionUtil {
040            /*
041             * NOTE FOR DEVELOPERS:
042             *
043             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
044             */
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
048             */
049            public static void clearCache() {
050                    getPersistence().clearCache();
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
055             */
056            public static void clearCache(Region region) {
057                    getPersistence().clearCache(region);
058            }
059    
060            /**
061             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
062             */
063            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
064                    throws SystemException {
065                    return getPersistence().countWithDynamicQuery(dynamicQuery);
066            }
067    
068            /**
069             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
070             */
071            public static List<Region> findWithDynamicQuery(DynamicQuery dynamicQuery)
072                    throws SystemException {
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<Region> findWithDynamicQuery(DynamicQuery dynamicQuery,
080                    int start, int end) throws SystemException {
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<Region> findWithDynamicQuery(DynamicQuery dynamicQuery,
088                    int start, int end, OrderByComparator orderByComparator)
089                    throws SystemException {
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, boolean)
097             */
098            public static Region update(Region region, boolean merge)
099                    throws SystemException {
100                    return getPersistence().update(region, merge);
101            }
102    
103            /**
104             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
105             */
106            public static Region update(Region region, boolean merge,
107                    ServiceContext serviceContext) throws SystemException {
108                    return getPersistence().update(region, merge, serviceContext);
109            }
110    
111            /**
112            * Caches the region in the entity cache if it is enabled.
113            *
114            * @param region the region
115            */
116            public static void cacheResult(com.liferay.portal.model.Region region) {
117                    getPersistence().cacheResult(region);
118            }
119    
120            /**
121            * Caches the regions in the entity cache if it is enabled.
122            *
123            * @param regions the regions
124            */
125            public static void cacheResult(
126                    java.util.List<com.liferay.portal.model.Region> regions) {
127                    getPersistence().cacheResult(regions);
128            }
129    
130            /**
131            * Creates a new region with the primary key. Does not add the region to the database.
132            *
133            * @param regionId the primary key for the new region
134            * @return the new region
135            */
136            public static com.liferay.portal.model.Region create(long regionId) {
137                    return getPersistence().create(regionId);
138            }
139    
140            /**
141            * Removes the region with the primary key from the database. Also notifies the appropriate model listeners.
142            *
143            * @param regionId the primary key of the region
144            * @return the region that was removed
145            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
146            * @throws SystemException if a system exception occurred
147            */
148            public static com.liferay.portal.model.Region remove(long regionId)
149                    throws com.liferay.portal.NoSuchRegionException,
150                            com.liferay.portal.kernel.exception.SystemException {
151                    return getPersistence().remove(regionId);
152            }
153    
154            public static com.liferay.portal.model.Region updateImpl(
155                    com.liferay.portal.model.Region region, boolean merge)
156                    throws com.liferay.portal.kernel.exception.SystemException {
157                    return getPersistence().updateImpl(region, merge);
158            }
159    
160            /**
161            * Returns the region with the primary key or throws a {@link com.liferay.portal.NoSuchRegionException} if it could not be found.
162            *
163            * @param regionId the primary key of the region
164            * @return the region
165            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
166            * @throws SystemException if a system exception occurred
167            */
168            public static com.liferay.portal.model.Region findByPrimaryKey(
169                    long regionId)
170                    throws com.liferay.portal.NoSuchRegionException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    return getPersistence().findByPrimaryKey(regionId);
173            }
174    
175            /**
176            * Returns the region with the primary key or returns <code>null</code> if it could not be found.
177            *
178            * @param regionId the primary key of the region
179            * @return the region, or <code>null</code> if a region with the primary key could not be found
180            * @throws SystemException if a system exception occurred
181            */
182            public static com.liferay.portal.model.Region fetchByPrimaryKey(
183                    long regionId)
184                    throws com.liferay.portal.kernel.exception.SystemException {
185                    return getPersistence().fetchByPrimaryKey(regionId);
186            }
187    
188            /**
189            * Returns all the regions where countryId = &#63;.
190            *
191            * @param countryId the country ID
192            * @return the matching regions
193            * @throws SystemException if a system exception occurred
194            */
195            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
196                    long countryId)
197                    throws com.liferay.portal.kernel.exception.SystemException {
198                    return getPersistence().findByCountryId(countryId);
199            }
200    
201            /**
202            * Returns a range of all the regions where countryId = &#63;.
203            *
204            * <p>
205            * 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.
206            * </p>
207            *
208            * @param countryId the country ID
209            * @param start the lower bound of the range of regions
210            * @param end the upper bound of the range of regions (not inclusive)
211            * @return the range of matching regions
212            * @throws SystemException if a system exception occurred
213            */
214            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
215                    long countryId, int start, int end)
216                    throws com.liferay.portal.kernel.exception.SystemException {
217                    return getPersistence().findByCountryId(countryId, start, end);
218            }
219    
220            /**
221            * Returns an ordered range of all the regions where countryId = &#63;.
222            *
223            * <p>
224            * 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.
225            * </p>
226            *
227            * @param countryId the country ID
228            * @param start the lower bound of the range of regions
229            * @param end the upper bound of the range of regions (not inclusive)
230            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
231            * @return the ordered range of matching regions
232            * @throws SystemException if a system exception occurred
233            */
234            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
235                    long countryId, int start, int end,
236                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
237                    throws com.liferay.portal.kernel.exception.SystemException {
238                    return getPersistence()
239                                       .findByCountryId(countryId, start, end, orderByComparator);
240            }
241    
242            /**
243            * Returns the first region in the ordered set where countryId = &#63;.
244            *
245            * <p>
246            * 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.
247            * </p>
248            *
249            * @param countryId the country ID
250            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
251            * @return the first matching region
252            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
253            * @throws SystemException if a system exception occurred
254            */
255            public static com.liferay.portal.model.Region findByCountryId_First(
256                    long countryId,
257                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
258                    throws com.liferay.portal.NoSuchRegionException,
259                            com.liferay.portal.kernel.exception.SystemException {
260                    return getPersistence()
261                                       .findByCountryId_First(countryId, orderByComparator);
262            }
263    
264            /**
265            * Returns the last region in the ordered set where countryId = &#63;.
266            *
267            * <p>
268            * 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.
269            * </p>
270            *
271            * @param countryId the country ID
272            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
273            * @return the last matching region
274            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
275            * @throws SystemException if a system exception occurred
276            */
277            public static com.liferay.portal.model.Region findByCountryId_Last(
278                    long countryId,
279                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
280                    throws com.liferay.portal.NoSuchRegionException,
281                            com.liferay.portal.kernel.exception.SystemException {
282                    return getPersistence()
283                                       .findByCountryId_Last(countryId, orderByComparator);
284            }
285    
286            /**
287            * Returns the regions before and after the current region in the ordered set where countryId = &#63;.
288            *
289            * <p>
290            * 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.
291            * </p>
292            *
293            * @param regionId the primary key of the current region
294            * @param countryId the country ID
295            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
296            * @return the previous, current, and next region
297            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
298            * @throws SystemException if a system exception occurred
299            */
300            public static com.liferay.portal.model.Region[] findByCountryId_PrevAndNext(
301                    long regionId, long countryId,
302                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
303                    throws com.liferay.portal.NoSuchRegionException,
304                            com.liferay.portal.kernel.exception.SystemException {
305                    return getPersistence()
306                                       .findByCountryId_PrevAndNext(regionId, countryId,
307                            orderByComparator);
308            }
309    
310            /**
311            * Returns all the regions where active = &#63;.
312            *
313            * @param active the active
314            * @return the matching regions
315            * @throws SystemException if a system exception occurred
316            */
317            public static java.util.List<com.liferay.portal.model.Region> findByActive(
318                    boolean active)
319                    throws com.liferay.portal.kernel.exception.SystemException {
320                    return getPersistence().findByActive(active);
321            }
322    
323            /**
324            * Returns a range of all the regions where active = &#63;.
325            *
326            * <p>
327            * 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.
328            * </p>
329            *
330            * @param active the active
331            * @param start the lower bound of the range of regions
332            * @param end the upper bound of the range of regions (not inclusive)
333            * @return the range of matching regions
334            * @throws SystemException if a system exception occurred
335            */
336            public static java.util.List<com.liferay.portal.model.Region> findByActive(
337                    boolean active, int start, int end)
338                    throws com.liferay.portal.kernel.exception.SystemException {
339                    return getPersistence().findByActive(active, start, end);
340            }
341    
342            /**
343            * Returns an ordered range of all the regions where active = &#63;.
344            *
345            * <p>
346            * 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.
347            * </p>
348            *
349            * @param active the active
350            * @param start the lower bound of the range of regions
351            * @param end the upper bound of the range of regions (not inclusive)
352            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
353            * @return the ordered range of matching regions
354            * @throws SystemException if a system exception occurred
355            */
356            public static java.util.List<com.liferay.portal.model.Region> findByActive(
357                    boolean active, int start, int end,
358                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
359                    throws com.liferay.portal.kernel.exception.SystemException {
360                    return getPersistence()
361                                       .findByActive(active, start, end, orderByComparator);
362            }
363    
364            /**
365            * Returns the first region in the ordered set where active = &#63;.
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 active the active
372            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
373            * @return the first matching region
374            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
375            * @throws SystemException if a system exception occurred
376            */
377            public static com.liferay.portal.model.Region findByActive_First(
378                    boolean active,
379                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
380                    throws com.liferay.portal.NoSuchRegionException,
381                            com.liferay.portal.kernel.exception.SystemException {
382                    return getPersistence().findByActive_First(active, orderByComparator);
383            }
384    
385            /**
386            * Returns the last region in the ordered set where active = &#63;.
387            *
388            * <p>
389            * 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.
390            * </p>
391            *
392            * @param active the active
393            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
394            * @return the last matching region
395            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
396            * @throws SystemException if a system exception occurred
397            */
398            public static com.liferay.portal.model.Region findByActive_Last(
399                    boolean active,
400                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
401                    throws com.liferay.portal.NoSuchRegionException,
402                            com.liferay.portal.kernel.exception.SystemException {
403                    return getPersistence().findByActive_Last(active, orderByComparator);
404            }
405    
406            /**
407            * Returns the regions before and after the current region in the ordered set where active = &#63;.
408            *
409            * <p>
410            * 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.
411            * </p>
412            *
413            * @param regionId the primary key of the current region
414            * @param active the active
415            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
416            * @return the previous, current, and next region
417            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
418            * @throws SystemException if a system exception occurred
419            */
420            public static com.liferay.portal.model.Region[] findByActive_PrevAndNext(
421                    long regionId, boolean active,
422                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
423                    throws com.liferay.portal.NoSuchRegionException,
424                            com.liferay.portal.kernel.exception.SystemException {
425                    return getPersistence()
426                                       .findByActive_PrevAndNext(regionId, active, orderByComparator);
427            }
428    
429            /**
430            * Returns all the regions where countryId = &#63; and active = &#63;.
431            *
432            * @param countryId the country ID
433            * @param active the active
434            * @return the matching regions
435            * @throws SystemException if a system exception occurred
436            */
437            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
438                    long countryId, boolean active)
439                    throws com.liferay.portal.kernel.exception.SystemException {
440                    return getPersistence().findByC_A(countryId, active);
441            }
442    
443            /**
444            * Returns a range of all the regions where countryId = &#63; and active = &#63;.
445            *
446            * <p>
447            * 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.
448            * </p>
449            *
450            * @param countryId the country ID
451            * @param active the active
452            * @param start the lower bound of the range of regions
453            * @param end the upper bound of the range of regions (not inclusive)
454            * @return the range of matching regions
455            * @throws SystemException if a system exception occurred
456            */
457            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
458                    long countryId, boolean active, int start, int end)
459                    throws com.liferay.portal.kernel.exception.SystemException {
460                    return getPersistence().findByC_A(countryId, active, start, end);
461            }
462    
463            /**
464            * Returns an ordered range of all the regions where countryId = &#63; and active = &#63;.
465            *
466            * <p>
467            * 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.
468            * </p>
469            *
470            * @param countryId the country ID
471            * @param active the active
472            * @param start the lower bound of the range of regions
473            * @param end the upper bound of the range of regions (not inclusive)
474            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
475            * @return the ordered range of matching regions
476            * @throws SystemException if a system exception occurred
477            */
478            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
479                    long countryId, boolean active, int start, int end,
480                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
481                    throws com.liferay.portal.kernel.exception.SystemException {
482                    return getPersistence()
483                                       .findByC_A(countryId, active, start, end, orderByComparator);
484            }
485    
486            /**
487            * Returns the first region in the ordered set where countryId = &#63; and active = &#63;.
488            *
489            * <p>
490            * 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.
491            * </p>
492            *
493            * @param countryId the country ID
494            * @param active the active
495            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
496            * @return the first matching region
497            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
498            * @throws SystemException if a system exception occurred
499            */
500            public static com.liferay.portal.model.Region findByC_A_First(
501                    long countryId, boolean active,
502                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
503                    throws com.liferay.portal.NoSuchRegionException,
504                            com.liferay.portal.kernel.exception.SystemException {
505                    return getPersistence()
506                                       .findByC_A_First(countryId, active, orderByComparator);
507            }
508    
509            /**
510            * Returns the last region in the ordered set where countryId = &#63; and active = &#63;.
511            *
512            * <p>
513            * 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.
514            * </p>
515            *
516            * @param countryId the country ID
517            * @param active the active
518            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
519            * @return the last matching region
520            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
521            * @throws SystemException if a system exception occurred
522            */
523            public static com.liferay.portal.model.Region findByC_A_Last(
524                    long countryId, boolean active,
525                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
526                    throws com.liferay.portal.NoSuchRegionException,
527                            com.liferay.portal.kernel.exception.SystemException {
528                    return getPersistence()
529                                       .findByC_A_Last(countryId, active, orderByComparator);
530            }
531    
532            /**
533            * Returns the regions before and after the current region in the ordered set where countryId = &#63; and active = &#63;.
534            *
535            * <p>
536            * 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.
537            * </p>
538            *
539            * @param regionId the primary key of the current region
540            * @param countryId the country ID
541            * @param active the active
542            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
543            * @return the previous, current, and next region
544            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
545            * @throws SystemException if a system exception occurred
546            */
547            public static com.liferay.portal.model.Region[] findByC_A_PrevAndNext(
548                    long regionId, long countryId, boolean active,
549                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
550                    throws com.liferay.portal.NoSuchRegionException,
551                            com.liferay.portal.kernel.exception.SystemException {
552                    return getPersistence()
553                                       .findByC_A_PrevAndNext(regionId, countryId, active,
554                            orderByComparator);
555            }
556    
557            /**
558            * Returns all the regions.
559            *
560            * @return the regions
561            * @throws SystemException if a system exception occurred
562            */
563            public static java.util.List<com.liferay.portal.model.Region> findAll()
564                    throws com.liferay.portal.kernel.exception.SystemException {
565                    return getPersistence().findAll();
566            }
567    
568            /**
569            * Returns a range of all the regions.
570            *
571            * <p>
572            * 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.
573            * </p>
574            *
575            * @param start the lower bound of the range of regions
576            * @param end the upper bound of the range of regions (not inclusive)
577            * @return the range of regions
578            * @throws SystemException if a system exception occurred
579            */
580            public static java.util.List<com.liferay.portal.model.Region> findAll(
581                    int start, int end)
582                    throws com.liferay.portal.kernel.exception.SystemException {
583                    return getPersistence().findAll(start, end);
584            }
585    
586            /**
587            * Returns an ordered range of all the regions.
588            *
589            * <p>
590            * 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.
591            * </p>
592            *
593            * @param start the lower bound of the range of regions
594            * @param end the upper bound of the range of regions (not inclusive)
595            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
596            * @return the ordered range of regions
597            * @throws SystemException if a system exception occurred
598            */
599            public static java.util.List<com.liferay.portal.model.Region> findAll(
600                    int start, int end,
601                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
602                    throws com.liferay.portal.kernel.exception.SystemException {
603                    return getPersistence().findAll(start, end, orderByComparator);
604            }
605    
606            /**
607            * Removes all the regions where countryId = &#63; from the database.
608            *
609            * @param countryId the country ID
610            * @throws SystemException if a system exception occurred
611            */
612            public static void removeByCountryId(long countryId)
613                    throws com.liferay.portal.kernel.exception.SystemException {
614                    getPersistence().removeByCountryId(countryId);
615            }
616    
617            /**
618            * Removes all the regions where active = &#63; from the database.
619            *
620            * @param active the active
621            * @throws SystemException if a system exception occurred
622            */
623            public static void removeByActive(boolean active)
624                    throws com.liferay.portal.kernel.exception.SystemException {
625                    getPersistence().removeByActive(active);
626            }
627    
628            /**
629            * Removes all the regions where countryId = &#63; and active = &#63; from the database.
630            *
631            * @param countryId the country ID
632            * @param active the active
633            * @throws SystemException if a system exception occurred
634            */
635            public static void removeByC_A(long countryId, boolean active)
636                    throws com.liferay.portal.kernel.exception.SystemException {
637                    getPersistence().removeByC_A(countryId, active);
638            }
639    
640            /**
641            * Removes all the regions from the database.
642            *
643            * @throws SystemException if a system exception occurred
644            */
645            public static void removeAll()
646                    throws com.liferay.portal.kernel.exception.SystemException {
647                    getPersistence().removeAll();
648            }
649    
650            /**
651            * Returns the number of regions where countryId = &#63;.
652            *
653            * @param countryId the country ID
654            * @return the number of matching regions
655            * @throws SystemException if a system exception occurred
656            */
657            public static int countByCountryId(long countryId)
658                    throws com.liferay.portal.kernel.exception.SystemException {
659                    return getPersistence().countByCountryId(countryId);
660            }
661    
662            /**
663            * Returns the number of regions where active = &#63;.
664            *
665            * @param active the active
666            * @return the number of matching regions
667            * @throws SystemException if a system exception occurred
668            */
669            public static int countByActive(boolean active)
670                    throws com.liferay.portal.kernel.exception.SystemException {
671                    return getPersistence().countByActive(active);
672            }
673    
674            /**
675            * Returns the number of regions where countryId = &#63; and active = &#63;.
676            *
677            * @param countryId the country ID
678            * @param active the active
679            * @return the number of matching regions
680            * @throws SystemException if a system exception occurred
681            */
682            public static int countByC_A(long countryId, boolean active)
683                    throws com.liferay.portal.kernel.exception.SystemException {
684                    return getPersistence().countByC_A(countryId, active);
685            }
686    
687            /**
688            * Returns the number of regions.
689            *
690            * @return the number of regions
691            * @throws SystemException if a system exception occurred
692            */
693            public static int countAll()
694                    throws com.liferay.portal.kernel.exception.SystemException {
695                    return getPersistence().countAll();
696            }
697    
698            public static RegionPersistence getPersistence() {
699                    if (_persistence == null) {
700                            _persistence = (RegionPersistence)PortalBeanLocatorUtil.locate(RegionPersistence.class.getName());
701    
702                            ReferenceRegistry.registerReference(RegionUtil.class, "_persistence");
703                    }
704    
705                    return _persistence;
706            }
707    
708            public void setPersistence(RegionPersistence persistence) {
709                    _persistence = persistence;
710    
711                    ReferenceRegistry.registerReference(RegionUtil.class, "_persistence");
712            }
713    
714            private static RegionPersistence _persistence;
715    }