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.Country;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the country service. This utility wraps {@link CountryPersistenceImpl} 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 CountryPersistence
036     * @see CountryPersistenceImpl
037     * @generated
038     */
039    public class CountryUtil {
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(Country country) {
057                    getPersistence().clearCache(country);
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<Country> 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<Country> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end)
081                    throws SystemException {
082                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
083            }
084    
085            /**
086             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
087             */
088            public static List<Country> findWithDynamicQuery(
089                    DynamicQuery dynamicQuery, int start, int end,
090                    OrderByComparator orderByComparator) throws SystemException {
091                    return getPersistence()
092                                       .findWithDynamicQuery(dynamicQuery, start, end,
093                            orderByComparator);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel)
098             */
099            public static Country update(Country country) throws SystemException {
100                    return getPersistence().update(country);
101            }
102    
103            /**
104             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
105             */
106            public static Country update(Country country, ServiceContext serviceContext)
107                    throws SystemException {
108                    return getPersistence().update(country, serviceContext);
109            }
110    
111            /**
112            * Caches the country in the entity cache if it is enabled.
113            *
114            * @param country the country
115            */
116            public static void cacheResult(com.liferay.portal.model.Country country) {
117                    getPersistence().cacheResult(country);
118            }
119    
120            /**
121            * Caches the countries in the entity cache if it is enabled.
122            *
123            * @param countries the countries
124            */
125            public static void cacheResult(
126                    java.util.List<com.liferay.portal.model.Country> countries) {
127                    getPersistence().cacheResult(countries);
128            }
129    
130            /**
131            * Creates a new country with the primary key. Does not add the country to the database.
132            *
133            * @param countryId the primary key for the new country
134            * @return the new country
135            */
136            public static com.liferay.portal.model.Country create(long countryId) {
137                    return getPersistence().create(countryId);
138            }
139    
140            /**
141            * Removes the country with the primary key from the database. Also notifies the appropriate model listeners.
142            *
143            * @param countryId the primary key of the country
144            * @return the country that was removed
145            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
146            * @throws SystemException if a system exception occurred
147            */
148            public static com.liferay.portal.model.Country remove(long countryId)
149                    throws com.liferay.portal.NoSuchCountryException,
150                            com.liferay.portal.kernel.exception.SystemException {
151                    return getPersistence().remove(countryId);
152            }
153    
154            public static com.liferay.portal.model.Country updateImpl(
155                    com.liferay.portal.model.Country country)
156                    throws com.liferay.portal.kernel.exception.SystemException {
157                    return getPersistence().updateImpl(country);
158            }
159    
160            /**
161            * Returns the country with the primary key or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
162            *
163            * @param countryId the primary key of the country
164            * @return the country
165            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
166            * @throws SystemException if a system exception occurred
167            */
168            public static com.liferay.portal.model.Country findByPrimaryKey(
169                    long countryId)
170                    throws com.liferay.portal.NoSuchCountryException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    return getPersistence().findByPrimaryKey(countryId);
173            }
174    
175            /**
176            * Returns the country with the primary key or returns <code>null</code> if it could not be found.
177            *
178            * @param countryId the primary key of the country
179            * @return the country, or <code>null</code> if a country with the primary key could not be found
180            * @throws SystemException if a system exception occurred
181            */
182            public static com.liferay.portal.model.Country fetchByPrimaryKey(
183                    long countryId)
184                    throws com.liferay.portal.kernel.exception.SystemException {
185                    return getPersistence().fetchByPrimaryKey(countryId);
186            }
187    
188            /**
189            * Returns the country where name = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
190            *
191            * @param name the name
192            * @return the matching country
193            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
194            * @throws SystemException if a system exception occurred
195            */
196            public static com.liferay.portal.model.Country findByName(
197                    java.lang.String name)
198                    throws com.liferay.portal.NoSuchCountryException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    return getPersistence().findByName(name);
201            }
202    
203            /**
204            * Returns the country where name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
205            *
206            * @param name the name
207            * @return the matching country, or <code>null</code> if a matching country could not be found
208            * @throws SystemException if a system exception occurred
209            */
210            public static com.liferay.portal.model.Country fetchByName(
211                    java.lang.String name)
212                    throws com.liferay.portal.kernel.exception.SystemException {
213                    return getPersistence().fetchByName(name);
214            }
215    
216            /**
217            * Returns the country where name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
218            *
219            * @param name the name
220            * @param retrieveFromCache whether to use the finder cache
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            * Returns 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
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            * Returns 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
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            * Returns 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
261            * @param retrieveFromCache whether to use the finder cache
262            * @return the matching country, or <code>null</code> if a matching country could not be found
263            * @throws SystemException if a system exception occurred
264            */
265            public static com.liferay.portal.model.Country fetchByA2(
266                    java.lang.String a2, boolean retrieveFromCache)
267                    throws com.liferay.portal.kernel.exception.SystemException {
268                    return getPersistence().fetchByA2(a2, retrieveFromCache);
269            }
270    
271            /**
272            * Returns the country where a3 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
273            *
274            * @param a3 the a3
275            * @return the matching country
276            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
277            * @throws SystemException if a system exception occurred
278            */
279            public static com.liferay.portal.model.Country findByA3(java.lang.String a3)
280                    throws com.liferay.portal.NoSuchCountryException,
281                            com.liferay.portal.kernel.exception.SystemException {
282                    return getPersistence().findByA3(a3);
283            }
284    
285            /**
286            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
287            *
288            * @param a3 the a3
289            * @return the matching country, or <code>null</code> if a matching country could not be found
290            * @throws SystemException if a system exception occurred
291            */
292            public static com.liferay.portal.model.Country fetchByA3(
293                    java.lang.String a3)
294                    throws com.liferay.portal.kernel.exception.SystemException {
295                    return getPersistence().fetchByA3(a3);
296            }
297    
298            /**
299            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
300            *
301            * @param a3 the a3
302            * @param retrieveFromCache whether to use the finder cache
303            * @return the matching country, or <code>null</code> if a matching country could not be found
304            * @throws SystemException if a system exception occurred
305            */
306            public static com.liferay.portal.model.Country fetchByA3(
307                    java.lang.String a3, boolean retrieveFromCache)
308                    throws com.liferay.portal.kernel.exception.SystemException {
309                    return getPersistence().fetchByA3(a3, retrieveFromCache);
310            }
311    
312            /**
313            * Returns all the countries where active = &#63;.
314            *
315            * @param active the active
316            * @return the matching countries
317            * @throws SystemException if a system exception occurred
318            */
319            public static java.util.List<com.liferay.portal.model.Country> findByActive(
320                    boolean active)
321                    throws com.liferay.portal.kernel.exception.SystemException {
322                    return getPersistence().findByActive(active);
323            }
324    
325            /**
326            * Returns a range of all the countries where active = &#63;.
327            *
328            * <p>
329            * 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.
330            * </p>
331            *
332            * @param active the active
333            * @param start the lower bound of the range of countries
334            * @param end the upper bound of the range of countries (not inclusive)
335            * @return the range of matching countries
336            * @throws SystemException if a system exception occurred
337            */
338            public static java.util.List<com.liferay.portal.model.Country> findByActive(
339                    boolean active, int start, int end)
340                    throws com.liferay.portal.kernel.exception.SystemException {
341                    return getPersistence().findByActive(active, start, end);
342            }
343    
344            /**
345            * Returns an ordered range of all the countries where active = &#63;.
346            *
347            * <p>
348            * 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.
349            * </p>
350            *
351            * @param active the active
352            * @param start the lower bound of the range of countries
353            * @param end the upper bound of the range of countries (not inclusive)
354            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
355            * @return the ordered range of matching countries
356            * @throws SystemException if a system exception occurred
357            */
358            public static java.util.List<com.liferay.portal.model.Country> findByActive(
359                    boolean active, int start, int end,
360                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
361                    throws com.liferay.portal.kernel.exception.SystemException {
362                    return getPersistence()
363                                       .findByActive(active, start, end, orderByComparator);
364            }
365    
366            /**
367            * Returns the first country in the ordered set where active = &#63;.
368            *
369            * @param active the active
370            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
371            * @return the first matching country
372            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
373            * @throws SystemException if a system exception occurred
374            */
375            public static com.liferay.portal.model.Country findByActive_First(
376                    boolean active,
377                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
378                    throws com.liferay.portal.NoSuchCountryException,
379                            com.liferay.portal.kernel.exception.SystemException {
380                    return getPersistence().findByActive_First(active, orderByComparator);
381            }
382    
383            /**
384            * Returns the first country 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 country, or <code>null</code> if a matching country could not be found
389            * @throws SystemException if a system exception occurred
390            */
391            public static com.liferay.portal.model.Country fetchByActive_First(
392                    boolean active,
393                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
394                    throws com.liferay.portal.kernel.exception.SystemException {
395                    return getPersistence().fetchByActive_First(active, orderByComparator);
396            }
397    
398            /**
399            * Returns the last country in the ordered set where active = &#63;.
400            *
401            * @param active the active
402            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
403            * @return the last matching country
404            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
405            * @throws SystemException if a system exception occurred
406            */
407            public static com.liferay.portal.model.Country findByActive_Last(
408                    boolean active,
409                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
410                    throws com.liferay.portal.NoSuchCountryException,
411                            com.liferay.portal.kernel.exception.SystemException {
412                    return getPersistence().findByActive_Last(active, orderByComparator);
413            }
414    
415            /**
416            * Returns the last country 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 country, or <code>null</code> if a matching country could not be found
421            * @throws SystemException if a system exception occurred
422            */
423            public static com.liferay.portal.model.Country fetchByActive_Last(
424                    boolean active,
425                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
426                    throws com.liferay.portal.kernel.exception.SystemException {
427                    return getPersistence().fetchByActive_Last(active, orderByComparator);
428            }
429    
430            /**
431            * Returns the countries before and after the current country in the ordered set where active = &#63;.
432            *
433            * @param countryId the primary key of the current country
434            * @param active the active
435            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
436            * @return the previous, current, and next country
437            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
438            * @throws SystemException if a system exception occurred
439            */
440            public static com.liferay.portal.model.Country[] findByActive_PrevAndNext(
441                    long countryId, boolean active,
442                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
443                    throws com.liferay.portal.NoSuchCountryException,
444                            com.liferay.portal.kernel.exception.SystemException {
445                    return getPersistence()
446                                       .findByActive_PrevAndNext(countryId, active,
447                            orderByComparator);
448            }
449    
450            /**
451            * Returns all the countries.
452            *
453            * @return the countries
454            * @throws SystemException if a system exception occurred
455            */
456            public static java.util.List<com.liferay.portal.model.Country> findAll()
457                    throws com.liferay.portal.kernel.exception.SystemException {
458                    return getPersistence().findAll();
459            }
460    
461            /**
462            * Returns a range of all the countries.
463            *
464            * <p>
465            * 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.
466            * </p>
467            *
468            * @param start the lower bound of the range of countries
469            * @param end the upper bound of the range of countries (not inclusive)
470            * @return the range of countries
471            * @throws SystemException if a system exception occurred
472            */
473            public static java.util.List<com.liferay.portal.model.Country> findAll(
474                    int start, int end)
475                    throws com.liferay.portal.kernel.exception.SystemException {
476                    return getPersistence().findAll(start, end);
477            }
478    
479            /**
480            * Returns an ordered range of all the countries.
481            *
482            * <p>
483            * 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.
484            * </p>
485            *
486            * @param start the lower bound of the range of countries
487            * @param end the upper bound of the range of countries (not inclusive)
488            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
489            * @return the ordered range of countries
490            * @throws SystemException if a system exception occurred
491            */
492            public static java.util.List<com.liferay.portal.model.Country> findAll(
493                    int start, int end,
494                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
495                    throws com.liferay.portal.kernel.exception.SystemException {
496                    return getPersistence().findAll(start, end, orderByComparator);
497            }
498    
499            /**
500            * Removes the country where name = &#63; from the database.
501            *
502            * @param name the name
503            * @return the country that was removed
504            * @throws SystemException if a system exception occurred
505            */
506            public static com.liferay.portal.model.Country removeByName(
507                    java.lang.String name)
508                    throws com.liferay.portal.NoSuchCountryException,
509                            com.liferay.portal.kernel.exception.SystemException {
510                    return getPersistence().removeByName(name);
511            }
512    
513            /**
514            * Removes the country where a2 = &#63; from the database.
515            *
516            * @param a2 the a2
517            * @return the country that was removed
518            * @throws SystemException if a system exception occurred
519            */
520            public static com.liferay.portal.model.Country removeByA2(
521                    java.lang.String a2)
522                    throws com.liferay.portal.NoSuchCountryException,
523                            com.liferay.portal.kernel.exception.SystemException {
524                    return getPersistence().removeByA2(a2);
525            }
526    
527            /**
528            * Removes the country where a3 = &#63; from the database.
529            *
530            * @param a3 the a3
531            * @return the country that was removed
532            * @throws SystemException if a system exception occurred
533            */
534            public static com.liferay.portal.model.Country removeByA3(
535                    java.lang.String a3)
536                    throws com.liferay.portal.NoSuchCountryException,
537                            com.liferay.portal.kernel.exception.SystemException {
538                    return getPersistence().removeByA3(a3);
539            }
540    
541            /**
542            * Removes all the countries where active = &#63; from the database.
543            *
544            * @param active the active
545            * @throws SystemException if a system exception occurred
546            */
547            public static void removeByActive(boolean active)
548                    throws com.liferay.portal.kernel.exception.SystemException {
549                    getPersistence().removeByActive(active);
550            }
551    
552            /**
553            * Removes all the countries from the database.
554            *
555            * @throws SystemException if a system exception occurred
556            */
557            public static void removeAll()
558                    throws com.liferay.portal.kernel.exception.SystemException {
559                    getPersistence().removeAll();
560            }
561    
562            /**
563            * Returns the number of countries where name = &#63;.
564            *
565            * @param name the name
566            * @return the number of matching countries
567            * @throws SystemException if a system exception occurred
568            */
569            public static int countByName(java.lang.String name)
570                    throws com.liferay.portal.kernel.exception.SystemException {
571                    return getPersistence().countByName(name);
572            }
573    
574            /**
575            * Returns the number of countries where a2 = &#63;.
576            *
577            * @param a2 the a2
578            * @return the number of matching countries
579            * @throws SystemException if a system exception occurred
580            */
581            public static int countByA2(java.lang.String a2)
582                    throws com.liferay.portal.kernel.exception.SystemException {
583                    return getPersistence().countByA2(a2);
584            }
585    
586            /**
587            * Returns the number of countries where a3 = &#63;.
588            *
589            * @param a3 the a3
590            * @return the number of matching countries
591            * @throws SystemException if a system exception occurred
592            */
593            public static int countByA3(java.lang.String a3)
594                    throws com.liferay.portal.kernel.exception.SystemException {
595                    return getPersistence().countByA3(a3);
596            }
597    
598            /**
599            * Returns the number of countries where active = &#63;.
600            *
601            * @param active the active
602            * @return the number of matching countries
603            * @throws SystemException if a system exception occurred
604            */
605            public static int countByActive(boolean active)
606                    throws com.liferay.portal.kernel.exception.SystemException {
607                    return getPersistence().countByActive(active);
608            }
609    
610            /**
611            * Returns the number of countries.
612            *
613            * @return the number of countries
614            * @throws SystemException if a system exception occurred
615            */
616            public static int countAll()
617                    throws com.liferay.portal.kernel.exception.SystemException {
618                    return getPersistence().countAll();
619            }
620    
621            public static CountryPersistence getPersistence() {
622                    if (_persistence == null) {
623                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
624    
625                            ReferenceRegistry.registerReference(CountryUtil.class,
626                                    "_persistence");
627                    }
628    
629                    return _persistence;
630            }
631    
632            /**
633             * @deprecated
634             */
635            public void setPersistence(CountryPersistence persistence) {
636            }
637    
638            private static CountryPersistence _persistence;
639    }