001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.util.OrderByComparator;
022    import com.liferay.portal.kernel.util.ReferenceRegistry;
023    import com.liferay.portal.model.Country;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.util.List;
027    
028    /**
029     * The persistence utility for the country service. This utility wraps {@link com.liferay.portal.service.persistence.impl.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.
030     *
031     * <p>
032     * Caching information and settings can be found in <code>portal.properties</code>
033     * </p>
034     *
035     * @author Brian Wing Shun Chan
036     * @see CountryPersistence
037     * @see com.liferay.portal.service.persistence.impl.CountryPersistenceImpl
038     * @generated
039     */
040    @ProviderType
041    public class CountryUtil {
042            /*
043             * NOTE FOR DEVELOPERS:
044             *
045             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
046             */
047    
048            /**
049             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
050             */
051            public static void clearCache() {
052                    getPersistence().clearCache();
053            }
054    
055            /**
056             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
057             */
058            public static void clearCache(Country country) {
059                    getPersistence().clearCache(country);
060            }
061    
062            /**
063             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
064             */
065            public static long countWithDynamicQuery(DynamicQuery dynamicQuery) {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<Country> findWithDynamicQuery(DynamicQuery dynamicQuery) {
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                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
082            }
083    
084            /**
085             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
086             */
087            public static List<Country> findWithDynamicQuery(
088                    DynamicQuery dynamicQuery, int start, int end,
089                    OrderByComparator<Country> orderByComparator) {
090                    return getPersistence()
091                                       .findWithDynamicQuery(dynamicQuery, start, end,
092                            orderByComparator);
093            }
094    
095            /**
096             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel)
097             */
098            public static Country update(Country country) {
099                    return getPersistence().update(country);
100            }
101    
102            /**
103             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
104             */
105            public static Country update(Country country, ServiceContext serviceContext) {
106                    return getPersistence().update(country, serviceContext);
107            }
108    
109            /**
110            * Returns the country where name = &#63; or throws a {@link NoSuchCountryException} if it could not be found.
111            *
112            * @param name the name
113            * @return the matching country
114            * @throws NoSuchCountryException if a matching country could not be found
115            */
116            public static Country findByName(java.lang.String name)
117                    throws com.liferay.portal.NoSuchCountryException {
118                    return getPersistence().findByName(name);
119            }
120    
121            /**
122            * Returns the country where name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
123            *
124            * @param name the name
125            * @return the matching country, or <code>null</code> if a matching country could not be found
126            */
127            public static Country fetchByName(java.lang.String name) {
128                    return getPersistence().fetchByName(name);
129            }
130    
131            /**
132            * Returns the country where name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
133            *
134            * @param name the name
135            * @param retrieveFromCache whether to use the finder cache
136            * @return the matching country, or <code>null</code> if a matching country could not be found
137            */
138            public static Country fetchByName(java.lang.String name,
139                    boolean retrieveFromCache) {
140                    return getPersistence().fetchByName(name, retrieveFromCache);
141            }
142    
143            /**
144            * Removes the country where name = &#63; from the database.
145            *
146            * @param name the name
147            * @return the country that was removed
148            */
149            public static Country removeByName(java.lang.String name)
150                    throws com.liferay.portal.NoSuchCountryException {
151                    return getPersistence().removeByName(name);
152            }
153    
154            /**
155            * Returns the number of countries where name = &#63;.
156            *
157            * @param name the name
158            * @return the number of matching countries
159            */
160            public static int countByName(java.lang.String name) {
161                    return getPersistence().countByName(name);
162            }
163    
164            /**
165            * Returns the country where a2 = &#63; or throws a {@link NoSuchCountryException} if it could not be found.
166            *
167            * @param a2 the a2
168            * @return the matching country
169            * @throws NoSuchCountryException if a matching country could not be found
170            */
171            public static Country findByA2(java.lang.String a2)
172                    throws com.liferay.portal.NoSuchCountryException {
173                    return getPersistence().findByA2(a2);
174            }
175    
176            /**
177            * Returns the country where a2 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
178            *
179            * @param a2 the a2
180            * @return the matching country, or <code>null</code> if a matching country could not be found
181            */
182            public static Country fetchByA2(java.lang.String a2) {
183                    return getPersistence().fetchByA2(a2);
184            }
185    
186            /**
187            * Returns the country where a2 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
188            *
189            * @param a2 the a2
190            * @param retrieveFromCache whether to use the finder cache
191            * @return the matching country, or <code>null</code> if a matching country could not be found
192            */
193            public static Country fetchByA2(java.lang.String a2,
194                    boolean retrieveFromCache) {
195                    return getPersistence().fetchByA2(a2, retrieveFromCache);
196            }
197    
198            /**
199            * Removes the country where a2 = &#63; from the database.
200            *
201            * @param a2 the a2
202            * @return the country that was removed
203            */
204            public static Country removeByA2(java.lang.String a2)
205                    throws com.liferay.portal.NoSuchCountryException {
206                    return getPersistence().removeByA2(a2);
207            }
208    
209            /**
210            * Returns the number of countries where a2 = &#63;.
211            *
212            * @param a2 the a2
213            * @return the number of matching countries
214            */
215            public static int countByA2(java.lang.String a2) {
216                    return getPersistence().countByA2(a2);
217            }
218    
219            /**
220            * Returns the country where a3 = &#63; or throws a {@link NoSuchCountryException} if it could not be found.
221            *
222            * @param a3 the a3
223            * @return the matching country
224            * @throws NoSuchCountryException if a matching country could not be found
225            */
226            public static Country findByA3(java.lang.String a3)
227                    throws com.liferay.portal.NoSuchCountryException {
228                    return getPersistence().findByA3(a3);
229            }
230    
231            /**
232            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
233            *
234            * @param a3 the a3
235            * @return the matching country, or <code>null</code> if a matching country could not be found
236            */
237            public static Country fetchByA3(java.lang.String a3) {
238                    return getPersistence().fetchByA3(a3);
239            }
240    
241            /**
242            * Returns the country where a3 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
243            *
244            * @param a3 the a3
245            * @param retrieveFromCache whether to use the finder cache
246            * @return the matching country, or <code>null</code> if a matching country could not be found
247            */
248            public static Country fetchByA3(java.lang.String a3,
249                    boolean retrieveFromCache) {
250                    return getPersistence().fetchByA3(a3, retrieveFromCache);
251            }
252    
253            /**
254            * Removes the country where a3 = &#63; from the database.
255            *
256            * @param a3 the a3
257            * @return the country that was removed
258            */
259            public static Country removeByA3(java.lang.String a3)
260                    throws com.liferay.portal.NoSuchCountryException {
261                    return getPersistence().removeByA3(a3);
262            }
263    
264            /**
265            * Returns the number of countries where a3 = &#63;.
266            *
267            * @param a3 the a3
268            * @return the number of matching countries
269            */
270            public static int countByA3(java.lang.String a3) {
271                    return getPersistence().countByA3(a3);
272            }
273    
274            /**
275            * Returns all the countries where active = &#63;.
276            *
277            * @param active the active
278            * @return the matching countries
279            */
280            public static List<Country> findByActive(boolean active) {
281                    return getPersistence().findByActive(active);
282            }
283    
284            /**
285            * Returns a range of all the countries where active = &#63;.
286            *
287            * <p>
288            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
289            * </p>
290            *
291            * @param active the active
292            * @param start the lower bound of the range of countries
293            * @param end the upper bound of the range of countries (not inclusive)
294            * @return the range of matching countries
295            */
296            public static List<Country> findByActive(boolean active, int start, int end) {
297                    return getPersistence().findByActive(active, start, end);
298            }
299    
300            /**
301            * Returns an ordered range of all the countries where active = &#63;.
302            *
303            * <p>
304            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
305            * </p>
306            *
307            * @param active the active
308            * @param start the lower bound of the range of countries
309            * @param end the upper bound of the range of countries (not inclusive)
310            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
311            * @return the ordered range of matching countries
312            */
313            public static List<Country> findByActive(boolean active, int start,
314                    int end, OrderByComparator<Country> orderByComparator) {
315                    return getPersistence()
316                                       .findByActive(active, start, end, orderByComparator);
317            }
318    
319            /**
320            * Returns the first country in the ordered set where active = &#63;.
321            *
322            * @param active the active
323            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
324            * @return the first matching country
325            * @throws NoSuchCountryException if a matching country could not be found
326            */
327            public static Country findByActive_First(boolean active,
328                    OrderByComparator<Country> orderByComparator)
329                    throws com.liferay.portal.NoSuchCountryException {
330                    return getPersistence().findByActive_First(active, orderByComparator);
331            }
332    
333            /**
334            * Returns the first country in the ordered set where active = &#63;.
335            *
336            * @param active the active
337            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
338            * @return the first matching country, or <code>null</code> if a matching country could not be found
339            */
340            public static Country fetchByActive_First(boolean active,
341                    OrderByComparator<Country> orderByComparator) {
342                    return getPersistence().fetchByActive_First(active, orderByComparator);
343            }
344    
345            /**
346            * Returns the last country in the ordered set where active = &#63;.
347            *
348            * @param active the active
349            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
350            * @return the last matching country
351            * @throws NoSuchCountryException if a matching country could not be found
352            */
353            public static Country findByActive_Last(boolean active,
354                    OrderByComparator<Country> orderByComparator)
355                    throws com.liferay.portal.NoSuchCountryException {
356                    return getPersistence().findByActive_Last(active, orderByComparator);
357            }
358    
359            /**
360            * Returns the last country in the ordered set where active = &#63;.
361            *
362            * @param active the active
363            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
364            * @return the last matching country, or <code>null</code> if a matching country could not be found
365            */
366            public static Country fetchByActive_Last(boolean active,
367                    OrderByComparator<Country> orderByComparator) {
368                    return getPersistence().fetchByActive_Last(active, orderByComparator);
369            }
370    
371            /**
372            * Returns the countries before and after the current country in the ordered set where active = &#63;.
373            *
374            * @param countryId the primary key of the current country
375            * @param active the active
376            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
377            * @return the previous, current, and next country
378            * @throws NoSuchCountryException if a country with the primary key could not be found
379            */
380            public static Country[] findByActive_PrevAndNext(long countryId,
381                    boolean active, OrderByComparator<Country> orderByComparator)
382                    throws com.liferay.portal.NoSuchCountryException {
383                    return getPersistence()
384                                       .findByActive_PrevAndNext(countryId, active,
385                            orderByComparator);
386            }
387    
388            /**
389            * Removes all the countries where active = &#63; from the database.
390            *
391            * @param active the active
392            */
393            public static void removeByActive(boolean active) {
394                    getPersistence().removeByActive(active);
395            }
396    
397            /**
398            * Returns the number of countries where active = &#63;.
399            *
400            * @param active the active
401            * @return the number of matching countries
402            */
403            public static int countByActive(boolean active) {
404                    return getPersistence().countByActive(active);
405            }
406    
407            /**
408            * Caches the country in the entity cache if it is enabled.
409            *
410            * @param country the country
411            */
412            public static void cacheResult(Country country) {
413                    getPersistence().cacheResult(country);
414            }
415    
416            /**
417            * Caches the countries in the entity cache if it is enabled.
418            *
419            * @param countries the countries
420            */
421            public static void cacheResult(List<Country> countries) {
422                    getPersistence().cacheResult(countries);
423            }
424    
425            /**
426            * Creates a new country with the primary key. Does not add the country to the database.
427            *
428            * @param countryId the primary key for the new country
429            * @return the new country
430            */
431            public static Country create(long countryId) {
432                    return getPersistence().create(countryId);
433            }
434    
435            /**
436            * Removes the country with the primary key from the database. Also notifies the appropriate model listeners.
437            *
438            * @param countryId the primary key of the country
439            * @return the country that was removed
440            * @throws NoSuchCountryException if a country with the primary key could not be found
441            */
442            public static Country remove(long countryId)
443                    throws com.liferay.portal.NoSuchCountryException {
444                    return getPersistence().remove(countryId);
445            }
446    
447            public static Country updateImpl(Country country) {
448                    return getPersistence().updateImpl(country);
449            }
450    
451            /**
452            * Returns the country with the primary key or throws a {@link NoSuchCountryException} if it could not be found.
453            *
454            * @param countryId the primary key of the country
455            * @return the country
456            * @throws NoSuchCountryException if a country with the primary key could not be found
457            */
458            public static Country findByPrimaryKey(long countryId)
459                    throws com.liferay.portal.NoSuchCountryException {
460                    return getPersistence().findByPrimaryKey(countryId);
461            }
462    
463            /**
464            * Returns the country with the primary key or returns <code>null</code> if it could not be found.
465            *
466            * @param countryId the primary key of the country
467            * @return the country, or <code>null</code> if a country with the primary key could not be found
468            */
469            public static Country fetchByPrimaryKey(long countryId) {
470                    return getPersistence().fetchByPrimaryKey(countryId);
471            }
472    
473            public static java.util.Map<java.io.Serializable, Country> fetchByPrimaryKeys(
474                    java.util.Set<java.io.Serializable> primaryKeys) {
475                    return getPersistence().fetchByPrimaryKeys(primaryKeys);
476            }
477    
478            /**
479            * Returns all the countries.
480            *
481            * @return the countries
482            */
483            public static List<Country> findAll() {
484                    return getPersistence().findAll();
485            }
486    
487            /**
488            * Returns a range of all the countries.
489            *
490            * <p>
491            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
492            * </p>
493            *
494            * @param start the lower bound of the range of countries
495            * @param end the upper bound of the range of countries (not inclusive)
496            * @return the range of countries
497            */
498            public static List<Country> findAll(int start, int end) {
499                    return getPersistence().findAll(start, end);
500            }
501    
502            /**
503            * Returns an ordered range of all the countries.
504            *
505            * <p>
506            * 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 QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
507            * </p>
508            *
509            * @param start the lower bound of the range of countries
510            * @param end the upper bound of the range of countries (not inclusive)
511            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
512            * @return the ordered range of countries
513            */
514            public static List<Country> findAll(int start, int end,
515                    OrderByComparator<Country> orderByComparator) {
516                    return getPersistence().findAll(start, end, orderByComparator);
517            }
518    
519            /**
520            * Removes all the countries from the database.
521            */
522            public static void removeAll() {
523                    getPersistence().removeAll();
524            }
525    
526            /**
527            * Returns the number of countries.
528            *
529            * @return the number of countries
530            */
531            public static int countAll() {
532                    return getPersistence().countAll();
533            }
534    
535            public static CountryPersistence getPersistence() {
536                    if (_persistence == null) {
537                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
538    
539                            ReferenceRegistry.registerReference(CountryUtil.class,
540                                    "_persistence");
541                    }
542    
543                    return _persistence;
544            }
545    
546            /**
547             * @deprecated As of 6.2.0
548             */
549            @Deprecated
550            public void setPersistence(CountryPersistence persistence) {
551            }
552    
553            private static CountryPersistence _persistence;
554    }