Package africa.absa.inception.reference
Class ReferenceService
java.lang.Object
africa.absa.inception.reference.ReferenceService
- All Implemented Interfaces:
IReferenceService
The ReferenceService class provides the Reference Service implementation.
- Author:
- Marcus Portmann
-
Field Summary
Fields inherited from interface africa.absa.inception.reference.IReferenceService
DEFAULT_LOCALE_ID -
Constructor Summary
ConstructorsConstructorDescriptionReferenceService(CountryRepository countryRepository, LanguageRepository languageRepository, MeasurementSystemRepository measurementSystemRepository, MeasurementUnitRepository measurementUnitRepository, MeasurementUnitTypeRepository measurementUnitTypeRepository, RegionRepository regionRepository) Constructs a new ReferenceService. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the country reference data for all locales.getCountries(String localeId) Retrieve the country reference data for a specific locale.Retrieve the language reference data for all locales.getLanguages(String localeId) Retrieve the language reference data for a specific locale.Retrieve the measurement system reference data for all locales.getMeasurementSystems(String localeId) Retrieve the measurement system reference data for a specific locale.Retrieve the measurement unit reference data for all locales.getMeasurementUnits(String localeId) Retrieve the measurement unit reference data for a specific locale.Retrieve the measurement unit type reference data for all locales.getMeasurementUnitTypes(String localeId) Retrieve the measurement unit type reference data for a specific locale.Retrieve the region reference data for all locales.getRegions(String localeId) Retrieve the region reference data for a specific locale.Retrieve the time zone reference data for all locales.getTimeZones(String localeId) Retrieve the time zone reference data for a specific locale.booleanisValidCountry(String countryCode) Check whether the code is a valid code for a country.booleanisValidLanguage(String languageCode) Check whether the code is a valid ISO 639-1 alpha-2 code for a language.booleanisValidMeasurementSystem(String measurementSystemCode) Check whether the code is a valid code for a measurement system.booleanisValidMeasurementUnit(String measurementUnitCode) Check whether the code is a valid code for a measurement unit.booleanisValidMeasurementUnitType(String measurementUnitTypeCode) Check whether the code is a valid code for a measurement unit type.booleanisValidRegion(String regionCode) Check whether the code is a valid code for a region.booleanisValidTimeZone(String timeZoneCode) Check whether the code is a valid code for a time zone.
-
Constructor Details
-
ReferenceService
public ReferenceService(CountryRepository countryRepository, LanguageRepository languageRepository, MeasurementSystemRepository measurementSystemRepository, MeasurementUnitRepository measurementUnitRepository, MeasurementUnitTypeRepository measurementUnitTypeRepository, RegionRepository regionRepository) Constructs a new ReferenceService.- Parameters:
countryRepository- the Country RepositorylanguageRepository- the Language RepositorymeasurementSystemRepository- the Measurement System RepositorymeasurementUnitRepository- the Measurement Unit Type RepositorymeasurementUnitTypeRepository- the Measurement Unit Type RepositoryregionRepository- the Region Repository
-
-
Method Details
-
getCountries
@Cacheable(cacheNames="reference", key="\'countries.ALL\'") public List<Country> getCountries() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the country reference data for all locales.- Specified by:
getCountriesin interfaceIReferenceService- Returns:
- the country reference data
- Throws:
ServiceUnavailableException- if the country reference data could not be retrieved
-
getCountries
@Cacheable(cacheNames="reference", key="\'countries.\' + #localeId") public List<Country> getCountries(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the country reference data for a specific locale.- Specified by:
getCountriesin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the country reference data for- Returns:
- the country reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the country reference data could not be retrieved
-
getLanguages
@Cacheable(cacheNames="reference", key="\'languages.ALL\'") public List<Language> getLanguages() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the language reference data for all locales.- Specified by:
getLanguagesin interfaceIReferenceService- Returns:
- the language reference data
- Throws:
ServiceUnavailableException- if the language reference data could not be retrieved
-
getLanguages
@Cacheable(cacheNames="reference", key="\'languages.\' + #localeId") public List<Language> getLanguages(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the language reference data for a specific locale.- Specified by:
getLanguagesin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the language reference data for- Returns:
- the language reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the language reference data could not be retrieved
-
getMeasurementSystems
@Cacheable(cacheNames="reference", key="\'measurementSystems.ALL\'") public List<MeasurementSystem> getMeasurementSystems() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the measurement system reference data for all locales.- Specified by:
getMeasurementSystemsin interfaceIReferenceService- Returns:
- the measurement system reference data
- Throws:
ServiceUnavailableException- if the measurement system reference data could not be retrieved
-
getMeasurementSystems
@Cacheable(cacheNames="reference", key="\'measurementSystems.\' + #localeId") public List<MeasurementSystem> getMeasurementSystems(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the measurement system reference data for a specific locale.- Specified by:
getMeasurementSystemsin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the measurement system reference data for- Returns:
- the measurement system reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the measurement system reference data could not be retrieved
-
getMeasurementUnitTypes
@Cacheable(cacheNames="reference", key="\'measurementUnitTypes.ALL\'") public List<MeasurementUnitType> getMeasurementUnitTypes() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the measurement unit type reference data for all locales.- Specified by:
getMeasurementUnitTypesin interfaceIReferenceService- Returns:
- the measurement unit type reference data
- Throws:
ServiceUnavailableException- if the measurement unit type reference data could not be retrieved
-
getMeasurementUnitTypes
@Cacheable(cacheNames="reference", key="\'measurementUnitTypes.\' + #localeId") public List<MeasurementUnitType> getMeasurementUnitTypes(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the measurement unit type reference data for a specific locale.- Specified by:
getMeasurementUnitTypesin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the measurement unit type reference data for- Returns:
- the measurement unit type reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the measurement unit type reference data could not be retrieved
-
getMeasurementUnits
@Cacheable(cacheNames="reference", key="\'measurementUnits.ALL\'") public List<MeasurementUnit> getMeasurementUnits() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the measurement unit reference data for all locales.- Specified by:
getMeasurementUnitsin interfaceIReferenceService- Returns:
- the measurement unit reference data
- Throws:
ServiceUnavailableException- if the measurement unit reference data could not be retrieved
-
getMeasurementUnits
@Cacheable(cacheNames="reference", key="\'measurementUnits.\' + #localeId") public List<MeasurementUnit> getMeasurementUnits(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the measurement unit reference data for a specific locale.- Specified by:
getMeasurementUnitsin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the measurement unit reference data for- Returns:
- the measurement unit reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the measurement unit reference data could not be retrieved
-
getRegions
@Cacheable(cacheNames="reference", key="\'regions.ALL\'") public List<Region> getRegions() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the region reference data for all locales.- Specified by:
getRegionsin interfaceIReferenceService- Returns:
- the region reference data
- Throws:
ServiceUnavailableException- if the region reference data could not be retrieved
-
getRegions
@Cacheable(cacheNames="reference", key="\'regions.\' + #localeId") public List<Region> getRegions(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the region reference data for a specific locale.- Specified by:
getRegionsin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the region reference data for- Returns:
- the region reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the region reference data could not be retrieved
-
getTimeZones
@Cacheable(cacheNames="reference", key="\'timeZones.ALL\'") public List<TimeZone> getTimeZones() throws ServiceUnavailableExceptionDescription copied from interface:IReferenceServiceRetrieve the time zone reference data for all locales.- Specified by:
getTimeZonesin interfaceIReferenceService- Returns:
- the time zones reference data
- Throws:
ServiceUnavailableException- if the time zones reference data could not be retrieved
-
getTimeZones
@Cacheable(cacheNames="reference", key="\'timeZones.\' + #localeId") public List<TimeZone> getTimeZones(String localeId) throws InvalidArgumentException, ServiceUnavailableException Description copied from interface:IReferenceServiceRetrieve the time zone reference data for a specific locale.- Specified by:
getTimeZonesin interfaceIReferenceService- Parameters:
localeId- the Unicode locale identifier for the locale to retrieve the time zone reference data for- Returns:
- the time zone reference data
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the time zones reference data could not be retrieved
-
isValidCountry
Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a country.- Specified by:
isValidCountryin interfaceIReferenceService- Parameters:
countryCode- the code for the country- Returns:
- true if the code is a valid code for a country or false otherwise
- Throws:
ServiceUnavailableException- if the country code check failed
-
isValidLanguage
Description copied from interface:IReferenceServiceCheck whether the code is a valid ISO 639-1 alpha-2 code for a language.- Specified by:
isValidLanguagein interfaceIReferenceService- Parameters:
languageCode- the code for the language- Returns:
- true if the code is a valid ISO 639-1 alpha-2 code for a language or false otherwise
- Throws:
ServiceUnavailableException- if the language code check failed
-
isValidMeasurementSystem
public boolean isValidMeasurementSystem(String measurementSystemCode) throws ServiceUnavailableException Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a measurement system.- Specified by:
isValidMeasurementSystemin interfaceIReferenceService- Parameters:
measurementSystemCode- the code for the measurement system- Returns:
- true if the code is a valid code for a measurement system or false otherwise
- Throws:
ServiceUnavailableException- if the measurement system code check failed
-
isValidMeasurementUnit
public boolean isValidMeasurementUnit(String measurementUnitCode) throws ServiceUnavailableException Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a measurement unit.- Specified by:
isValidMeasurementUnitin interfaceIReferenceService- Parameters:
measurementUnitCode- the code for the measurement unit- Returns:
- true if the code is a valid code for a measurement unit or false otherwise
- Throws:
ServiceUnavailableException- if the measurement unit code check failed
-
isValidMeasurementUnitType
public boolean isValidMeasurementUnitType(String measurementUnitTypeCode) throws ServiceUnavailableException Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a measurement unit type.- Specified by:
isValidMeasurementUnitTypein interfaceIReferenceService- Parameters:
measurementUnitTypeCode- the code for the measurement unit type- Returns:
- true if the code is a valid code for a measurement unit type or false otherwise
- Throws:
ServiceUnavailableException- if the measurement unit type code check failed
-
isValidRegion
Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a region.- Specified by:
isValidRegionin interfaceIReferenceService- Parameters:
regionCode- the code for the region- Returns:
- true if the code is a valid code for a region or false otherwise
- Throws:
ServiceUnavailableException- if the region code check failed
-
isValidTimeZone
Description copied from interface:IReferenceServiceCheck whether the code is a valid code for a time zone.- Specified by:
isValidTimeZonein interfaceIReferenceService- Parameters:
timeZoneCode- the code for the time zone- Returns:
- true if the code is a valid code for a time zone or false otherwise
-