001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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#remove(com.liferay.portal.model.BaseModel)
098             */
099            public static Country remove(Country country) throws SystemException {
100                    return getPersistence().remove(country);
101            }
102    
103            /**
104             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
105             */
106            public static Country update(Country country, boolean merge)
107                    throws SystemException {
108                    return getPersistence().update(country, merge);
109            }
110    
111            /**
112             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
113             */
114            public static Country update(Country country, boolean merge,
115                    ServiceContext serviceContext) throws SystemException {
116                    return getPersistence().update(country, merge, serviceContext);
117            }
118    
119            /**
120            * Caches the country in the entity cache if it is enabled.
121            *
122            * @param country the country to cache
123            */
124            public static void cacheResult(com.liferay.portal.model.Country country) {
125                    getPersistence().cacheResult(country);
126            }
127    
128            /**
129            * Caches the countries in the entity cache if it is enabled.
130            *
131            * @param countries the countries to cache
132            */
133            public static void cacheResult(
134                    java.util.List<com.liferay.portal.model.Country> countries) {
135                    getPersistence().cacheResult(countries);
136            }
137    
138            /**
139            * Creates a new country with the primary key. Does not add the country to the database.
140            *
141            * @param countryId the primary key for the new country
142            * @return the new country
143            */
144            public static com.liferay.portal.model.Country create(long countryId) {
145                    return getPersistence().create(countryId);
146            }
147    
148            /**
149            * Removes the country with the primary key from the database. Also notifies the appropriate model listeners.
150            *
151            * @param countryId the primary key of the country to remove
152            * @return the country that was removed
153            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
154            * @throws SystemException if a system exception occurred
155            */
156            public static com.liferay.portal.model.Country remove(long countryId)
157                    throws com.liferay.portal.NoSuchCountryException,
158                            com.liferay.portal.kernel.exception.SystemException {
159                    return getPersistence().remove(countryId);
160            }
161    
162            public static com.liferay.portal.model.Country updateImpl(
163                    com.liferay.portal.model.Country country, boolean merge)
164                    throws com.liferay.portal.kernel.exception.SystemException {
165                    return getPersistence().updateImpl(country, merge);
166            }
167    
168            /**
169            * Finds the country with the primary key or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
170            *
171            * @param countryId the primary key of the country to find
172            * @return the country
173            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
174            * @throws SystemException if a system exception occurred
175            */
176            public static com.liferay.portal.model.Country findByPrimaryKey(
177                    long countryId)
178                    throws com.liferay.portal.NoSuchCountryException,
179                            com.liferay.portal.kernel.exception.SystemException {
180                    return getPersistence().findByPrimaryKey(countryId);
181            }
182    
183            /**
184            * Finds the country with the primary key or returns <code>null</code> if it could not be found.
185            *
186            * @param countryId the primary key of the country to find
187            * @return the country, or <code>null</code> if a country with the primary key could not be found
188            * @throws SystemException if a system exception occurred
189            */
190            public static com.liferay.portal.model.Country fetchByPrimaryKey(
191                    long countryId)
192                    throws com.liferay.portal.kernel.exception.SystemException {
193                    return getPersistence().fetchByPrimaryKey(countryId);
194            }
195    
196            /**
197            * Finds the country where name = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
198            *
199            * @param name the name to search with
200            * @return the matching country
201            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
202            * @throws SystemException if a system exception occurred
203            */
204            public static com.liferay.portal.model.Country findByName(
205                    java.lang.String name)
206                    throws com.liferay.portal.NoSuchCountryException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    return getPersistence().findByName(name);
209            }
210    
211            /**
212            * Finds the country where name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
213            *
214            * @param name the name to search with
215            * @return the matching country, or <code>null</code> if a matching country could not be found
216            * @throws SystemException if a system exception occurred
217            */
218            public static com.liferay.portal.model.Country fetchByName(
219                    java.lang.String name)
220                    throws com.liferay.portal.kernel.exception.SystemException {
221                    return getPersistence().fetchByName(name);
222            }
223    
224            /**
225            * Finds the country where name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
226            *
227            * @param name the name to search with
228            * @return the matching country, or <code>null</code> if a matching country could not be found
229            * @throws SystemException if a system exception occurred
230            */
231            public static com.liferay.portal.model.Country fetchByName(
232                    java.lang.String name, boolean retrieveFromCache)
233                    throws com.liferay.portal.kernel.exception.SystemException {
234                    return getPersistence().fetchByName(name, retrieveFromCache);
235            }
236    
237            /**
238            * Finds the country where a2 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
239            *
240            * @param a2 the a2 to search with
241            * @return the matching country
242            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
243            * @throws SystemException if a system exception occurred
244            */
245            public static com.liferay.portal.model.Country findByA2(java.lang.String a2)
246                    throws com.liferay.portal.NoSuchCountryException,
247                            com.liferay.portal.kernel.exception.SystemException {
248                    return getPersistence().findByA2(a2);
249            }
250    
251            /**
252            * Finds the country where a2 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
253            *
254            * @param a2 the a2 to search with
255            * @return the matching country, or <code>null</code> if a matching country could not be found
256            * @throws SystemException if a system exception occurred
257            */
258            public static com.liferay.portal.model.Country fetchByA2(
259                    java.lang.String a2)
260                    throws com.liferay.portal.kernel.exception.SystemException {
261                    return getPersistence().fetchByA2(a2);
262            }
263    
264            /**
265            * Finds the country where a2 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
266            *
267            * @param a2 the a2 to search with
268            * @return the matching country, or <code>null</code> if a matching country could not be found
269            * @throws SystemException if a system exception occurred
270            */
271            public static com.liferay.portal.model.Country fetchByA2(
272                    java.lang.String a2, boolean retrieveFromCache)
273                    throws com.liferay.portal.kernel.exception.SystemException {
274                    return getPersistence().fetchByA2(a2, retrieveFromCache);
275            }
276    
277            /**
278            * Finds the country where a3 = &#63; or throws a {@link com.liferay.portal.NoSuchCountryException} if it could not be found.
279            *
280            * @param a3 the a3 to search with
281            * @return the matching country
282            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
283            * @throws SystemException if a system exception occurred
284            */
285            public static com.liferay.portal.model.Country findByA3(java.lang.String a3)
286                    throws com.liferay.portal.NoSuchCountryException,
287                            com.liferay.portal.kernel.exception.SystemException {
288                    return getPersistence().findByA3(a3);
289            }
290    
291            /**
292            * Finds the country where a3 = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
293            *
294            * @param a3 the a3 to search with
295            * @return the matching country, or <code>null</code> if a matching country could not be found
296            * @throws SystemException if a system exception occurred
297            */
298            public static com.liferay.portal.model.Country fetchByA3(
299                    java.lang.String a3)
300                    throws com.liferay.portal.kernel.exception.SystemException {
301                    return getPersistence().fetchByA3(a3);
302            }
303    
304            /**
305            * Finds the country where a3 = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
306            *
307            * @param a3 the a3 to search with
308            * @return the matching country, or <code>null</code> if a matching country could not be found
309            * @throws SystemException if a system exception occurred
310            */
311            public static com.liferay.portal.model.Country fetchByA3(
312                    java.lang.String a3, boolean retrieveFromCache)
313                    throws com.liferay.portal.kernel.exception.SystemException {
314                    return getPersistence().fetchByA3(a3, retrieveFromCache);
315            }
316    
317            /**
318            * Finds all the countries where active = &#63;.
319            *
320            * @param active the active to search with
321            * @return the matching countries
322            * @throws SystemException if a system exception occurred
323            */
324            public static java.util.List<com.liferay.portal.model.Country> findByActive(
325                    boolean active)
326                    throws com.liferay.portal.kernel.exception.SystemException {
327                    return getPersistence().findByActive(active);
328            }
329    
330            /**
331            * Finds a range of all the countries where active = &#63;.
332            *
333            * <p>
334            * 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.
335            * </p>
336            *
337            * @param active the active to search with
338            * @param start the lower bound of the range of countries to return
339            * @param end the upper bound of the range of countries to return (not inclusive)
340            * @return the range of matching countries
341            * @throws SystemException if a system exception occurred
342            */
343            public static java.util.List<com.liferay.portal.model.Country> findByActive(
344                    boolean active, int start, int end)
345                    throws com.liferay.portal.kernel.exception.SystemException {
346                    return getPersistence().findByActive(active, start, end);
347            }
348    
349            /**
350            * Finds an ordered range of all the countries where active = &#63;.
351            *
352            * <p>
353            * 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.
354            * </p>
355            *
356            * @param active the active to search with
357            * @param start the lower bound of the range of countries to return
358            * @param end the upper bound of the range of countries to return (not inclusive)
359            * @param orderByComparator the comparator to order the results by
360            * @return the ordered range of matching countries
361            * @throws SystemException if a system exception occurred
362            */
363            public static java.util.List<com.liferay.portal.model.Country> findByActive(
364                    boolean active, int start, int end,
365                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
366                    throws com.liferay.portal.kernel.exception.SystemException {
367                    return getPersistence()
368                                       .findByActive(active, start, end, orderByComparator);
369            }
370    
371            /**
372            * Finds the first country in the ordered set where active = &#63;.
373            *
374            * <p>
375            * 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.
376            * </p>
377            *
378            * @param active the active to search with
379            * @param orderByComparator the comparator to order the set by
380            * @return the first matching country
381            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
382            * @throws SystemException if a system exception occurred
383            */
384            public static com.liferay.portal.model.Country findByActive_First(
385                    boolean active,
386                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
387                    throws com.liferay.portal.NoSuchCountryException,
388                            com.liferay.portal.kernel.exception.SystemException {
389                    return getPersistence().findByActive_First(active, orderByComparator);
390            }
391    
392            /**
393            * Finds the last country in the ordered set where active = &#63;.
394            *
395            * <p>
396            * 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.
397            * </p>
398            *
399            * @param active the active to search with
400            * @param orderByComparator the comparator to order the set by
401            * @return the last matching country
402            * @throws com.liferay.portal.NoSuchCountryException if a matching country could not be found
403            * @throws SystemException if a system exception occurred
404            */
405            public static com.liferay.portal.model.Country findByActive_Last(
406                    boolean active,
407                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
408                    throws com.liferay.portal.NoSuchCountryException,
409                            com.liferay.portal.kernel.exception.SystemException {
410                    return getPersistence().findByActive_Last(active, orderByComparator);
411            }
412    
413            /**
414            * Finds the countries before and after the current country in the ordered set where active = &#63;.
415            *
416            * <p>
417            * 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.
418            * </p>
419            *
420            * @param countryId the primary key of the current country
421            * @param active the active to search with
422            * @param orderByComparator the comparator to order the set by
423            * @return the previous, current, and next country
424            * @throws com.liferay.portal.NoSuchCountryException if a country with the primary key could not be found
425            * @throws SystemException if a system exception occurred
426            */
427            public static com.liferay.portal.model.Country[] findByActive_PrevAndNext(
428                    long countryId, boolean active,
429                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
430                    throws com.liferay.portal.NoSuchCountryException,
431                            com.liferay.portal.kernel.exception.SystemException {
432                    return getPersistence()
433                                       .findByActive_PrevAndNext(countryId, active,
434                            orderByComparator);
435            }
436    
437            /**
438            * Finds all the countries.
439            *
440            * @return the countries
441            * @throws SystemException if a system exception occurred
442            */
443            public static java.util.List<com.liferay.portal.model.Country> findAll()
444                    throws com.liferay.portal.kernel.exception.SystemException {
445                    return getPersistence().findAll();
446            }
447    
448            /**
449            * Finds a range of all the countries.
450            *
451            * <p>
452            * 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.
453            * </p>
454            *
455            * @param start the lower bound of the range of countries to return
456            * @param end the upper bound of the range of countries to return (not inclusive)
457            * @return the range of countries
458            * @throws SystemException if a system exception occurred
459            */
460            public static java.util.List<com.liferay.portal.model.Country> findAll(
461                    int start, int end)
462                    throws com.liferay.portal.kernel.exception.SystemException {
463                    return getPersistence().findAll(start, end);
464            }
465    
466            /**
467            * Finds an ordered range of all the countries.
468            *
469            * <p>
470            * 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.
471            * </p>
472            *
473            * @param start the lower bound of the range of countries to return
474            * @param end the upper bound of the range of countries to return (not inclusive)
475            * @param orderByComparator the comparator to order the results by
476            * @return the ordered range of countries
477            * @throws SystemException if a system exception occurred
478            */
479            public static java.util.List<com.liferay.portal.model.Country> findAll(
480                    int start, int end,
481                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
482                    throws com.liferay.portal.kernel.exception.SystemException {
483                    return getPersistence().findAll(start, end, orderByComparator);
484            }
485    
486            /**
487            * Removes the country where name = &#63; from the database.
488            *
489            * @param name the name to search with
490            * @throws SystemException if a system exception occurred
491            */
492            public static void removeByName(java.lang.String name)
493                    throws com.liferay.portal.NoSuchCountryException,
494                            com.liferay.portal.kernel.exception.SystemException {
495                    getPersistence().removeByName(name);
496            }
497    
498            /**
499            * Removes the country where a2 = &#63; from the database.
500            *
501            * @param a2 the a2 to search with
502            * @throws SystemException if a system exception occurred
503            */
504            public static void removeByA2(java.lang.String a2)
505                    throws com.liferay.portal.NoSuchCountryException,
506                            com.liferay.portal.kernel.exception.SystemException {
507                    getPersistence().removeByA2(a2);
508            }
509    
510            /**
511            * Removes the country where a3 = &#63; from the database.
512            *
513            * @param a3 the a3 to search with
514            * @throws SystemException if a system exception occurred
515            */
516            public static void removeByA3(java.lang.String a3)
517                    throws com.liferay.portal.NoSuchCountryException,
518                            com.liferay.portal.kernel.exception.SystemException {
519                    getPersistence().removeByA3(a3);
520            }
521    
522            /**
523            * Removes all the countries where active = &#63; from the database.
524            *
525            * @param active the active to search with
526            * @throws SystemException if a system exception occurred
527            */
528            public static void removeByActive(boolean active)
529                    throws com.liferay.portal.kernel.exception.SystemException {
530                    getPersistence().removeByActive(active);
531            }
532    
533            /**
534            * Removes all the countries from the database.
535            *
536            * @throws SystemException if a system exception occurred
537            */
538            public static void removeAll()
539                    throws com.liferay.portal.kernel.exception.SystemException {
540                    getPersistence().removeAll();
541            }
542    
543            /**
544            * Counts all the countries where name = &#63;.
545            *
546            * @param name the name to search with
547            * @return the number of matching countries
548            * @throws SystemException if a system exception occurred
549            */
550            public static int countByName(java.lang.String name)
551                    throws com.liferay.portal.kernel.exception.SystemException {
552                    return getPersistence().countByName(name);
553            }
554    
555            /**
556            * Counts all the countries where a2 = &#63;.
557            *
558            * @param a2 the a2 to search with
559            * @return the number of matching countries
560            * @throws SystemException if a system exception occurred
561            */
562            public static int countByA2(java.lang.String a2)
563                    throws com.liferay.portal.kernel.exception.SystemException {
564                    return getPersistence().countByA2(a2);
565            }
566    
567            /**
568            * Counts all the countries where a3 = &#63;.
569            *
570            * @param a3 the a3 to search with
571            * @return the number of matching countries
572            * @throws SystemException if a system exception occurred
573            */
574            public static int countByA3(java.lang.String a3)
575                    throws com.liferay.portal.kernel.exception.SystemException {
576                    return getPersistence().countByA3(a3);
577            }
578    
579            /**
580            * Counts all the countries where active = &#63;.
581            *
582            * @param active the active to search with
583            * @return the number of matching countries
584            * @throws SystemException if a system exception occurred
585            */
586            public static int countByActive(boolean active)
587                    throws com.liferay.portal.kernel.exception.SystemException {
588                    return getPersistence().countByActive(active);
589            }
590    
591            /**
592            * Counts all the countries.
593            *
594            * @return the number of countries
595            * @throws SystemException if a system exception occurred
596            */
597            public static int countAll()
598                    throws com.liferay.portal.kernel.exception.SystemException {
599                    return getPersistence().countAll();
600            }
601    
602            public static CountryPersistence getPersistence() {
603                    if (_persistence == null) {
604                            _persistence = (CountryPersistence)PortalBeanLocatorUtil.locate(CountryPersistence.class.getName());
605    
606                            ReferenceRegistry.registerReference(CountryUtil.class,
607                                    "_persistence");
608                    }
609    
610                    return _persistence;
611            }
612    
613            public void setPersistence(CountryPersistence persistence) {
614                    _persistence = persistence;
615    
616                    ReferenceRegistry.registerReference(CountryUtil.class, "_persistence");
617            }
618    
619            private static CountryPersistence _persistence;
620    }