public class DefaultCommonI18NService extends AbstractBusinessService implements CommonI18NService
CommonI18NService.AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultCommonI18NService() |
| Modifier and Type | Method and Description |
|---|---|
double |
convertAndRoundCurrency(double sourceFactor,
double targetFactor,
int digits,
double value)
Converts a (price) value of this currency into a value for the specified target currency and rounds the result
according to the target currency's digits.
|
double |
convertCurrency(double sourceFactor,
double targetFactor,
double value)
Used to converts a numeric price value from one currency to another.
|
List<CountryModel> |
getAllCountries()
Return a set of all CountryModels.
|
List<CurrencyModel> |
getAllCurrencies()
Return a set of all
CurrencyModel. |
List<LanguageModel> |
getAllLanguages()
Gets all languages.
|
List<RegionModel> |
getAllRegions()
Return a set of all RegionModel.
|
CurrencyModel |
getBaseCurrency()
Returns the base currency (
CurrencyModel.getBase()) of this system or null if no base
currency is set. |
CountryModel |
getCountry(String isocode)
Returns a country by its isocode.
|
CurrencyModel |
getCurrency(String isoCode)
Returns a currency by its code.
|
CurrencyModel |
getCurrentCurrency()
Gets session currency.
|
LanguageModel |
getCurrentLanguage()
Gets current session language.
|
LanguageModel |
getLanguage(String isocode)
Gets the language for the given isocode.
|
Locale |
getLocaleForIsoCode(String isoCode)
Returns a
Locale for ISO code. |
Locale |
getLocaleForLanguage(LanguageModel languageModel)
Returns a
Locale according language (ISO code), country (ISO code) and vendor id. |
RegionModel |
getRegion(CountryModel country,
String code)
Returns a region by its isocode within the country.
|
double |
roundCurrency(double value,
int digits)
Rounds a price value according to this currency's number of digits.
|
void |
setConversionStrategy(ConversionStrategy conversionStrategy) |
void |
setCountryDao(CountryDao countryDao) |
void |
setCurrencyDao(CurrencyDao currencyDao) |
void |
setCurrentCurrency(CurrencyModel currency)
Sets the current currency to the session.
|
void |
setCurrentLanguage(LanguageModel language)
Sets the current language to the session.
|
void |
setLanguageDao(LanguageDao dao) |
void |
setRegionDao(RegionDao regionDao) |
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, setTenantScope, writeReplacepublic void setConversionStrategy(ConversionStrategy conversionStrategy)
public Locale getLocaleForLanguage(LanguageModel languageModel)
CommonI18NServiceLocale according language (ISO code), country (ISO code) and vendor id. The three parameters are
passed as a isocode of the LanguageModel instance. Supported delimiters are: _ , . ;
LanguageModel languageModel = new LanguageModel();
languageModel.setIsocode("de_DE_WIN");
getLocaleForLanguage(languageModel);
languageModel.setIsocode("en,AT,");
getLocaleForLanguage(languageModel);
getLocaleForLanguage in interface CommonI18NServicepublic Locale getLocaleForIsoCode(String isoCode)
CommonI18NServiceLocale for ISO code.getLocaleForIsoCode in interface CommonI18NServicepublic List<LanguageModel> getAllLanguages()
CommonI18NServicegetAllLanguages in interface CommonI18NServicepublic LanguageModel getLanguage(String isocode)
CommonI18NServicegetLanguage in interface CommonI18NServiceisocode - the isocode a language is searched forpublic void setCurrentLanguage(LanguageModel language)
CommonI18NServicesetCurrentLanguage in interface CommonI18NServicelanguage - the new languagepublic LanguageModel getCurrentLanguage()
CommonI18NServicegetCurrentLanguage in interface CommonI18NServicepublic List<CountryModel> getAllCountries()
CommonI18NServicegetAllCountries in interface CommonI18NServicepublic CountryModel getCountry(String isocode)
CommonI18NServicegetCountry in interface CommonI18NServiceisocode - the isocodepublic void setCurrentCurrency(CurrencyModel currency)
CommonI18NServicesetCurrentCurrency in interface CommonI18NServicecurrency - the new currencypublic CurrencyModel getCurrentCurrency()
CommonI18NServicegetCurrentCurrency in interface CommonI18NServicenull if not setpublic List<CurrencyModel> getAllCurrencies()
CommonI18NServiceCurrencyModel.getAllCurrencies in interface CommonI18NServicepublic CurrencyModel getBaseCurrency()
CommonI18NServiceCurrencyModel.getBase()) of this system or null if no base
currency is set. There should be always one such Currency in the hybris Platform. The base currency
should be the most likely-to-us currency.getBaseCurrency in interface CommonI18NServiceCurrencyModel or null if no base currency is setpublic CurrencyModel getCurrency(String isoCode)
CommonI18NServicegetCurrency in interface CommonI18NServiceisoCode - the codepublic List<RegionModel> getAllRegions()
CommonI18NServicegetAllRegions in interface CommonI18NServicepublic RegionModel getRegion(CountryModel country, String code)
CommonI18NServicegetRegion in interface CommonI18NServicecountry - the country modelcode - the region codepublic double convertAndRoundCurrency(double sourceFactor,
double targetFactor,
int digits,
double value)
CommonI18NServiceconvertAndRoundCurrency in interface CommonI18NServicesourceFactor - the conversionFactor of the source currencytargetFactor - the conversionFactor of the target currencydigits - currency's number of digitsvalue - the value which should be convertedpublic double convertCurrency(double sourceFactor,
double targetFactor,
double value)
CommonI18NServiceCommonI18NService.roundCurrency(double,int) to achieve this, or just use
CommonI18NService.convertAndRoundCurrency(double, double, int, double) convertCurrency in interface CommonI18NServicesourceFactor - the conversionFactor of the source currencytargetFactor - the conversionFactor of the target currencyvalue - the source valuepublic double roundCurrency(double value,
int digits)
CommonI18NServiceroundCurrency in interface CommonI18NServicevalue - the currency value which should be rounded.digits - currency's number of digitspublic void setLanguageDao(LanguageDao dao)
public void setCountryDao(CountryDao countryDao)
public void setCurrencyDao(CurrencyDao currencyDao)
public void setRegionDao(RegionDao regionDao)
Copyright © 2017 SAP SE. All Rights Reserved.