001    /**
002     * Copyright (c) 2000-2013 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            * @param active the active
371            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
372            * @return the first matching country
373            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
374            * @throws SystemException if a system exception occurred
375            */
376            public static com.liferay.portal.model.Country findByActive_First(
377                    boolean active,
378                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
379                    throws com.liferay.portal.NoSuchCountryException,
380                            com.liferay.portal.kernel.exception.SystemException {
381                    return getPersistence().findByActive_First(active, orderByComparator);
382            }
383    
384            /**
385            * Returns the first country in the ordered set where active = &#63;.
386            *
387            * @param active the active
388            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
389            * @return the first matching country, or <code>null</code> if a matching country could not be found
390            * @throws SystemException if a system exception occurred
391            */
392            public static com.liferay.portal.model.Country fetchByActive_First(
393                    boolean active,
394                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
395                    throws com.liferay.portal.kernel.exception.SystemException {
396                    return getPersistence().fetchByActive_First(active, orderByComparator);
397            }
398    
399            /**
400            * Returns the last country in the ordered set where active = &#63;.
401            *
402            * @param active the active
403            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
404            * @return the last matching country
405            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
406            * @throws SystemException if a system exception occurred
407            */
408            public static com.liferay.portal.model.Country findByActive_Last(
409                    boolean active,
410                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
411                    throws com.liferay.portal.NoSuchCountryException,
412                            com.liferay.portal.kernel.exception.SystemException {
413                    return getPersistence().findByActive_Last(active, orderByComparator);
414            }
415    
416            /**
417            * Returns the last country in the ordered set where active = &#63;.
418            *
419            * @param active the active
420            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
421            * @return the last matching country, or <code>null</code> if a matching country could not be found
422            * @throws SystemException if a system exception occurred
423            */
424            public static com.liferay.portal.model.Country fetchByActive_Last(
425                    boolean active,
426                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
427                    throws com.liferay.portal.kernel.exception.SystemException {
428                    return getPersistence().fetchByActive_Last(active, orderByComparator);
429            }
430    
431            /**
432            * Returns the countries before and after the current country in the ordered set where active = &#63;.
433            *
434            * @param countryId the primary key of the current country
435            * @param active the active
436            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
437            * @return the previous, current, and next country
438            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
439            * @throws SystemException if a system exception occurred
440            */
441            public static com.liferay.portal.model.Country[] findByActive_PrevAndNext(
442                    long countryId, boolean active,
443                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
444                    throws com.liferay.portal.NoSuchCountryException,
445                            com.liferay.portal.kernel.exception.SystemException {
446                    return getPersistence()
447                                       .findByActive_PrevAndNext(countryId, active,
448                            orderByComparator);
449            }
450    
451            /**
452            * Returns all the countries.
453            *
454            * @return the countries
455            * @throws SystemException if a system exception occurred
456            */
457            public static java.util.List<com.liferay.portal.model.Country> findAll()
458                    throws com.liferay.portal.kernel.exception.SystemException {
459                    return getPersistence().findAll();
460            }
461    
462            /**
463            * Returns a 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            * @return the range of countries
472            * @throws SystemException if a system exception occurred
473            */
474            public static java.util.List<com.liferay.portal.model.Country> findAll(
475                    int start, int end)
476                    throws com.liferay.portal.kernel.exception.SystemException {
477                    return getPersistence().findAll(start, end);
478            }
479    
480            /**
481            * Returns an ordered range of all the countries.
482            *
483            * <p>
484            * 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.
485            * </p>
486            *
487            * @param start the lower bound of the range of countries
488            * @param end the upper bound of the range of countries (not inclusive)
489            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
490            * @return the ordered range of countries
491            * @throws SystemException if a system exception occurred
492            */
493            public static java.util.List<com.liferay.portal.model.Country> findAll(
494                    int start, int end,
495                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
496                    throws com.liferay.portal.kernel.exception.SystemException {
497                    return getPersistence().findAll(start, end, orderByComparator);
498            }
499    
500            /**
501            * Removes the country where name = &#63; from the database.
502            *
503            * @param name the name
504            * @return the country that was removed
505            * @throws SystemException if a system exception occurred
506            */
507            public static com.liferay.portal.model.Country removeByName(
508                    java.lang.String name)
509                    throws com.liferay.portal.NoSuchCountryException,
510                            com.liferay.portal.kernel.exception.SystemException {
511                    return getPersistence().removeByName(name);
512            }
513    
514            /**
515            * Removes the country where a2 = &#63; from the database.
516            *
517            * @param a2 the a2
518            * @return the country that was removed
519            * @throws SystemException if a system exception occurred
520            */
521            public static com.liferay.portal.model.Country removeByA2(
522                    java.lang.String a2)
523                    throws com.liferay.portal.NoSuchCountryException,
524                            com.liferay.portal.kernel.exception.SystemException {
525                    return getPersistence().removeByA2(a2);
526            }
527    
528            /**
529            * Removes the country where a3 = &#63; from the database.
530            *
531            * @param a3 the a3
532            * @return the country that was removed
533            * @throws SystemException if a system exception occurred
534            */
535            public static com.liferay.portal.model.Country removeByA3(
536                    java.lang.String a3)
537                    throws com.liferay.portal.NoSuchCountryException,
538                            com.liferay.portal.kernel.exception.SystemException {
539                    return getPersistence().removeByA3(a3);
540            }
541    
542            /**
543            * Removes all the countries where active = &#63; from the database.
544            *
545            * @param active the active
546            * @throws SystemException if a system exception occurred
547            */
548            public static void removeByActive(boolean active)
549                    throws com.liferay.portal.kernel.exception.SystemException {
550                    getPersistence().removeByActive(active);
551            }
552    
553            /**
554            * Removes all the countries from the database.
555            *
556            * @throws SystemException if a system exception occurred
557            */
558            public static void removeAll()
559                    throws com.liferay.portal.kernel.exception.SystemException {
560                    getPersistence().removeAll();
561            }
562    
563            /**
564            * Returns the number of countries where name = &#63;.
565            *
566            * @param name the name
567            * @return the number of matching countries
568            * @throws SystemException if a system exception occurred
569            */
570            public static int countByName(java.lang.String name)
571                    throws com.liferay.portal.kernel.exception.SystemException {
572                    return getPersistence().countByName(name);
573            }
574    
575            /**
576            * Returns the number of countries where a2 = &#63;.
577            *
578            * @param a2 the a2
579            * @return the number of matching countries
580            * @throws SystemException if a system exception occurred
581            */
582            public static int countByA2(java.lang.String a2)
583                    throws com.liferay.portal.kernel.exception.SystemException {
584                    return getPersistence().countByA2(a2);
585            }
586    
587            /**
588            * Returns the number of countries where a3 = &#63;.
589            *
590            * @param a3 the a3
591            * @return the number of matching countries
592            * @throws SystemException if a system exception occurred
593            */
594            public static int countByA3(java.lang.String a3)
595                    throws com.liferay.portal.kernel.exception.SystemException {
596                    return getPersistence().countByA3(a3);
597            }
598    
599            /**
600            * Returns the number of countries where active = &#63;.
601            *
602            * @param active the active
603            * @return the number of matching countries
604            * @throws SystemException if a system exception occurred
605            */
606            public static int countByActive(boolean active)
607                    throws com.liferay.portal.kernel.exception.SystemException {
608                    return getPersistence().countByActive(active);
609            }
610    
611            /**
612            * Returns the number of countries.
613            *
614            * @return the number of countries
615            * @throws SystemException if a system exception occurred
616            */
617            public static int countAll()
618                    throws com.liferay.portal.kernel.exception.SystemException {
619                    return getPersistence().countAll();
620            }
621    
622            public static CountryPersistence getPersistence() {
623                    if (_persistence == null) {
624                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
625    
626                            ReferenceRegistry.registerReference(CountryUtil.class,
627                                    "_persistence");
628                    }
629    
630                    return _persistence;
631            }
632    
633            /**
634             * @deprecated
635             */
636            public void setPersistence(CountryPersistence persistence) {
637            }
638    
639            private static CountryPersistence _persistence;
640    }