com.mycompany.service
Interface CountryService

All Known Implementing Classes:
CountryServiceImpl

public interface CountryService

Service class for country-related operations.

Author:
Ian Hlavats (ian@tarantulaconsulting.com)

Method Summary
 ProvinceState createProvinceState(Country country, java.lang.String value)
          Creates a ProvinceState object for a particular Country.
 java.util.List<City> findCitiesByState(ProvinceState provinceState)
          Finds a list of City objects for the given ProvinceState.
 City findCity(java.lang.String name, ProvinceState provinceState)
          Finds a City by name in the ProvinceState.
 City findCityById(java.lang.Integer id)
          Finds a City object by ID.
 Country findCountryById(java.lang.Integer id)
          Finds a Country object by ID.
 java.util.List<ProvinceState> findProvinceStatesByCountry(Country country)
          Finds a List of ProvinceState objects for a particular Country.
 ProvinceState findStateById(java.lang.Integer id)
          Finds a ProvinceState object by ID.
 ProvinceState findStateByName(Country country, java.lang.String name)
          Finds a ProvinceState object by name within a particular Country.
 java.util.List<Country> getCountries()
          Returns all Country objects.
 java.util.List<ProvinceState> getProvinceStates()
          Returns all ProvinceState objects.
 void init(javax.servlet.ServletContext context)
          Invoked during the ServletContext initialization to populate the database with sample data.
 

Method Detail

createProvinceState

ProvinceState createProvinceState(Country country,
                                  java.lang.String value)
Creates a ProvinceState object for a particular Country.

Parameters:
country - The Country in which the ProvinceState is located.
value - The name of the ProvinceState.
Returns:
The newly created ProvinceState object.

findCitiesByState

java.util.List<City> findCitiesByState(ProvinceState provinceState)
Finds a list of City objects for the given ProvinceState.

Parameters:
provinceState - The ProvinceState object for which to find cities.
Returns:
A List of City objects.

findCity

City findCity(java.lang.String name,
              ProvinceState provinceState)
Finds a City by name in the ProvinceState.

Parameters:
name - The name of the city.
provinceState - The province/state in which to find the city.
Returns:
A City object.

findCityById

City findCityById(java.lang.Integer id)
Finds a City object by ID.

Parameters:
id - The ID of the city.
Returns:
A City object.

findCountryById

Country findCountryById(java.lang.Integer id)
Finds a Country object by ID.

Parameters:
id - The ID of the country.
Returns:
A Country object.

findProvinceStatesByCountry

java.util.List<ProvinceState> findProvinceStatesByCountry(Country country)
Finds a List of ProvinceState objects for a particular Country.

Parameters:
country - The Country object.
Returns:
A List of ProvinceState objects.

findStateById

ProvinceState findStateById(java.lang.Integer id)
Finds a ProvinceState object by ID.

Parameters:
id - The ID of the ProvinceState object.
Returns:
A ProvinceState object.

findStateByName

ProvinceState findStateByName(Country country,
                              java.lang.String name)
Finds a ProvinceState object by name within a particular Country.

Parameters:
country - The Country object.
name - The name of the ProvinceState to find.
Returns:
A ProvinceState object.

getCountries

java.util.List<Country> getCountries()
Returns all Country objects.

Returns:
A List of Country objects.

getProvinceStates

java.util.List<ProvinceState> getProvinceStates()
Returns all ProvinceState objects.

Returns:
A List of ProvinceState objects.

init

void init(@Observes
          javax.servlet.ServletContext context)
          throws java.lang.Exception
Invoked during the ServletContext initialization to populate the database with sample data.

Parameters:
context - The ServletContext object.
Throws:
java.lang.Exception - If something goes wrong.