|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mycompany.service.impl.AbstractService
com.mycompany.service.impl.CountryServiceImpl
@Named(value="countryService") public class CountryServiceImpl
Controller class for countries. Since this class holds application-wide
state, namely a list of Country
objects, we annotate it as an
application-scoped CDI bean.
Constructor Summary | |
---|---|
CountryServiceImpl()
|
Method Summary | |
---|---|
ProvinceState |
createProvinceState(Country country,
java.lang.String name)
Creates a ProvinceState object for a particular Country . |
java.util.List<City> |
findCitiesByState(ProvinceState state)
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 stateName)
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)
This method is responsible for initializing a List of Country objects when the web application is started. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CountryServiceImpl()
Method Detail |
---|
public ProvinceState createProvinceState(Country country, java.lang.String name)
CountryService
ProvinceState
object for a particular Country
.
createProvinceState
in interface CountryService
country
- The Country in which the ProvinceState is located.name
- The name of the ProvinceState.
public java.util.List<City> findCitiesByState(ProvinceState state)
CountryService
City
objects for the given ProvinceState
.
findCitiesByState
in interface CountryService
state
- The ProvinceState object for which to find cities.
public City findCity(java.lang.String name, ProvinceState provinceState)
CountryService
City
by name in the ProvinceState
.
findCity
in interface CountryService
name
- The name of the city.provinceState
- The province/state in which to find the city.
public City findCityById(java.lang.Integer id)
CountryService
City
object by ID.
findCityById
in interface CountryService
id
- The ID of the city.
public Country findCountryById(java.lang.Integer id)
CountryService
Country
object by ID.
findCountryById
in interface CountryService
id
- The ID of the country.
public java.util.List<ProvinceState> findProvinceStatesByCountry(Country country)
CountryService
List
of ProvinceState
objects for a particular
Country
.
findProvinceStatesByCountry
in interface CountryService
country
- The Country object.
public ProvinceState findStateById(java.lang.Integer id)
CountryService
ProvinceState
object by ID.
findStateById
in interface CountryService
id
- The ID of the ProvinceState object.
public ProvinceState findStateByName(Country country, java.lang.String stateName)
CountryService
ProvinceState
object by name within a particular
Country
.
findStateByName
in interface CountryService
country
- The Country object.stateName
- The name of the ProvinceState to find.
public java.util.List<Country> getCountries()
CountryService
Country
objects.
getCountries
in interface CountryService
public java.util.List<ProvinceState> getProvinceStates()
CountryService
ProvinceState
objects.
getProvinceStates
in interface CountryService
public void init(@Observes javax.servlet.ServletContext context) throws java.lang.Exception
Initialized
event to ensure this method
is called at startup time. Note: since this class is not an EJB, to
insert data we have to use bean-managed transactions with the
UserTransaction
.
init
in interface CountryService
context
-
java.lang.Exception
ServletContextLifecycleNotifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |