Class DummyI18NService
- java.lang.Object
-
- de.hybris.platform.sap.sapordermgmtbol.transaction.util.DummyI18NService
-
- All Implemented Interfaces:
CommonI18NService
public class DummyI18NService extends java.lang.Object implements CommonI18NService
Dummy I18N service for unit tests
-
-
Constructor Summary
Constructors Constructor Description DummyI18NService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
convertAndRoundCurrency(double arg0, double arg1, int arg2, double arg3)
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 arg0, double arg1, double arg2)
Used to converts a numeric price value from one currency to another.java.util.List<CountryModel>
getAllCountries()
Return a set of all CountryModels.java.util.List<CurrencyModel>
getAllCurrencies()
Return a set of allCurrencyModel
.java.util.List<LanguageModel>
getAllLanguages()
Gets all languages.java.util.List<RegionModel>
getAllRegions()
Return a set of all RegionModel.CurrencyModel
getBaseCurrency()
Returns the base currency (CurrencyModel.getBase()
) of this system ornull
if no base currency is set.CountryModel
getCountry(java.lang.String arg0)
Returns a country by its isocode.CurrencyModel
getCurrency(java.lang.String arg0)
Returns a currency by its code.CurrencyModel
getCurrentCurrency()
Gets session currency.LanguageModel
getCurrentLanguage()
Gets current session language.LanguageModel
getLanguage(java.lang.String arg0)
Gets the language for the given isocode.java.util.Locale
getLocaleForIsoCode(java.lang.String isoCode)
Returns aLocale
for ISO code.java.util.Locale
getLocaleForLanguage(LanguageModel arg0)
Returns aLocale
according language (ISO code), country (ISO code) and vendor id.RegionModel
getRegion(CountryModel arg0, java.lang.String arg1)
Returns a region by its isocode within the country.double
roundCurrency(double arg0, int arg1)
Rounds a price value according to this currency's number of digits.void
setCurrentCurrency(CurrencyModel arg0)
Sets the current currency to the session.void
setCurrentLanguage(LanguageModel arg0)
Sets the current language to the session.
-
-
-
Method Detail
-
convertAndRoundCurrency
public double convertAndRoundCurrency(double arg0, double arg1, int arg2, double arg3)
Description copied from interface:CommonI18NService
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.- Specified by:
convertAndRoundCurrency
in interfaceCommonI18NService
- Parameters:
arg0
- the conversionFactor of the source currencyarg1
- the conversionFactor of the target currencyarg2
- currency's number of digitsarg3
- the value which should be converted- Returns:
- the converted and rounded value
-
convertCurrency
public double convertCurrency(double arg0, double arg1, double arg2)
Description copied from interface:CommonI18NService
Used to converts a numeric price value from one currency to another. Please note that this method does no rounding. You can use it in connection withCommonI18NService.roundCurrency(double, int)
to achieve this, or just useCommonI18NService.convertAndRoundCurrency(double, double, int, double)
- Specified by:
convertCurrency
in interfaceCommonI18NService
- Parameters:
arg0
- the conversionFactor of the source currencyarg1
- the conversionFactor of the target currencyarg2
- the source value- Returns:
- converted value
-
getAllCountries
public java.util.List<CountryModel> getAllCountries()
Description copied from interface:CommonI18NService
Return a set of all CountryModels.- Specified by:
getAllCountries
in interfaceCommonI18NService
- Returns:
- the countries
-
getAllCurrencies
public java.util.List<CurrencyModel> getAllCurrencies()
Description copied from interface:CommonI18NService
Return a set of allCurrencyModel
.- Specified by:
getAllCurrencies
in interfaceCommonI18NService
- Returns:
- the currencies
-
getAllLanguages
public java.util.List<LanguageModel> getAllLanguages()
Description copied from interface:CommonI18NService
Gets all languages.- Specified by:
getAllLanguages
in interfaceCommonI18NService
- Returns:
- all languages in the system
-
getAllRegions
public java.util.List<RegionModel> getAllRegions()
Description copied from interface:CommonI18NService
Return a set of all RegionModel.- Specified by:
getAllRegions
in interfaceCommonI18NService
- Returns:
- the regions
-
getBaseCurrency
public CurrencyModel getBaseCurrency()
Description copied from interface:CommonI18NService
Returns the base currency (CurrencyModel.getBase()
) of this system ornull
if no base currency is set. There should be always one suchCurrency
in the hybris Platform. The base currency should be the most likely-to-us currency.- Specified by:
getBaseCurrency
in interfaceCommonI18NService
- Returns:
- the base
CurrencyModel
ornull
if no base currency is set
-
getCountry
public CountryModel getCountry(java.lang.String arg0)
Description copied from interface:CommonI18NService
Returns a country by its isocode.- Specified by:
getCountry
in interfaceCommonI18NService
- Parameters:
arg0
- the isocode- Returns:
- the country
-
getCurrency
public CurrencyModel getCurrency(java.lang.String arg0)
Description copied from interface:CommonI18NService
Returns a currency by its code.- Specified by:
getCurrency
in interfaceCommonI18NService
- Parameters:
arg0
- the code- Returns:
- the currency
-
getCurrentCurrency
public CurrencyModel getCurrentCurrency()
Description copied from interface:CommonI18NService
Gets session currency.- Specified by:
getCurrentCurrency
in interfaceCommonI18NService
- Returns:
- session currency or
null
if not set
-
getCurrentLanguage
public LanguageModel getCurrentLanguage()
Description copied from interface:CommonI18NService
Gets current session language.- Specified by:
getCurrentLanguage
in interfaceCommonI18NService
- Returns:
- current session language or null if not set
-
getLanguage
public LanguageModel getLanguage(java.lang.String arg0)
Description copied from interface:CommonI18NService
Gets the language for the given isocode.- Specified by:
getLanguage
in interfaceCommonI18NService
- Parameters:
arg0
- the isocode a language is searched for- Returns:
- language for searched isocode
-
getLocaleForLanguage
public java.util.Locale getLocaleForLanguage(LanguageModel arg0)
Description copied from interface:CommonI18NService
Returns aLocale
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);
- Specified by:
getLocaleForLanguage
in interfaceCommonI18NService
-
getRegion
public RegionModel getRegion(CountryModel arg0, java.lang.String arg1)
Description copied from interface:CommonI18NService
Returns a region by its isocode within the country.- Specified by:
getRegion
in interfaceCommonI18NService
- Parameters:
arg0
- the country modelarg1
- the region code- Returns:
- the region
-
roundCurrency
public double roundCurrency(double arg0, int arg1)
Description copied from interface:CommonI18NService
Rounds a price value according to this currency's number of digits.- Specified by:
roundCurrency
in interfaceCommonI18NService
- Parameters:
arg0
- the currency value which should be rounded.arg1
- currency's number of digits- Returns:
- the rounded currency value
-
setCurrentCurrency
public void setCurrentCurrency(CurrencyModel arg0)
Description copied from interface:CommonI18NService
Sets the current currency to the session.- Specified by:
setCurrentCurrency
in interfaceCommonI18NService
- Parameters:
arg0
- the new currency
-
setCurrentLanguage
public void setCurrentLanguage(LanguageModel arg0)
Description copied from interface:CommonI18NService
Sets the current language to the session.- Specified by:
setCurrentLanguage
in interfaceCommonI18NService
- Parameters:
arg0
- the new language
-
getLocaleForIsoCode
public java.util.Locale getLocaleForIsoCode(java.lang.String isoCode)
Description copied from interface:CommonI18NService
Returns aLocale
for ISO code.- Specified by:
getLocaleForIsoCode
in interfaceCommonI18NService
-
-