@ProviderType
public class CountryUtil
extends Object
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.
Caching information and settings can be found in portal.properties
CountryPersistence
,
CountryPersistenceImpl
Constructor and Description |
---|
CountryUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheResult(Country country)
Caches the country in the entity cache if it is enabled.
|
static void |
cacheResult(List<Country> countries)
Caches the countries in the entity cache if it is enabled.
|
static void |
clearCache() |
static void |
clearCache(Country country) |
static int |
countAll()
Returns the number of countries.
|
static int |
countByA2(String a2)
Returns the number of countries where a2 = ?.
|
static int |
countByA3(String a3)
Returns the number of countries where a3 = ?.
|
static int |
countByActive(boolean active)
Returns the number of countries where active = ?.
|
static int |
countByName(String name)
Returns the number of countries where name = ?.
|
static long |
countWithDynamicQuery(DynamicQuery dynamicQuery) |
static Country |
create(long countryId)
Creates a new country with the primary key.
|
static Country |
fetchByA2(String a2)
Returns the country where a2 = ? or returns
null if it could not be found. |
static Country |
fetchByA2(String a2,
boolean retrieveFromCache)
Returns the country where a2 = ? or returns
null if it could not be found, optionally using the finder cache. |
static Country |
fetchByA3(String a3)
Returns the country where a3 = ? or returns
null if it could not be found. |
static Country |
fetchByA3(String a3,
boolean retrieveFromCache)
Returns the country where a3 = ? or returns
null if it could not be found, optionally using the finder cache. |
static Country |
fetchByActive_First(boolean active,
OrderByComparator<Country> orderByComparator)
Returns the first country in the ordered set where active = ?.
|
static Country |
fetchByActive_Last(boolean active,
OrderByComparator<Country> orderByComparator)
Returns the last country in the ordered set where active = ?.
|
static Country |
fetchByName(String name)
Returns the country where name = ? or returns
null if it could not be found. |
static Country |
fetchByName(String name,
boolean retrieveFromCache)
Returns the country where name = ? or returns
null if it could not be found, optionally using the finder cache. |
static Country |
fetchByPrimaryKey(long countryId)
Returns the country with the primary key or returns
null if it could not be found. |
static Map<Serializable,Country> |
fetchByPrimaryKeys(Set<Serializable> primaryKeys) |
static List<Country> |
findAll()
Returns all the countries.
|
static List<Country> |
findAll(int start,
int end)
Returns a range of all the countries.
|
static List<Country> |
findAll(int start,
int end,
OrderByComparator<Country> orderByComparator)
Returns an ordered range of all the countries.
|
static List<Country> |
findAll(int start,
int end,
OrderByComparator<Country> orderByComparator,
boolean retrieveFromCache)
Returns an ordered range of all the countries.
|
static Country |
findByA2(String a2)
Returns the country where a2 = ? or throws a
NoSuchCountryException if it could not be found. |
static Country |
findByA3(String a3)
Returns the country where a3 = ? or throws a
NoSuchCountryException if it could not be found. |
static Country |
findByActive_First(boolean active,
OrderByComparator<Country> orderByComparator)
Returns the first country in the ordered set where active = ?.
|
static Country |
findByActive_Last(boolean active,
OrderByComparator<Country> orderByComparator)
Returns the last country in the ordered set where active = ?.
|
static Country[] |
findByActive_PrevAndNext(long countryId,
boolean active,
OrderByComparator<Country> orderByComparator)
Returns the countries before and after the current country in the ordered set where active = ?.
|
static List<Country> |
findByActive(boolean active)
Returns all the countries where active = ?.
|
static List<Country> |
findByActive(boolean active,
int start,
int end)
Returns a range of all the countries where active = ?.
|
static List<Country> |
findByActive(boolean active,
int start,
int end,
OrderByComparator<Country> orderByComparator)
Returns an ordered range of all the countries where active = ?.
|
static List<Country> |
findByActive(boolean active,
int start,
int end,
OrderByComparator<Country> orderByComparator,
boolean retrieveFromCache)
Returns an ordered range of all the countries where active = ?.
|
static Country |
findByName(String name)
Returns the country where name = ? or throws a
NoSuchCountryException if it could not be found. |
static Country |
findByPrimaryKey(long countryId)
Returns the country with the primary key or throws a
NoSuchCountryException if it could not be found. |
static List<Country> |
findWithDynamicQuery(DynamicQuery dynamicQuery) |
static List<Country> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end) |
static List<Country> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator<Country> orderByComparator) |
static Set<String> |
getBadColumnNames() |
static CountryPersistence |
getPersistence() |
static Country |
remove(long countryId)
Removes the country with the primary key from the database.
|
static void |
removeAll()
Removes all the countries from the database.
|
static Country |
removeByA2(String a2)
Removes the country where a2 = ? from the database.
|
static Country |
removeByA3(String a3)
Removes the country where a3 = ? from the database.
|
static void |
removeByActive(boolean active)
Removes all the countries where active = ? from the database.
|
static Country |
removeByName(String name)
Removes the country where name = ? from the database.
|
static Country |
update(Country country) |
static Country |
update(Country country,
ServiceContext serviceContext) |
static Country |
updateImpl(Country country) |
public static void clearCache()
BasePersistence.clearCache()
public static void clearCache(Country country)
public static long countWithDynamicQuery(DynamicQuery dynamicQuery)
public static List<Country> findWithDynamicQuery(DynamicQuery dynamicQuery)
public static List<Country> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
public static List<Country> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Country> orderByComparator)
public static Country update(Country country, ServiceContext serviceContext)
public static Country findByName(String name) throws NoSuchCountryException
NoSuchCountryException
if it could not be found.name
- the nameNoSuchCountryException
- if a matching country could not be foundpublic static Country fetchByName(String name)
null
if it could not be found. Uses the finder cache.name
- the namenull
if a matching country could not be foundpublic static Country fetchByName(String name, boolean retrieveFromCache)
null
if it could not be found, optionally using the finder cache.name
- the nameretrieveFromCache
- whether to retrieve from the finder cachenull
if a matching country could not be foundpublic static Country removeByName(String name) throws NoSuchCountryException
name
- the nameNoSuchCountryException
public static int countByName(String name)
name
- the namepublic static Country findByA2(String a2) throws NoSuchCountryException
NoSuchCountryException
if it could not be found.a2
- the a2NoSuchCountryException
- if a matching country could not be foundpublic static Country fetchByA2(String a2)
null
if it could not be found. Uses the finder cache.a2
- the a2null
if a matching country could not be foundpublic static Country fetchByA2(String a2, boolean retrieveFromCache)
null
if it could not be found, optionally using the finder cache.a2
- the a2retrieveFromCache
- whether to retrieve from the finder cachenull
if a matching country could not be foundpublic static Country removeByA2(String a2) throws NoSuchCountryException
a2
- the a2NoSuchCountryException
public static int countByA2(String a2)
a2
- the a2public static Country findByA3(String a3) throws NoSuchCountryException
NoSuchCountryException
if it could not be found.a3
- the a3NoSuchCountryException
- if a matching country could not be foundpublic static Country fetchByA3(String a3)
null
if it could not be found. Uses the finder cache.a3
- the a3null
if a matching country could not be foundpublic static Country fetchByA3(String a3, boolean retrieveFromCache)
null
if it could not be found, optionally using the finder cache.a3
- the a3retrieveFromCache
- whether to retrieve from the finder cachenull
if a matching country could not be foundpublic static Country removeByA3(String a3) throws NoSuchCountryException
a3
- the a3NoSuchCountryException
public static int countByA3(String a3)
a3
- the a3public static List<Country> findByActive(boolean active)
active
- the activepublic static List<Country> findByActive(boolean active, int start, int end)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
active
- the activestart
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)public static List<Country> findByActive(boolean active, int start, int end, OrderByComparator<Country> orderByComparator)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
active
- the activestart
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static List<Country> findByActive(boolean active, int start, int end, OrderByComparator<Country> orderByComparator, boolean retrieveFromCache)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
active
- the activestart
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)retrieveFromCache
- whether to retrieve from the finder cachepublic static Country findByActive_First(boolean active, OrderByComparator<Country> orderByComparator) throws NoSuchCountryException
active
- the activeorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCountryException
- if a matching country could not be foundpublic static Country fetchByActive_First(boolean active, OrderByComparator<Country> orderByComparator)
active
- the activeorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching country could not be foundpublic static Country findByActive_Last(boolean active, OrderByComparator<Country> orderByComparator) throws NoSuchCountryException
active
- the activeorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCountryException
- if a matching country could not be foundpublic static Country fetchByActive_Last(boolean active, OrderByComparator<Country> orderByComparator)
active
- the activeorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching country could not be foundpublic static Country[] findByActive_PrevAndNext(long countryId, boolean active, OrderByComparator<Country> orderByComparator) throws NoSuchCountryException
countryId
- the primary key of the current countryactive
- the activeorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCountryException
- if a country with the primary key could not be foundpublic static void removeByActive(boolean active)
active
- the activepublic static int countByActive(boolean active)
active
- the activepublic static void cacheResult(Country country)
country
- the countrypublic static void cacheResult(List<Country> countries)
countries
- the countriespublic static Country create(long countryId)
countryId
- the primary key for the new countrypublic static Country remove(long countryId) throws NoSuchCountryException
countryId
- the primary key of the countryNoSuchCountryException
- if a country with the primary key could not be foundpublic static Country findByPrimaryKey(long countryId) throws NoSuchCountryException
NoSuchCountryException
if it could not be found.countryId
- the primary key of the countryNoSuchCountryException
- if a country with the primary key could not be foundpublic static Country fetchByPrimaryKey(long countryId)
null
if it could not be found.countryId
- the primary key of the countrynull
if a country with the primary key could not be foundpublic static Map<Serializable,Country> fetchByPrimaryKeys(Set<Serializable> primaryKeys)
public static List<Country> findAll()
public static List<Country> findAll(int start, int end)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
start
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)public static List<Country> findAll(int start, int end, OrderByComparator<Country> orderByComparator)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
start
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static List<Country> findAll(int start, int end, OrderByComparator<Country> orderByComparator, boolean retrieveFromCache)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from CountryModelImpl
. If both orderByComparator
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.
start
- the lower bound of the range of countriesend
- the upper bound of the range of countries (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)retrieveFromCache
- whether to retrieve from the finder cachepublic static void removeAll()
public static int countAll()
public static Set<String> getBadColumnNames()
public static CountryPersistence getPersistence()