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