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.exception.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 retrieve from 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.exception.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.exception.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 retrieve from 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.exception.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.exception.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 retrieve from 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.exception.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 an ordered range of all the countries where active = &#63;.
321            *
322            * <p>
323            * 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.
324            * </p>
325            *
326            * @param active the active
327            * @param start the lower bound of the range of countries
328            * @param end the upper bound of the range of countries (not inclusive)
329            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
330            * @param retrieveFromCache whether to retrieve from the finder cache
331            * @return the ordered range of matching countries
332            */
333            public static List<Country> findByActive(boolean active, int start,
334                    int end, OrderByComparator<Country> orderByComparator,
335                    boolean retrieveFromCache) {
336                    return getPersistence()
337                                       .findByActive(active, start, end, orderByComparator,
338                            retrieveFromCache);
339            }
340    
341            /**
342            * Returns the first country in the ordered set where active = &#63;.
343            *
344            * @param active the active
345            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
346            * @return the first matching country
347            * @throws NoSuchCountryException if a matching country could not be found
348            */
349            public static Country findByActive_First(boolean active,
350                    OrderByComparator<Country> orderByComparator)
351                    throws com.liferay.portal.exception.NoSuchCountryException {
352                    return getPersistence().findByActive_First(active, orderByComparator);
353            }
354    
355            /**
356            * Returns the first country in the ordered set where active = &#63;.
357            *
358            * @param active the active
359            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
360            * @return the first matching country, or <code>null</code> if a matching country could not be found
361            */
362            public static Country fetchByActive_First(boolean active,
363                    OrderByComparator<Country> orderByComparator) {
364                    return getPersistence().fetchByActive_First(active, orderByComparator);
365            }
366    
367            /**
368            * Returns the last 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 last matching country
373            * @throws NoSuchCountryException if a matching country could not be found
374            */
375            public static Country findByActive_Last(boolean active,
376                    OrderByComparator<Country> orderByComparator)
377                    throws com.liferay.portal.exception.NoSuchCountryException {
378                    return getPersistence().findByActive_Last(active, orderByComparator);
379            }
380    
381            /**
382            * Returns the last country in the ordered set where active = &#63;.
383            *
384            * @param active the active
385            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
386            * @return the last matching country, or <code>null</code> if a matching country could not be found
387            */
388            public static Country fetchByActive_Last(boolean active,
389                    OrderByComparator<Country> orderByComparator) {
390                    return getPersistence().fetchByActive_Last(active, orderByComparator);
391            }
392    
393            /**
394            * Returns the countries before and after the current country in the ordered set where active = &#63;.
395            *
396            * @param countryId the primary key of the current country
397            * @param active the active
398            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
399            * @return the previous, current, and next country
400            * @throws NoSuchCountryException if a country with the primary key could not be found
401            */
402            public static Country[] findByActive_PrevAndNext(long countryId,
403                    boolean active, OrderByComparator<Country> orderByComparator)
404                    throws com.liferay.portal.exception.NoSuchCountryException {
405                    return getPersistence()
406                                       .findByActive_PrevAndNext(countryId, active,
407                            orderByComparator);
408            }
409    
410            /**
411            * Removes all the countries where active = &#63; from the database.
412            *
413            * @param active the active
414            */
415            public static void removeByActive(boolean active) {
416                    getPersistence().removeByActive(active);
417            }
418    
419            /**
420            * Returns the number of countries where active = &#63;.
421            *
422            * @param active the active
423            * @return the number of matching countries
424            */
425            public static int countByActive(boolean active) {
426                    return getPersistence().countByActive(active);
427            }
428    
429            /**
430            * Caches the country in the entity cache if it is enabled.
431            *
432            * @param country the country
433            */
434            public static void cacheResult(Country country) {
435                    getPersistence().cacheResult(country);
436            }
437    
438            /**
439            * Caches the countries in the entity cache if it is enabled.
440            *
441            * @param countries the countries
442            */
443            public static void cacheResult(List<Country> countries) {
444                    getPersistence().cacheResult(countries);
445            }
446    
447            /**
448            * Creates a new country with the primary key. Does not add the country to the database.
449            *
450            * @param countryId the primary key for the new country
451            * @return the new country
452            */
453            public static Country create(long countryId) {
454                    return getPersistence().create(countryId);
455            }
456    
457            /**
458            * Removes the country with the primary key from the database. Also notifies the appropriate model listeners.
459            *
460            * @param countryId the primary key of the country
461            * @return the country that was removed
462            * @throws NoSuchCountryException if a country with the primary key could not be found
463            */
464            public static Country remove(long countryId)
465                    throws com.liferay.portal.exception.NoSuchCountryException {
466                    return getPersistence().remove(countryId);
467            }
468    
469            public static Country updateImpl(Country country) {
470                    return getPersistence().updateImpl(country);
471            }
472    
473            /**
474            * Returns the country with the primary key or throws a {@link NoSuchCountryException} if it could not be found.
475            *
476            * @param countryId the primary key of the country
477            * @return the country
478            * @throws NoSuchCountryException if a country with the primary key could not be found
479            */
480            public static Country findByPrimaryKey(long countryId)
481                    throws com.liferay.portal.exception.NoSuchCountryException {
482                    return getPersistence().findByPrimaryKey(countryId);
483            }
484    
485            /**
486            * Returns the country with the primary key or returns <code>null</code> if it could not be found.
487            *
488            * @param countryId the primary key of the country
489            * @return the country, or <code>null</code> if a country with the primary key could not be found
490            */
491            public static Country fetchByPrimaryKey(long countryId) {
492                    return getPersistence().fetchByPrimaryKey(countryId);
493            }
494    
495            public static java.util.Map<java.io.Serializable, Country> fetchByPrimaryKeys(
496                    java.util.Set<java.io.Serializable> primaryKeys) {
497                    return getPersistence().fetchByPrimaryKeys(primaryKeys);
498            }
499    
500            /**
501            * Returns all the countries.
502            *
503            * @return the countries
504            */
505            public static List<Country> findAll() {
506                    return getPersistence().findAll();
507            }
508    
509            /**
510            * Returns a range of all the countries.
511            *
512            * <p>
513            * 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.
514            * </p>
515            *
516            * @param start the lower bound of the range of countries
517            * @param end the upper bound of the range of countries (not inclusive)
518            * @return the range of countries
519            */
520            public static List<Country> findAll(int start, int end) {
521                    return getPersistence().findAll(start, end);
522            }
523    
524            /**
525            * Returns an ordered range of all the countries.
526            *
527            * <p>
528            * 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.
529            * </p>
530            *
531            * @param start the lower bound of the range of countries
532            * @param end the upper bound of the range of countries (not inclusive)
533            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
534            * @return the ordered range of countries
535            */
536            public static List<Country> findAll(int start, int end,
537                    OrderByComparator<Country> orderByComparator) {
538                    return getPersistence().findAll(start, end, orderByComparator);
539            }
540    
541            /**
542            * Returns an ordered range of all the countries.
543            *
544            * <p>
545            * 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.
546            * </p>
547            *
548            * @param start the lower bound of the range of countries
549            * @param end the upper bound of the range of countries (not inclusive)
550            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
551            * @param retrieveFromCache whether to retrieve from the finder cache
552            * @return the ordered range of countries
553            */
554            public static List<Country> findAll(int start, int end,
555                    OrderByComparator<Country> orderByComparator, boolean retrieveFromCache) {
556                    return getPersistence()
557                                       .findAll(start, end, orderByComparator, retrieveFromCache);
558            }
559    
560            /**
561            * Removes all the countries from the database.
562            */
563            public static void removeAll() {
564                    getPersistence().removeAll();
565            }
566    
567            /**
568            * Returns the number of countries.
569            *
570            * @return the number of countries
571            */
572            public static int countAll() {
573                    return getPersistence().countAll();
574            }
575    
576            public static java.util.Set<java.lang.String> getBadColumnNames() {
577                    return getPersistence().getBadColumnNames();
578            }
579    
580            public static CountryPersistence getPersistence() {
581                    if (_persistence == null) {
582                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
583    
584                            ReferenceRegistry.registerReference(CountryUtil.class,
585                                    "_persistence");
586                    }
587    
588                    return _persistence;
589            }
590    
591            private static CountryPersistence _persistence;
592    }