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