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, 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
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
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. Does not add the country to the database.
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
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            * Returns 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
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            * Returns 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
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            * Returns 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
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            * Returns 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
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            * Returns 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
221            * @param retrieveFromCache whether to use the finder cache
222            * @return the matching country, or <code>null</code> if a matching country could not be found
223            * @throws SystemException if a system exception occurred
224            */
225            public static com.liferay.portal.model.Country fetchByName(
226                    java.lang.String name, boolean retrieveFromCache)
227                    throws com.liferay.portal.kernel.exception.SystemException {
228                    return getPersistence().fetchByName(name, retrieveFromCache);
229            }
230    
231            /**
232            * Returns the country where a2 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
233            *
234            * @param a2 the a2
235            * @return the matching country
236            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
237            * @throws SystemException if a system exception occurred
238            */
239            public static com.liferay.portal.model.Country findByA2(java.lang.String a2)
240                    throws com.liferay.portal.NoSuchCountryException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    return getPersistence().findByA2(a2);
243            }
244    
245            /**
246            * Returns the country where a2 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
247            *
248            * @param a2 the a2
249            * @return the matching country, or <code>null</code> if a matching country could not be found
250            * @throws SystemException if a system exception occurred
251            */
252            public static com.liferay.portal.model.Country fetchByA2(
253                    java.lang.String a2)
254                    throws com.liferay.portal.kernel.exception.SystemException {
255                    return getPersistence().fetchByA2(a2);
256            }
257    
258            /**
259            * Returns the country where a2 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
260            *
261            * @param a2 the a2
262            * @param retrieveFromCache whether to use the finder cache
263            * @return the matching country, or <code>null</code> if a matching country could not be found
264            * @throws SystemException if a system exception occurred
265            */
266            public static com.liferay.portal.model.Country fetchByA2(
267                    java.lang.String a2, boolean retrieveFromCache)
268                    throws com.liferay.portal.kernel.exception.SystemException {
269                    return getPersistence().fetchByA2(a2, retrieveFromCache);
270            }
271    
272            /**
273            * Returns the country where a3 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
274            *
275            * @param a3 the a3
276            * @return the matching country
277            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
278            * @throws SystemException if a system exception occurred
279            */
280            public static com.liferay.portal.model.Country findByA3(java.lang.String a3)
281                    throws com.liferay.portal.NoSuchCountryException,
282                            com.liferay.portal.kernel.exception.SystemException {
283                    return getPersistence().findByA3(a3);
284            }
285    
286            /**
287            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
288            *
289            * @param a3 the a3
290            * @return the matching country, or <code>null</code> if a matching country could not be found
291            * @throws SystemException if a system exception occurred
292            */
293            public static com.liferay.portal.model.Country fetchByA3(
294                    java.lang.String a3)
295                    throws com.liferay.portal.kernel.exception.SystemException {
296                    return getPersistence().fetchByA3(a3);
297            }
298    
299            /**
300            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
301            *
302            * @param a3 the a3
303            * @param retrieveFromCache whether to use the finder cache
304            * @return the matching country, or <code>null</code> if a matching country could not be found
305            * @throws SystemException if a system exception occurred
306            */
307            public static com.liferay.portal.model.Country fetchByA3(
308                    java.lang.String a3, boolean retrieveFromCache)
309                    throws com.liferay.portal.kernel.exception.SystemException {
310                    return getPersistence().fetchByA3(a3, retrieveFromCache);
311            }
312    
313            /**
314            * Returns all the countries where active = &#63;.
315            *
316            * @param active the active
317            * @return the matching countries
318            * @throws SystemException if a system exception occurred
319            */
320            public static java.util.List<com.liferay.portal.model.Country> findByActive(
321                    boolean active)
322                    throws com.liferay.portal.kernel.exception.SystemException {
323                    return getPersistence().findByActive(active);
324            }
325    
326            /**
327            * Returns a range of all the countries where active = &#63;.
328            *
329            * <p>
330            * 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.
331            * </p>
332            *
333            * @param active the active
334            * @param start the lower bound of the range of countries
335            * @param end the upper bound of the range of countries (not inclusive)
336            * @return the range of matching countries
337            * @throws SystemException if a system exception occurred
338            */
339            public static java.util.List<com.liferay.portal.model.Country> findByActive(
340                    boolean active, int start, int end)
341                    throws com.liferay.portal.kernel.exception.SystemException {
342                    return getPersistence().findByActive(active, start, end);
343            }
344    
345            /**
346            * Returns an ordered range of all the countries where active = &#63;.
347            *
348            * <p>
349            * 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.
350            * </p>
351            *
352            * @param active the active
353            * @param start the lower bound of the range of countries
354            * @param end the upper bound of the range of countries (not inclusive)
355            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
356            * @return the ordered range of matching countries
357            * @throws SystemException if a system exception occurred
358            */
359            public static java.util.List<com.liferay.portal.model.Country> findByActive(
360                    boolean active, int start, int end,
361                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
362                    throws com.liferay.portal.kernel.exception.SystemException {
363                    return getPersistence()
364                                       .findByActive(active, start, end, orderByComparator);
365            }
366    
367            /**
368            * Returns the first country in the ordered set where active = &#63;.
369            *
370            * <p>
371            * 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.
372            * </p>
373            *
374            * @param active the active
375            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
376            * @return the first matching country
377            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
378            * @throws SystemException if a system exception occurred
379            */
380            public static com.liferay.portal.model.Country findByActive_First(
381                    boolean active,
382                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
383                    throws com.liferay.portal.NoSuchCountryException,
384                            com.liferay.portal.kernel.exception.SystemException {
385                    return getPersistence().findByActive_First(active, orderByComparator);
386            }
387    
388            /**
389            * Returns the last country in the ordered set where active = &#63;.
390            *
391            * <p>
392            * 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.
393            * </p>
394            *
395            * @param active the active
396            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
397            * @return the last matching country
398            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
399            * @throws SystemException if a system exception occurred
400            */
401            public static com.liferay.portal.model.Country findByActive_Last(
402                    boolean active,
403                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
404                    throws com.liferay.portal.NoSuchCountryException,
405                            com.liferay.portal.kernel.exception.SystemException {
406                    return getPersistence().findByActive_Last(active, orderByComparator);
407            }
408    
409            /**
410            * Returns the countries before and after the current country in the ordered set where active = &#63;.
411            *
412            * <p>
413            * 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.
414            * </p>
415            *
416            * @param countryId the primary key of the current country
417            * @param active the active
418            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
419            * @return the previous, current, and next country
420            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
421            * @throws SystemException if a system exception occurred
422            */
423            public static com.liferay.portal.model.Country[] findByActive_PrevAndNext(
424                    long countryId, boolean active,
425                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
426                    throws com.liferay.portal.NoSuchCountryException,
427                            com.liferay.portal.kernel.exception.SystemException {
428                    return getPersistence()
429                                       .findByActive_PrevAndNext(countryId, active,
430                            orderByComparator);
431            }
432    
433            /**
434            * Returns all the countries.
435            *
436            * @return the countries
437            * @throws SystemException if a system exception occurred
438            */
439            public static java.util.List<com.liferay.portal.model.Country> findAll()
440                    throws com.liferay.portal.kernel.exception.SystemException {
441                    return getPersistence().findAll();
442            }
443    
444            /**
445            * Returns a range of all the countries.
446            *
447            * <p>
448            * 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.
449            * </p>
450            *
451            * @param start the lower bound of the range of countries
452            * @param end the upper bound of the range of countries (not inclusive)
453            * @return the range of countries
454            * @throws SystemException if a system exception occurred
455            */
456            public static java.util.List<com.liferay.portal.model.Country> findAll(
457                    int start, int end)
458                    throws com.liferay.portal.kernel.exception.SystemException {
459                    return getPersistence().findAll(start, end);
460            }
461    
462            /**
463            * Returns an ordered range of all the countries.
464            *
465            * <p>
466            * 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.
467            * </p>
468            *
469            * @param start the lower bound of the range of countries
470            * @param end the upper bound of the range of countries (not inclusive)
471            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
472            * @return the ordered range of countries
473            * @throws SystemException if a system exception occurred
474            */
475            public static java.util.List<com.liferay.portal.model.Country> findAll(
476                    int start, int end,
477                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
478                    throws com.liferay.portal.kernel.exception.SystemException {
479                    return getPersistence().findAll(start, end, orderByComparator);
480            }
481    
482            /**
483            * Removes the country where name = &#63; from the database.
484            *
485            * @param name the name
486            * @throws SystemException if a system exception occurred
487            */
488            public static void removeByName(java.lang.String name)
489                    throws com.liferay.portal.NoSuchCountryException,
490                            com.liferay.portal.kernel.exception.SystemException {
491                    getPersistence().removeByName(name);
492            }
493    
494            /**
495            * Removes the country where a2 = &#63; from the database.
496            *
497            * @param a2 the a2
498            * @throws SystemException if a system exception occurred
499            */
500            public static void removeByA2(java.lang.String a2)
501                    throws com.liferay.portal.NoSuchCountryException,
502                            com.liferay.portal.kernel.exception.SystemException {
503                    getPersistence().removeByA2(a2);
504            }
505    
506            /**
507            * Removes the country where a3 = &#63; from the database.
508            *
509            * @param a3 the a3
510            * @throws SystemException if a system exception occurred
511            */
512            public static void removeByA3(java.lang.String a3)
513                    throws com.liferay.portal.NoSuchCountryException,
514                            com.liferay.portal.kernel.exception.SystemException {
515                    getPersistence().removeByA3(a3);
516            }
517    
518            /**
519            * Removes all the countries where active = &#63; from the database.
520            *
521            * @param active the active
522            * @throws SystemException if a system exception occurred
523            */
524            public static void removeByActive(boolean active)
525                    throws com.liferay.portal.kernel.exception.SystemException {
526                    getPersistence().removeByActive(active);
527            }
528    
529            /**
530            * Removes all the countries from the database.
531            *
532            * @throws SystemException if a system exception occurred
533            */
534            public static void removeAll()
535                    throws com.liferay.portal.kernel.exception.SystemException {
536                    getPersistence().removeAll();
537            }
538    
539            /**
540            * Returns the number of countries where name = &#63;.
541            *
542            * @param name the name
543            * @return the number of matching countries
544            * @throws SystemException if a system exception occurred
545            */
546            public static int countByName(java.lang.String name)
547                    throws com.liferay.portal.kernel.exception.SystemException {
548                    return getPersistence().countByName(name);
549            }
550    
551            /**
552            * Returns the number of countries where a2 = &#63;.
553            *
554            * @param a2 the a2
555            * @return the number of matching countries
556            * @throws SystemException if a system exception occurred
557            */
558            public static int countByA2(java.lang.String a2)
559                    throws com.liferay.portal.kernel.exception.SystemException {
560                    return getPersistence().countByA2(a2);
561            }
562    
563            /**
564            * Returns the number of countries where a3 = &#63;.
565            *
566            * @param a3 the a3
567            * @return the number of matching countries
568            * @throws SystemException if a system exception occurred
569            */
570            public static int countByA3(java.lang.String a3)
571                    throws com.liferay.portal.kernel.exception.SystemException {
572                    return getPersistence().countByA3(a3);
573            }
574    
575            /**
576            * Returns the number of countries where active = &#63;.
577            *
578            * @param active the active
579            * @return the number of matching countries
580            * @throws SystemException if a system exception occurred
581            */
582            public static int countByActive(boolean active)
583                    throws com.liferay.portal.kernel.exception.SystemException {
584                    return getPersistence().countByActive(active);
585            }
586    
587            /**
588            * Returns the number of countries.
589            *
590            * @return the number of countries
591            * @throws SystemException if a system exception occurred
592            */
593            public static int countAll()
594                    throws com.liferay.portal.kernel.exception.SystemException {
595                    return getPersistence().countAll();
596            }
597    
598            public static CountryPersistence getPersistence() {
599                    if (_persistence == null) {
600                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
601    
602                            ReferenceRegistry.registerReference(CountryUtil.class,
603                                    "_persistence");
604                    }
605    
606                    return _persistence;
607            }
608    
609            public void setPersistence(CountryPersistence persistence) {
610                    _persistence = persistence;
611    
612                    ReferenceRegistry.registerReference(CountryUtil.class, "_persistence");
613            }
614    
615            private static CountryPersistence _persistence;
616    }