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)
097             */
098            public static Region update(Region region) throws SystemException {
099                    return getPersistence().update(region);
100            }
101    
102            /**
103             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
104             */
105            public static Region update(Region region, ServiceContext serviceContext)
106                    throws SystemException {
107                    return getPersistence().update(region, serviceContext);
108            }
109    
110            /**
111            * Caches the region in the entity cache if it is enabled.
112            *
113            * @param region the region
114            */
115            public static void cacheResult(com.liferay.portal.model.Region region) {
116                    getPersistence().cacheResult(region);
117            }
118    
119            /**
120            * Caches the regions in the entity cache if it is enabled.
121            *
122            * @param regions the regions
123            */
124            public static void cacheResult(
125                    java.util.List<com.liferay.portal.model.Region> regions) {
126                    getPersistence().cacheResult(regions);
127            }
128    
129            /**
130            * Creates a new region with the primary key. Does not add the region to the database.
131            *
132            * @param regionId the primary key for the new region
133            * @return the new region
134            */
135            public static com.liferay.portal.model.Region create(long regionId) {
136                    return getPersistence().create(regionId);
137            }
138    
139            /**
140            * Removes the region with the primary key from the database. Also notifies the appropriate model listeners.
141            *
142            * @param regionId the primary key of the region
143            * @return the region that was removed
144            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
145            * @throws SystemException if a system exception occurred
146            */
147            public static com.liferay.portal.model.Region remove(long regionId)
148                    throws com.liferay.portal.NoSuchRegionException,
149                            com.liferay.portal.kernel.exception.SystemException {
150                    return getPersistence().remove(regionId);
151            }
152    
153            public static com.liferay.portal.model.Region updateImpl(
154                    com.liferay.portal.model.Region region)
155                    throws com.liferay.portal.kernel.exception.SystemException {
156                    return getPersistence().updateImpl(region);
157            }
158    
159            /**
160            * Returns the region with the primary key or throws a {@link com.liferay.portal.NoSuchRegionException} if it could not be found.
161            *
162            * @param regionId the primary key of the region
163            * @return the region
164            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
165            * @throws SystemException if a system exception occurred
166            */
167            public static com.liferay.portal.model.Region findByPrimaryKey(
168                    long regionId)
169                    throws com.liferay.portal.NoSuchRegionException,
170                            com.liferay.portal.kernel.exception.SystemException {
171                    return getPersistence().findByPrimaryKey(regionId);
172            }
173    
174            /**
175            * Returns the region with the primary key or returns <code>null</code> if it could not be found.
176            *
177            * @param regionId the primary key of the region
178            * @return the region, or <code>null</code> if a region with the primary key could not be found
179            * @throws SystemException if a system exception occurred
180            */
181            public static com.liferay.portal.model.Region fetchByPrimaryKey(
182                    long regionId)
183                    throws com.liferay.portal.kernel.exception.SystemException {
184                    return getPersistence().fetchByPrimaryKey(regionId);
185            }
186    
187            /**
188            * Returns all the regions where countryId = &#63;.
189            *
190            * @param countryId the country ID
191            * @return the matching regions
192            * @throws SystemException if a system exception occurred
193            */
194            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
195                    long countryId)
196                    throws com.liferay.portal.kernel.exception.SystemException {
197                    return getPersistence().findByCountryId(countryId);
198            }
199    
200            /**
201            * Returns a range of all the regions where countryId = &#63;.
202            *
203            * <p>
204            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
205            * </p>
206            *
207            * @param countryId the country ID
208            * @param start the lower bound of the range of regions
209            * @param end the upper bound of the range of regions (not inclusive)
210            * @return the range of matching regions
211            * @throws SystemException if a system exception occurred
212            */
213            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
214                    long countryId, int start, int end)
215                    throws com.liferay.portal.kernel.exception.SystemException {
216                    return getPersistence().findByCountryId(countryId, start, end);
217            }
218    
219            /**
220            * Returns an ordered range of all the regions where countryId = &#63;.
221            *
222            * <p>
223            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
224            * </p>
225            *
226            * @param countryId the country ID
227            * @param start the lower bound of the range of regions
228            * @param end the upper bound of the range of regions (not inclusive)
229            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
230            * @return the ordered range of matching regions
231            * @throws SystemException if a system exception occurred
232            */
233            public static java.util.List<com.liferay.portal.model.Region> findByCountryId(
234                    long countryId, int start, int end,
235                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
236                    throws com.liferay.portal.kernel.exception.SystemException {
237                    return getPersistence()
238                                       .findByCountryId(countryId, start, end, orderByComparator);
239            }
240    
241            /**
242            * Returns the first region in the ordered set where countryId = &#63;.
243            *
244            * @param countryId the country ID
245            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
246            * @return the first matching region
247            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
248            * @throws SystemException if a system exception occurred
249            */
250            public static com.liferay.portal.model.Region findByCountryId_First(
251                    long countryId,
252                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
253                    throws com.liferay.portal.NoSuchRegionException,
254                            com.liferay.portal.kernel.exception.SystemException {
255                    return getPersistence()
256                                       .findByCountryId_First(countryId, orderByComparator);
257            }
258    
259            /**
260            * Returns the first region in the ordered set where countryId = &#63;.
261            *
262            * @param countryId the country ID
263            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
264            * @return the first matching region, or <code>null</code> if a matching region could not be found
265            * @throws SystemException if a system exception occurred
266            */
267            public static com.liferay.portal.model.Region fetchByCountryId_First(
268                    long countryId,
269                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
270                    throws com.liferay.portal.kernel.exception.SystemException {
271                    return getPersistence()
272                                       .fetchByCountryId_First(countryId, orderByComparator);
273            }
274    
275            /**
276            * Returns the last region in the ordered set where countryId = &#63;.
277            *
278            * @param countryId the country ID
279            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
280            * @return the last matching region
281            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
282            * @throws SystemException if a system exception occurred
283            */
284            public static com.liferay.portal.model.Region findByCountryId_Last(
285                    long countryId,
286                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
287                    throws com.liferay.portal.NoSuchRegionException,
288                            com.liferay.portal.kernel.exception.SystemException {
289                    return getPersistence()
290                                       .findByCountryId_Last(countryId, orderByComparator);
291            }
292    
293            /**
294            * Returns the last region in the ordered set where countryId = &#63;.
295            *
296            * @param countryId the country ID
297            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
298            * @return the last matching region, or <code>null</code> if a matching region could not be found
299            * @throws SystemException if a system exception occurred
300            */
301            public static com.liferay.portal.model.Region fetchByCountryId_Last(
302                    long countryId,
303                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
304                    throws com.liferay.portal.kernel.exception.SystemException {
305                    return getPersistence()
306                                       .fetchByCountryId_Last(countryId, orderByComparator);
307            }
308    
309            /**
310            * Returns the regions before and after the current region in the ordered set where countryId = &#63;.
311            *
312            * @param regionId the primary key of the current region
313            * @param countryId the country ID
314            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
315            * @return the previous, current, and next region
316            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
317            * @throws SystemException if a system exception occurred
318            */
319            public static com.liferay.portal.model.Region[] findByCountryId_PrevAndNext(
320                    long regionId, long countryId,
321                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
322                    throws com.liferay.portal.NoSuchRegionException,
323                            com.liferay.portal.kernel.exception.SystemException {
324                    return getPersistence()
325                                       .findByCountryId_PrevAndNext(regionId, countryId,
326                            orderByComparator);
327            }
328    
329            /**
330            * Returns all the regions where active = &#63;.
331            *
332            * @param active the active
333            * @return the 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)
338                    throws com.liferay.portal.kernel.exception.SystemException {
339                    return getPersistence().findByActive(active);
340            }
341    
342            /**
343            * Returns a 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            * @return the range of matching regions
353            * @throws SystemException if a system exception occurred
354            */
355            public static java.util.List<com.liferay.portal.model.Region> findByActive(
356                    boolean active, int start, int end)
357                    throws com.liferay.portal.kernel.exception.SystemException {
358                    return getPersistence().findByActive(active, start, end);
359            }
360    
361            /**
362            * Returns an ordered range of all the regions where active = &#63;.
363            *
364            * <p>
365            * 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.
366            * </p>
367            *
368            * @param active the active
369            * @param start the lower bound of the range of regions
370            * @param end the upper bound of the range of regions (not inclusive)
371            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
372            * @return the ordered range of matching regions
373            * @throws SystemException if a system exception occurred
374            */
375            public static java.util.List<com.liferay.portal.model.Region> findByActive(
376                    boolean active, int start, int end,
377                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
378                    throws com.liferay.portal.kernel.exception.SystemException {
379                    return getPersistence()
380                                       .findByActive(active, start, end, orderByComparator);
381            }
382    
383            /**
384            * Returns the first region in the ordered set where active = &#63;.
385            *
386            * @param active the active
387            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
388            * @return the first matching region
389            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
390            * @throws SystemException if a system exception occurred
391            */
392            public static com.liferay.portal.model.Region findByActive_First(
393                    boolean active,
394                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
395                    throws com.liferay.portal.NoSuchRegionException,
396                            com.liferay.portal.kernel.exception.SystemException {
397                    return getPersistence().findByActive_First(active, orderByComparator);
398            }
399    
400            /**
401            * Returns the first region in the ordered set where active = &#63;.
402            *
403            * @param active the active
404            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
405            * @return the first matching region, or <code>null</code> if a matching region could not be found
406            * @throws SystemException if a system exception occurred
407            */
408            public static com.liferay.portal.model.Region fetchByActive_First(
409                    boolean active,
410                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
411                    throws com.liferay.portal.kernel.exception.SystemException {
412                    return getPersistence().fetchByActive_First(active, orderByComparator);
413            }
414    
415            /**
416            * Returns the last region in the ordered set where active = &#63;.
417            *
418            * @param active the active
419            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
420            * @return the last matching region
421            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
422            * @throws SystemException if a system exception occurred
423            */
424            public static com.liferay.portal.model.Region findByActive_Last(
425                    boolean active,
426                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
427                    throws com.liferay.portal.NoSuchRegionException,
428                            com.liferay.portal.kernel.exception.SystemException {
429                    return getPersistence().findByActive_Last(active, orderByComparator);
430            }
431    
432            /**
433            * Returns the last region in the ordered set where active = &#63;.
434            *
435            * @param active the active
436            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
437            * @return the last matching region, or <code>null</code> if a matching region could not be found
438            * @throws SystemException if a system exception occurred
439            */
440            public static com.liferay.portal.model.Region fetchByActive_Last(
441                    boolean active,
442                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
443                    throws com.liferay.portal.kernel.exception.SystemException {
444                    return getPersistence().fetchByActive_Last(active, orderByComparator);
445            }
446    
447            /**
448            * Returns the regions before and after the current region in the ordered set where active = &#63;.
449            *
450            * @param regionId the primary key of the current region
451            * @param active the active
452            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
453            * @return the previous, current, and next region
454            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
455            * @throws SystemException if a system exception occurred
456            */
457            public static com.liferay.portal.model.Region[] findByActive_PrevAndNext(
458                    long regionId, boolean active,
459                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
460                    throws com.liferay.portal.NoSuchRegionException,
461                            com.liferay.portal.kernel.exception.SystemException {
462                    return getPersistence()
463                                       .findByActive_PrevAndNext(regionId, active, orderByComparator);
464            }
465    
466            /**
467            * Returns the region where countryId = &#63; and regionCode = &#63; or throws a {@link com.liferay.portal.NoSuchRegionException} if it could not be found.
468            *
469            * @param countryId the country ID
470            * @param regionCode the region code
471            * @return the matching region
472            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
473            * @throws SystemException if a system exception occurred
474            */
475            public static com.liferay.portal.model.Region findByC_R(long countryId,
476                    java.lang.String regionCode)
477                    throws com.liferay.portal.NoSuchRegionException,
478                            com.liferay.portal.kernel.exception.SystemException {
479                    return getPersistence().findByC_R(countryId, regionCode);
480            }
481    
482            /**
483            * Returns the region where countryId = &#63; and regionCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
484            *
485            * @param countryId the country ID
486            * @param regionCode the region code
487            * @return the matching region, or <code>null</code> if a matching region could not be found
488            * @throws SystemException if a system exception occurred
489            */
490            public static com.liferay.portal.model.Region fetchByC_R(long countryId,
491                    java.lang.String regionCode)
492                    throws com.liferay.portal.kernel.exception.SystemException {
493                    return getPersistence().fetchByC_R(countryId, regionCode);
494            }
495    
496            /**
497            * Returns the region where countryId = &#63; and regionCode = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
498            *
499            * @param countryId the country ID
500            * @param regionCode the region code
501            * @param retrieveFromCache whether to use the finder cache
502            * @return the matching region, or <code>null</code> if a matching region could not be found
503            * @throws SystemException if a system exception occurred
504            */
505            public static com.liferay.portal.model.Region fetchByC_R(long countryId,
506                    java.lang.String regionCode, boolean retrieveFromCache)
507                    throws com.liferay.portal.kernel.exception.SystemException {
508                    return getPersistence()
509                                       .fetchByC_R(countryId, regionCode, retrieveFromCache);
510            }
511    
512            /**
513            * Returns all the regions where countryId = &#63; and active = &#63;.
514            *
515            * @param countryId the country ID
516            * @param active the active
517            * @return the matching regions
518            * @throws SystemException if a system exception occurred
519            */
520            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
521                    long countryId, boolean active)
522                    throws com.liferay.portal.kernel.exception.SystemException {
523                    return getPersistence().findByC_A(countryId, active);
524            }
525    
526            /**
527            * Returns a range of all the regions where countryId = &#63; and active = &#63;.
528            *
529            * <p>
530            * 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.
531            * </p>
532            *
533            * @param countryId the country ID
534            * @param active the active
535            * @param start the lower bound of the range of regions
536            * @param end the upper bound of the range of regions (not inclusive)
537            * @return the range of matching regions
538            * @throws SystemException if a system exception occurred
539            */
540            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
541                    long countryId, boolean active, int start, int end)
542                    throws com.liferay.portal.kernel.exception.SystemException {
543                    return getPersistence().findByC_A(countryId, active, start, end);
544            }
545    
546            /**
547            * Returns an ordered range of all the regions where countryId = &#63; and active = &#63;.
548            *
549            * <p>
550            * 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.
551            * </p>
552            *
553            * @param countryId the country ID
554            * @param active the active
555            * @param start the lower bound of the range of regions
556            * @param end the upper bound of the range of regions (not inclusive)
557            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
558            * @return the ordered range of matching regions
559            * @throws SystemException if a system exception occurred
560            */
561            public static java.util.List<com.liferay.portal.model.Region> findByC_A(
562                    long countryId, boolean active, int start, int end,
563                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
564                    throws com.liferay.portal.kernel.exception.SystemException {
565                    return getPersistence()
566                                       .findByC_A(countryId, active, start, end, orderByComparator);
567            }
568    
569            /**
570            * Returns the first region in the ordered set where countryId = &#63; and active = &#63;.
571            *
572            * @param countryId the country ID
573            * @param active the active
574            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
575            * @return the first matching region
576            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
577            * @throws SystemException if a system exception occurred
578            */
579            public static com.liferay.portal.model.Region findByC_A_First(
580                    long countryId, boolean active,
581                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
582                    throws com.liferay.portal.NoSuchRegionException,
583                            com.liferay.portal.kernel.exception.SystemException {
584                    return getPersistence()
585                                       .findByC_A_First(countryId, active, orderByComparator);
586            }
587    
588            /**
589            * Returns the first region in the ordered set where countryId = &#63; and active = &#63;.
590            *
591            * @param countryId the country ID
592            * @param active the active
593            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
594            * @return the first matching region, or <code>null</code> if a matching region could not be found
595            * @throws SystemException if a system exception occurred
596            */
597            public static com.liferay.portal.model.Region fetchByC_A_First(
598                    long countryId, boolean active,
599                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
600                    throws com.liferay.portal.kernel.exception.SystemException {
601                    return getPersistence()
602                                       .fetchByC_A_First(countryId, active, orderByComparator);
603            }
604    
605            /**
606            * Returns the last region in the ordered set where countryId = &#63; and active = &#63;.
607            *
608            * @param countryId the country ID
609            * @param active the active
610            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
611            * @return the last matching region
612            * @throws com.liferay.portal.NoSuchRegionException if a matching region could not be found
613            * @throws SystemException if a system exception occurred
614            */
615            public static com.liferay.portal.model.Region findByC_A_Last(
616                    long countryId, boolean active,
617                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
618                    throws com.liferay.portal.NoSuchRegionException,
619                            com.liferay.portal.kernel.exception.SystemException {
620                    return getPersistence()
621                                       .findByC_A_Last(countryId, active, orderByComparator);
622            }
623    
624            /**
625            * Returns the last region in the ordered set where countryId = &#63; and active = &#63;.
626            *
627            * @param countryId the country ID
628            * @param active the active
629            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
630            * @return the last matching region, or <code>null</code> if a matching region could not be found
631            * @throws SystemException if a system exception occurred
632            */
633            public static com.liferay.portal.model.Region fetchByC_A_Last(
634                    long countryId, boolean active,
635                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
636                    throws com.liferay.portal.kernel.exception.SystemException {
637                    return getPersistence()
638                                       .fetchByC_A_Last(countryId, active, orderByComparator);
639            }
640    
641            /**
642            * Returns the regions before and after the current region in the ordered set where countryId = &#63; and active = &#63;.
643            *
644            * @param regionId the primary key of the current region
645            * @param countryId the country ID
646            * @param active the active
647            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
648            * @return the previous, current, and next region
649            * @throws com.liferay.portal.NoSuchRegionException if a region with the primary key could not be found
650            * @throws SystemException if a system exception occurred
651            */
652            public static com.liferay.portal.model.Region[] findByC_A_PrevAndNext(
653                    long regionId, long countryId, boolean active,
654                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
655                    throws com.liferay.portal.NoSuchRegionException,
656                            com.liferay.portal.kernel.exception.SystemException {
657                    return getPersistence()
658                                       .findByC_A_PrevAndNext(regionId, countryId, active,
659                            orderByComparator);
660            }
661    
662            /**
663            * Returns all the regions.
664            *
665            * @return the regions
666            * @throws SystemException if a system exception occurred
667            */
668            public static java.util.List<com.liferay.portal.model.Region> findAll()
669                    throws com.liferay.portal.kernel.exception.SystemException {
670                    return getPersistence().findAll();
671            }
672    
673            /**
674            * Returns a range of all the regions.
675            *
676            * <p>
677            * 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.
678            * </p>
679            *
680            * @param start the lower bound of the range of regions
681            * @param end the upper bound of the range of regions (not inclusive)
682            * @return the range of regions
683            * @throws SystemException if a system exception occurred
684            */
685            public static java.util.List<com.liferay.portal.model.Region> findAll(
686                    int start, int end)
687                    throws com.liferay.portal.kernel.exception.SystemException {
688                    return getPersistence().findAll(start, end);
689            }
690    
691            /**
692            * Returns an ordered range of all the regions.
693            *
694            * <p>
695            * 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.
696            * </p>
697            *
698            * @param start the lower bound of the range of regions
699            * @param end the upper bound of the range of regions (not inclusive)
700            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
701            * @return the ordered range of regions
702            * @throws SystemException if a system exception occurred
703            */
704            public static java.util.List<com.liferay.portal.model.Region> findAll(
705                    int start, int end,
706                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
707                    throws com.liferay.portal.kernel.exception.SystemException {
708                    return getPersistence().findAll(start, end, orderByComparator);
709            }
710    
711            /**
712            * Removes all the regions where countryId = &#63; from the database.
713            *
714            * @param countryId the country ID
715            * @throws SystemException if a system exception occurred
716            */
717            public static void removeByCountryId(long countryId)
718                    throws com.liferay.portal.kernel.exception.SystemException {
719                    getPersistence().removeByCountryId(countryId);
720            }
721    
722            /**
723            * Removes all the regions where active = &#63; from the database.
724            *
725            * @param active the active
726            * @throws SystemException if a system exception occurred
727            */
728            public static void removeByActive(boolean active)
729                    throws com.liferay.portal.kernel.exception.SystemException {
730                    getPersistence().removeByActive(active);
731            }
732    
733            /**
734            * Removes the region where countryId = &#63; and regionCode = &#63; from the database.
735            *
736            * @param countryId the country ID
737            * @param regionCode the region code
738            * @return the region that was removed
739            * @throws SystemException if a system exception occurred
740            */
741            public static com.liferay.portal.model.Region removeByC_R(long countryId,
742                    java.lang.String regionCode)
743                    throws com.liferay.portal.NoSuchRegionException,
744                            com.liferay.portal.kernel.exception.SystemException {
745                    return getPersistence().removeByC_R(countryId, regionCode);
746            }
747    
748            /**
749            * Removes all the regions where countryId = &#63; and active = &#63; from the database.
750            *
751            * @param countryId the country ID
752            * @param active the active
753            * @throws SystemException if a system exception occurred
754            */
755            public static void removeByC_A(long countryId, boolean active)
756                    throws com.liferay.portal.kernel.exception.SystemException {
757                    getPersistence().removeByC_A(countryId, active);
758            }
759    
760            /**
761            * Removes all the regions from the database.
762            *
763            * @throws SystemException if a system exception occurred
764            */
765            public static void removeAll()
766                    throws com.liferay.portal.kernel.exception.SystemException {
767                    getPersistence().removeAll();
768            }
769    
770            /**
771            * Returns the number of regions where countryId = &#63;.
772            *
773            * @param countryId the country ID
774            * @return the number of matching regions
775            * @throws SystemException if a system exception occurred
776            */
777            public static int countByCountryId(long countryId)
778                    throws com.liferay.portal.kernel.exception.SystemException {
779                    return getPersistence().countByCountryId(countryId);
780            }
781    
782            /**
783            * Returns the number of regions where active = &#63;.
784            *
785            * @param active the active
786            * @return the number of matching regions
787            * @throws SystemException if a system exception occurred
788            */
789            public static int countByActive(boolean active)
790                    throws com.liferay.portal.kernel.exception.SystemException {
791                    return getPersistence().countByActive(active);
792            }
793    
794            /**
795            * Returns the number of regions where countryId = &#63; and regionCode = &#63;.
796            *
797            * @param countryId the country ID
798            * @param regionCode the region code
799            * @return the number of matching regions
800            * @throws SystemException if a system exception occurred
801            */
802            public static int countByC_R(long countryId, java.lang.String regionCode)
803                    throws com.liferay.portal.kernel.exception.SystemException {
804                    return getPersistence().countByC_R(countryId, regionCode);
805            }
806    
807            /**
808            * Returns the number of regions where countryId = &#63; and active = &#63;.
809            *
810            * @param countryId the country ID
811            * @param active the active
812            * @return the number of matching regions
813            * @throws SystemException if a system exception occurred
814            */
815            public static int countByC_A(long countryId, boolean active)
816                    throws com.liferay.portal.kernel.exception.SystemException {
817                    return getPersistence().countByC_A(countryId, active);
818            }
819    
820            /**
821            * Returns the number of regions.
822            *
823            * @return the number of regions
824            * @throws SystemException if a system exception occurred
825            */
826            public static int countAll()
827                    throws com.liferay.portal.kernel.exception.SystemException {
828                    return getPersistence().countAll();
829            }
830    
831            public static RegionPersistence getPersistence() {
832                    if (_persistence == null) {
833                            _persistence = (RegionPersistence)PortalBeanLocatorUtil.locate(RegionPersistence.class.getName());
834    
835                            ReferenceRegistry.registerReference(RegionUtil.class, "_persistence");
836                    }
837    
838                    return _persistence;
839            }
840    
841            /**
842             * @deprecated
843             */
844            public void setPersistence(RegionPersistence persistence) {
845            }
846    
847            private static RegionPersistence _persistence;
848    }