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