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 doubleconvertAndRoundCurrency(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.doubleconvertCurrency(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.CurrencyModelgetBaseCurrency()Returns the base currency (CurrencyModel.getBase()) of this system ornullif no base currency is set.CountryModelgetCountry(java.lang.String arg0)Returns a country by its isocode.CurrencyModelgetCurrency(java.lang.String arg0)Returns a currency by its code.CurrencyModelgetCurrentCurrency()Gets session currency.LanguageModelgetCurrentLanguage()Gets current session language.LanguageModelgetLanguage(java.lang.String arg0)Gets the language for the given isocode.java.util.LocalegetLocaleForIsoCode(java.lang.String isoCode)Returns aLocalefor ISO code.java.util.LocalegetLocaleForLanguage(LanguageModel arg0)Returns aLocaleaccording language (ISO code), country (ISO code) and vendor id.RegionModelgetRegion(CountryModel arg0, java.lang.String arg1)Returns a region by its isocode within the country.doubleroundCurrency(double arg0, int arg1)Rounds a price value according to this currency's number of digits.voidsetCurrentCurrency(CurrencyModel arg0)Sets the current currency to the session.voidsetCurrentLanguage(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:CommonI18NServiceConverts 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:
convertAndRoundCurrencyin 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:CommonI18NServiceUsed 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:
convertCurrencyin 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:CommonI18NServiceReturn a set of all CountryModels.- Specified by:
getAllCountriesin interfaceCommonI18NService- Returns:
- the countries
-
getAllCurrencies
public java.util.List<CurrencyModel> getAllCurrencies()
Description copied from interface:CommonI18NServiceReturn a set of allCurrencyModel.- Specified by:
getAllCurrenciesin interfaceCommonI18NService- Returns:
- the currencies
-
getAllLanguages
public java.util.List<LanguageModel> getAllLanguages()
Description copied from interface:CommonI18NServiceGets all languages.- Specified by:
getAllLanguagesin interfaceCommonI18NService- Returns:
- all languages in the system
-
getAllRegions
public java.util.List<RegionModel> getAllRegions()
Description copied from interface:CommonI18NServiceReturn a set of all RegionModel.- Specified by:
getAllRegionsin interfaceCommonI18NService- Returns:
- the regions
-
getBaseCurrency
public CurrencyModel getBaseCurrency()
Description copied from interface:CommonI18NServiceReturns the base currency (CurrencyModel.getBase()) of this system ornullif no base currency is set. There should be always one suchCurrencyin the hybris Platform. The base currency should be the most likely-to-us currency.- Specified by:
getBaseCurrencyin interfaceCommonI18NService- Returns:
- the base
CurrencyModelornullif no base currency is set
-
getCountry
public CountryModel getCountry(java.lang.String arg0)
Description copied from interface:CommonI18NServiceReturns a country by its isocode.- Specified by:
getCountryin interfaceCommonI18NService- Parameters:
arg0- the isocode- Returns:
- the country
-
getCurrency
public CurrencyModel getCurrency(java.lang.String arg0)
Description copied from interface:CommonI18NServiceReturns a currency by its code.- Specified by:
getCurrencyin interfaceCommonI18NService- Parameters:
arg0- the code- Returns:
- the currency
-
getCurrentCurrency
public CurrencyModel getCurrentCurrency()
Description copied from interface:CommonI18NServiceGets session currency.- Specified by:
getCurrentCurrencyin interfaceCommonI18NService- Returns:
- session currency or
nullif not set
-
getCurrentLanguage
public LanguageModel getCurrentLanguage()
Description copied from interface:CommonI18NServiceGets current session language.- Specified by:
getCurrentLanguagein interfaceCommonI18NService- Returns:
- current session language or null if not set
-
getLanguage
public LanguageModel getLanguage(java.lang.String arg0)
Description copied from interface:CommonI18NServiceGets the language for the given isocode.- Specified by:
getLanguagein 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:CommonI18NServiceReturns aLocaleaccording 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:
getLocaleForLanguagein interfaceCommonI18NService
-
getRegion
public RegionModel getRegion(CountryModel arg0, java.lang.String arg1)
Description copied from interface:CommonI18NServiceReturns a region by its isocode within the country.- Specified by:
getRegionin interfaceCommonI18NService- Parameters:
arg0- the country modelarg1- the region code- Returns:
- the region
-
roundCurrency
public double roundCurrency(double arg0, int arg1)Description copied from interface:CommonI18NServiceRounds a price value according to this currency's number of digits.- Specified by:
roundCurrencyin 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:CommonI18NServiceSets the current currency to the session.- Specified by:
setCurrentCurrencyin interfaceCommonI18NService- Parameters:
arg0- the new currency
-
setCurrentLanguage
public void setCurrentLanguage(LanguageModel arg0)
Description copied from interface:CommonI18NServiceSets the current language to the session.- Specified by:
setCurrentLanguagein interfaceCommonI18NService- Parameters:
arg0- the new language
-
getLocaleForIsoCode
public java.util.Locale getLocaleForIsoCode(java.lang.String isoCode)
Description copied from interface:CommonI18NServiceReturns aLocalefor ISO code.- Specified by:
getLocaleForIsoCodein interfaceCommonI18NService
-
-