001    /**
002     * Copyright (c) 2000-2010 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.model.Country;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.util.List;
025    
026    /**
027     * The persistence utility for the country service.
028     *
029     * <p>
030     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this class.
031     * </p>
032     *
033     * @author Brian Wing Shun Chan
034     * @see CountryPersistence
035     * @see CountryPersistenceImpl
036     * @generated
037     */
038    public class CountryUtil {
039            /**
040             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
041             */
042            public static void clearCache() {
043                    getPersistence().clearCache();
044            }
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
048             */
049            public static void clearCache(Country country) {
050                    getPersistence().clearCache(country);
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
055             */
056            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
057                    throws SystemException {
058                    return getPersistence().countWithDynamicQuery(dynamicQuery);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
063             */
064            public static List<Country> findWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().findWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
071             */
072            public static List<Country> findWithDynamicQuery(
073                    DynamicQuery dynamicQuery, int start, int end)
074                    throws SystemException {
075                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
076            }
077    
078            /**
079             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
080             */
081            public static List<Country> findWithDynamicQuery(
082                    DynamicQuery dynamicQuery, int start, int end,
083                    OrderByComparator orderByComparator) throws SystemException {
084                    return getPersistence()
085                                       .findWithDynamicQuery(dynamicQuery, start, end,
086                            orderByComparator);
087            }
088    
089            /**
090             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
091             */
092            public static Country remove(Country country) throws SystemException {
093                    return getPersistence().remove(country);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
098             */
099            public static Country update(Country country, boolean merge)
100                    throws SystemException {
101                    return getPersistence().update(country, merge);
102            }
103    
104            /**
105             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
106             */
107            public static Country update(Country country, boolean merge,
108                    ServiceContext serviceContext) throws SystemException {
109                    return getPersistence().update(country, merge, serviceContext);
110            }
111    
112            /**
113            * Caches the country in the entity cache if it is enabled.
114            *
115            * @param country the country to cache
116            */
117            public static void cacheResult(com.liferay.portal.model.Country country) {
118                    getPersistence().cacheResult(country);
119            }
120    
121            /**
122            * Caches the countries in the entity cache if it is enabled.
123            *
124            * @param countries the countries to cache
125            */
126            public static void cacheResult(
127                    java.util.List<com.liferay.portal.model.Country> countries) {
128                    getPersistence().cacheResult(countries);
129            }
130    
131            /**
132            * Creates a new country with the primary key.
133            *
134            * @param countryId the primary key for the new country
135            * @return the new country
136            */
137            public static com.liferay.portal.model.Country create(long countryId) {
138                    return getPersistence().create(countryId);
139            }
140    
141            /**
142            * Removes the country with the primary key from the database. Also notifies the appropriate model listeners.
143            *
144            * @param countryId the primary key of the country to remove
145            * @return the country that was removed
146            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
147            * @throws SystemException if a system exception occurred
148            */
149            public static com.liferay.portal.model.Country remove(long countryId)
150                    throws com.liferay.portal.NoSuchCountryException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    return getPersistence().remove(countryId);
153            }
154    
155            public static com.liferay.portal.model.Country updateImpl(
156                    com.liferay.portal.model.Country country, boolean merge)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getPersistence().updateImpl(country, merge);
159            }
160    
161            /**
162            * Finds the country with the primary key or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
163            *
164            * @param countryId the primary key of the country to find
165            * @return the country
166            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portal.model.Country findByPrimaryKey(
170                    long countryId)
171                    throws com.liferay.portal.NoSuchCountryException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getPersistence().findByPrimaryKey(countryId);
174            }
175    
176            /**
177            * Finds the country with the primary key or returns <code>null</code> if it could not be found.
178            *
179            * @param countryId the primary key of the country to find
180            * @return the country, or <code>null</code> if a country with the primary key could not be found
181            * @throws SystemException if a system exception occurred
182            */
183            public static com.liferay.portal.model.Country fetchByPrimaryKey(
184                    long countryId)
185                    throws com.liferay.portal.kernel.exception.SystemException {
186                    return getPersistence().fetchByPrimaryKey(countryId);
187            }
188    
189            /**
190            * Finds the country where name = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
191            *
192            * @param name the name to search with
193            * @return the matching country
194            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
195            * @throws SystemException if a system exception occurred
196            */
197            public static com.liferay.portal.model.Country findByName(
198                    java.lang.String name)
199                    throws com.liferay.portal.NoSuchCountryException,
200                            com.liferay.portal.kernel.exception.SystemException {
201                    return getPersistence().findByName(name);
202            }
203    
204            /**
205            * Finds the country where name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
206            *
207            * @param name the name to search with
208            * @return the matching country, or <code>null</code> if a matching country could not be found
209            * @throws SystemException if a system exception occurred
210            */
211            public static com.liferay.portal.model.Country fetchByName(
212                    java.lang.String name)
213                    throws com.liferay.portal.kernel.exception.SystemException {
214                    return getPersistence().fetchByName(name);
215            }
216    
217            /**
218            * Finds the country where name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
219            *
220            * @param name the name to search with
221            * @return the matching country, or <code>null</code> if a matching country could not be found
222            * @throws SystemException if a system exception occurred
223            */
224            public static com.liferay.portal.model.Country fetchByName(
225                    java.lang.String name, boolean retrieveFromCache)
226                    throws com.liferay.portal.kernel.exception.SystemException {
227                    return getPersistence().fetchByName(name, retrieveFromCache);
228            }
229    
230            /**
231            * Finds the country where a2 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
232            *
233            * @param a2 the a2 to search with
234            * @return the matching country
235            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
236            * @throws SystemException if a system exception occurred
237            */
238            public static com.liferay.portal.model.Country findByA2(java.lang.String a2)
239                    throws com.liferay.portal.NoSuchCountryException,
240                            com.liferay.portal.kernel.exception.SystemException {
241                    return getPersistence().findByA2(a2);
242            }
243    
244            /**
245            * Finds the country where a2 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
246            *
247            * @param a2 the a2 to search with
248            * @return the matching country, or <code>null</code> if a matching country could not be found
249            * @throws SystemException if a system exception occurred
250            */
251            public static com.liferay.portal.model.Country fetchByA2(
252                    java.lang.String a2)
253                    throws com.liferay.portal.kernel.exception.SystemException {
254                    return getPersistence().fetchByA2(a2);
255            }
256    
257            /**
258            * Finds the country where a2 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
259            *
260            * @param a2 the a2 to search with
261            * @return the matching country, or <code>null</code> if a matching country could not be found
262            * @throws SystemException if a system exception occurred
263            */
264            public static com.liferay.portal.model.Country fetchByA2(
265                    java.lang.String a2, boolean retrieveFromCache)
266                    throws com.liferay.portal.kernel.exception.SystemException {
267                    return getPersistence().fetchByA2(a2, retrieveFromCache);
268            }
269    
270            /**
271            * Finds the country where a3 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
272            *
273            * @param a3 the a3 to search with
274            * @return the matching country
275            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
276            * @throws SystemException if a system exception occurred
277            */
278            public static com.liferay.portal.model.Country findByA3(java.lang.String a3)
279                    throws com.liferay.portal.NoSuchCountryException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    return getPersistence().findByA3(a3);
282            }
283    
284            /**
285            * Finds the country where a3 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
286            *
287            * @param a3 the a3 to search with
288            * @return the matching country, or <code>null</code> if a matching country could not be found
289            * @throws SystemException if a system exception occurred
290            */
291            public static com.liferay.portal.model.Country fetchByA3(
292                    java.lang.String a3)
293                    throws com.liferay.portal.kernel.exception.SystemException {
294                    return getPersistence().fetchByA3(a3);
295            }
296    
297            /**
298            * Finds the country where a3 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
299            *
300            * @param a3 the a3 to search with
301            * @return the matching country, or <code>null</code> if a matching country could not be found
302            * @throws SystemException if a system exception occurred
303            */
304            public static com.liferay.portal.model.Country fetchByA3(
305                    java.lang.String a3, boolean retrieveFromCache)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getPersistence().fetchByA3(a3, retrieveFromCache);
308            }
309    
310            /**
311            * Finds all the countries where active = &#63;.
312            *
313            * @param active the active to search with
314            * @return the matching countries
315            * @throws SystemException if a system exception occurred
316            */
317            public static java.util.List<com.liferay.portal.model.Country> findByActive(
318                    boolean active)
319                    throws com.liferay.portal.kernel.exception.SystemException {
320                    return getPersistence().findByActive(active);
321            }
322    
323            /**
324            * Finds a range of all the countries 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 to search with
331            * @param start the lower bound of the range of countries to return
332            * @param end the upper bound of the range of countries to return (not inclusive)
333            * @return the range of matching countries
334            * @throws SystemException if a system exception occurred
335            */
336            public static java.util.List<com.liferay.portal.model.Country> 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            * Finds an ordered range of all the countries 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 to search with
350            * @param start the lower bound of the range of countries to return
351            * @param end the upper bound of the range of countries to return (not inclusive)
352            * @param orderByComparator the comparator to order the results by
353            * @return the ordered range of matching countries
354            * @throws SystemException if a system exception occurred
355            */
356            public static java.util.List<com.liferay.portal.model.Country> 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            * Finds the first country 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 to search with
372            * @param orderByComparator the comparator to order the set by
373            * @return the first matching country
374            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
375            * @throws SystemException if a system exception occurred
376            */
377            public static com.liferay.portal.model.Country findByActive_First(
378                    boolean active,
379                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
380                    throws com.liferay.portal.NoSuchCountryException,
381                            com.liferay.portal.kernel.exception.SystemException {
382                    return getPersistence().findByActive_First(active, orderByComparator);
383            }
384    
385            /**
386            * Finds the last country 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 to search with
393            * @param orderByComparator the comparator to order the set by
394            * @return the last matching country
395            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
396            * @throws SystemException if a system exception occurred
397            */
398            public static com.liferay.portal.model.Country findByActive_Last(
399                    boolean active,
400                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
401                    throws com.liferay.portal.NoSuchCountryException,
402                            com.liferay.portal.kernel.exception.SystemException {
403                    return getPersistence().findByActive_Last(active, orderByComparator);
404            }
405    
406            /**
407            * Finds the countries before and after the current country 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 countryId the primary key of the current country
414            * @param active the active to search with
415            * @param orderByComparator the comparator to order the set by
416            * @return the previous, current, and next country
417            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
418            * @throws SystemException if a system exception occurred
419            */
420            public static com.liferay.portal.model.Country[] findByActive_PrevAndNext(
421                    long countryId, boolean active,
422                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
423                    throws com.liferay.portal.NoSuchCountryException,
424                            com.liferay.portal.kernel.exception.SystemException {
425                    return getPersistence()
426                                       .findByActive_PrevAndNext(countryId, active,
427                            orderByComparator);
428            }
429    
430            /**
431            * Finds all the countries.
432            *
433            * @return the countries
434            * @throws SystemException if a system exception occurred
435            */
436            public static java.util.List<com.liferay.portal.model.Country> findAll()
437                    throws com.liferay.portal.kernel.exception.SystemException {
438                    return getPersistence().findAll();
439            }
440    
441            /**
442            * Finds a range of all the countries.
443            *
444            * <p>
445            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
446            * </p>
447            *
448            * @param start the lower bound of the range of countries to return
449            * @param end the upper bound of the range of countries to return (not inclusive)
450            * @return the range of countries
451            * @throws SystemException if a system exception occurred
452            */
453            public static java.util.List<com.liferay.portal.model.Country> findAll(
454                    int start, int end)
455                    throws com.liferay.portal.kernel.exception.SystemException {
456                    return getPersistence().findAll(start, end);
457            }
458    
459            /**
460            * Finds an ordered range of all the countries.
461            *
462            * <p>
463            * 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.
464            * </p>
465            *
466            * @param start the lower bound of the range of countries to return
467            * @param end the upper bound of the range of countries to return (not inclusive)
468            * @param orderByComparator the comparator to order the results by
469            * @return the ordered range of countries
470            * @throws SystemException if a system exception occurred
471            */
472            public static java.util.List<com.liferay.portal.model.Country> findAll(
473                    int start, int end,
474                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
475                    throws com.liferay.portal.kernel.exception.SystemException {
476                    return getPersistence().findAll(start, end, orderByComparator);
477            }
478    
479            /**
480            * Removes the country where name = &#63; from the database.
481            *
482            * @param name the name to search with
483            * @throws SystemException if a system exception occurred
484            */
485            public static void removeByName(java.lang.String name)
486                    throws com.liferay.portal.NoSuchCountryException,
487                            com.liferay.portal.kernel.exception.SystemException {
488                    getPersistence().removeByName(name);
489            }
490    
491            /**
492            * Removes the country where a2 = &#63; from the database.
493            *
494            * @param a2 the a2 to search with
495            * @throws SystemException if a system exception occurred
496            */
497            public static void removeByA2(java.lang.String a2)
498                    throws com.liferay.portal.NoSuchCountryException,
499                            com.liferay.portal.kernel.exception.SystemException {
500                    getPersistence().removeByA2(a2);
501            }
502    
503            /**
504            * Removes the country where a3 = &#63; from the database.
505            *
506            * @param a3 the a3 to search with
507            * @throws SystemException if a system exception occurred
508            */
509            public static void removeByA3(java.lang.String a3)
510                    throws com.liferay.portal.NoSuchCountryException,
511                            com.liferay.portal.kernel.exception.SystemException {
512                    getPersistence().removeByA3(a3);
513            }
514    
515            /**
516            * Removes all the countries where active = &#63; from the database.
517            *
518            * @param active the active to search with
519            * @throws SystemException if a system exception occurred
520            */
521            public static void removeByActive(boolean active)
522                    throws com.liferay.portal.kernel.exception.SystemException {
523                    getPersistence().removeByActive(active);
524            }
525    
526            /**
527            * Removes all the countries from the database.
528            *
529            * @throws SystemException if a system exception occurred
530            */
531            public static void removeAll()
532                    throws com.liferay.portal.kernel.exception.SystemException {
533                    getPersistence().removeAll();
534            }
535    
536            /**
537            * Counts all the countries where name = &#63;.
538            *
539            * @param name the name to search with
540            * @return the number of matching countries
541            * @throws SystemException if a system exception occurred
542            */
543            public static int countByName(java.lang.String name)
544                    throws com.liferay.portal.kernel.exception.SystemException {
545                    return getPersistence().countByName(name);
546            }
547    
548            /**
549            * Counts all the countries where a2 = &#63;.
550            *
551            * @param a2 the a2 to search with
552            * @return the number of matching countries
553            * @throws SystemException if a system exception occurred
554            */
555            public static int countByA2(java.lang.String a2)
556                    throws com.liferay.portal.kernel.exception.SystemException {
557                    return getPersistence().countByA2(a2);
558            }
559    
560            /**
561            * Counts all the countries where a3 = &#63;.
562            *
563            * @param a3 the a3 to search with
564            * @return the number of matching countries
565            * @throws SystemException if a system exception occurred
566            */
567            public static int countByA3(java.lang.String a3)
568                    throws com.liferay.portal.kernel.exception.SystemException {
569                    return getPersistence().countByA3(a3);
570            }
571    
572            /**
573            * Counts all the countries where active = &#63;.
574            *
575            * @param active the active to search with
576            * @return the number of matching countries
577            * @throws SystemException if a system exception occurred
578            */
579            public static int countByActive(boolean active)
580                    throws com.liferay.portal.kernel.exception.SystemException {
581                    return getPersistence().countByActive(active);
582            }
583    
584            /**
585            * Counts all the countries.
586            *
587            * @return the number of countries
588            * @throws SystemException if a system exception occurred
589            */
590            public static int countAll()
591                    throws com.liferay.portal.kernel.exception.SystemException {
592                    return getPersistence().countAll();
593            }
594    
595            public static CountryPersistence getPersistence() {
596                    if (_persistence == null) {
597                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
598                    }
599    
600                    return _persistence;
601            }
602    
603            public void setPersistence(CountryPersistence persistence) {
604                    _persistence = persistence;
605            }
606    
607            private static CountryPersistence _persistence;
608    }