Package de.hybris.platform.jalo.c2l
Class C2LManager
java.lang.Object
de.hybris.platform.jalo.Manager
de.hybris.platform.jalo.c2l.C2LManager
- All Implemented Interfaces:
ItemLifecycleListener,Serializable
The manager for all items of this package, which offers methods to create and get
Items of this package.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static classNested classes/interfaces inherited from class de.hybris.platform.jalo.Manager
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckBeforeItemRemoval(SessionContext ctx, Item item) Deprecated.createCountry(PK pkBase, String isoCode) Deprecated.since ages - use plainCountryModelcreation instead seecreateCountry(String), see also model saving examplecreateCountry(String isoCode) Deprecated.since ages - use plainCountryModelcreation instead :createCurrency(PK pkBase, String isoCode) Deprecated.since ages - use plainCurrencyModelcreation instead seecreateCurrency(String)see also model saving example.createCurrency(String isoCode) Deprecated.since ages - use plainCurrencyModelcreation instead :createLanguage(PK pk, String isoCode) Deprecated.since ages - use plainLanguageModelcreation seecreateLanguage(String)see also model saving example.createLanguage(String isoCode) Deprecated.since ages - use plainLanguageModelcreation instead :createRegion(PK pkBase, String code, Country country) Deprecated.since ages - use plainRegionModelcreation instead see also model saving example.createRegion(String code, Country country) Deprecated.since ages - please useCountry.addNewRegion(String)insteadDeprecated.since ages - useCommonI18NService.getAllCountries()instead.Deprecated.since ages - useCommonI18NService.getAllCurrencies()instead.Deprecated.since ages - useCommonI18NService.getAllLanguages()instead.Deprecated.since ages - useCommonI18NService.getAllRegions()instead.Deprecated.since ages - useCommonI18NService.getAllCountries()instead.Deprecated.since ages - useCommonI18NService.getAllCurrencies()instead.Deprecated.since ages - useCommonI18NService.getAllLanguages()instead.Deprecated.since ages - useCommonI18NService.getAllRegions()instead.Deprecated.since ages - useCommonI18NService.getBaseCurrency()instead.Deprecated.since ages - useCommonI18NService.getCountry(String)instead.Deprecated.since ages - useCommonI18NService.getCurrency(String)instead.static C2LManagerDeprecated.since ages - useCommonI18NService.getLanguage(String)instead.getRegionByCode(Country country, String code) Deprecated.since ages - useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.getRegionByCode(String code) Deprecated.since ages - You should consider not using region data without its country context , in that case useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.getRegions(Country country) Deprecated.since ages - useCountryModel.getRegions()instead.getRegionsByCode(String code) Deprecated.since ages - You should consider not using region data without its country context, in that useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.voidinit()called once for each tenant, so this method fits best to perform some initialization stuffprotected voidnotifyItemRemoval(SessionContext ctx, Item item) TODO improve API doc Is called just before a item is being removed.voidsetBaseCurrency(Currency currency) Deprecated.since ages - use {Currency#setBase()} instead.Methods inherited from class de.hybris.platform.jalo.Manager
afterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemote, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, setAttribute, setTenant, setTransientObject, wrap
-
Field Details
-
BEAN_NAME
- See Also:
-
-
Constructor Details
-
C2LManager
public C2LManager()
-
-
Method Details
-
getInstance
- Returns:
- instance of this manager
-
init
public void init()Description copied from class:Managercalled once for each tenant, so this method fits best to perform some initialization stuff -
checkBeforeItemRemoval
@Deprecated(since="ages", forRemoval=false) protected void checkBeforeItemRemoval(SessionContext ctx, Item item) throws ConsistencyCheckException Deprecated.since ages - useRemoveInterceptorinstead.Superclass method overridden to avoid call to EJB layer. Disallows removal of:- the last active currency,
- the base currency,
- any active language.
- Overrides:
checkBeforeItemRemovalin classManager- Parameters:
ctx- the current session contextitem- the item which should be removed- Throws:
ConsistencyCheckException- thrown to abort removal due to consistency errors- Since:
- 2.10
-
getLanguageByIsoCode
@Deprecated(since="ages", forRemoval=false) public Language getLanguageByIsoCode(String iso) throws JaloItemNotFoundException Deprecated.since ages - useCommonI18NService.getLanguage(String)instead.Returns theLanguagewith the specified iso code. If there exists noLanguagewith the specified iso code aJaloItemNotFoundExceptionis thrown.- Parameters:
iso- the isocode of the searchedLanguage- Returns:
- the
Languagewith the specified isocode - Throws:
JaloItemNotFoundException- if there exists noLanguagewith the specified iso code
-
createLanguage
@Deprecated(since="ages", forRemoval=false) public Language createLanguage(String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainLanguageModelcreation instead :final LanguageModel lmodel = modelService.create(LanguageModel.class); lmodel.setIsocode("tinyRed"); modelService.save(lmodel);see also model saving example.
Creates a newLanguagewith the specified iso code.- Parameters:
isoCode- the iso code of the newLanguage- Returns:
- the
Languagewith the specified iso code - Throws:
ConsistencyCheckException- if there already exists a language with the specified iso code
-
createLanguage
@Deprecated(since="ages", forRemoval=false) public Language createLanguage(PK pk, String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainLanguageModelcreation seecreateLanguage(String)see also model saving example.Creates a newLanguagewith the specified iso code and pk.- Parameters:
pk- the primary key of the newLanguageisoCode- the iso code of the newLanguage- Returns:
- the
Languagewith the specified iso code - Throws:
ConsistencyCheckException- if there already exists a language with the specified iso code
-
getAllLanguages
Deprecated.since ages - useCommonI18NService.getAllLanguages()instead.Returns aSetof all languages.- Returns:
- a
Setof all languages
-
getActiveLanguages
Deprecated.since ages - useCommonI18NService.getAllLanguages()instead.Returns aCollectionof all active languages (GeneratedC2LItem.isActive()== true ). This is meant to provide a way to select only the languages which are to be shown in applications ( web ) even though a large number of them exists.- Returns:
- a
Collectionof all active languages
-
getDefaultLanguageForTenant
-
getDefaultCurrencyForTenant
-
getCurrencyByIsoCode
@Deprecated(since="ages", forRemoval=false) public Currency getCurrencyByIsoCode(String iso) throws JaloItemNotFoundException Deprecated.since ages - useCommonI18NService.getCurrency(String)instead.Returns theCurrencywith the specified iso code. If there exists noCurrencywith the specified iso code aJaloItemNotFoundExceptionis thrown.- Parameters:
iso- the iso code of the searchedCurrency- Returns:
- the
Currencywith the specified iso code - Throws:
JaloItemNotFoundException- if there exists noCurrencywith the specified iso code
-
createCurrency
@Deprecated(since="ages", forRemoval=false) public Currency createCurrency(String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainCurrencyModelcreation instead :final CurrencyModel model = modelService.create(CurrencyModel.class); model.setIsocode("tinyRed"); modelService.save(model);see also model saving example
Creates a newCurrencywith the specified iso code.- Parameters:
isoCode- the iso code of the newCurrency- Returns:
- the new
Currency - Throws:
ConsistencyCheckException- if there already exists aCurrencywith this iso code
-
createCurrency
@Deprecated(since="ages", forRemoval=false) public Currency createCurrency(PK pkBase, String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainCurrencyModelcreation instead seecreateCurrency(String)see also model saving example.Creates a newCurrencywith the specified iso code.- Parameters:
pkBase- thePKof the newCurrencyisoCode- the iso code of the newCurrency- Returns:
- the new
Currency - Throws:
ConsistencyCheckException- if there already exists aCurrencywith this iso code
-
getAllCurrencies
Deprecated.since ages - useCommonI18NService.getAllCurrencies()instead.Returns aCollectionof all currencies.- Returns:
- a
Collectionof all currencies
-
getActiveCurrencies
Deprecated.since ages - useCommonI18NService.getAllCurrencies()instead.Returns aCollectionof all active currencies (GeneratedC2LItem.isActive()== true ). This is meant to provide a way to select only the currencies which should be shown in applications ( web ) even though a larger number of them exists.- Returns:
- a
Collectionof all active currencies
-
getBaseCurrency
Deprecated.since ages - useCommonI18NService.getBaseCurrency()instead.Returns the base currency (GeneratedCurrency.isBase()) 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.- Returns:
- the base
CurrencyorNullif no base currency is set
-
setBaseCurrency
Deprecated.since ages - use {Currency#setBase()} instead.Sets the specifiedCurrencyas the base currency of this system.- Parameters:
currency- the new base currency- See Also:
-
getCountryByIsoCode
@Deprecated(since="ages", forRemoval=false) public Country getCountryByIsoCode(String iso) throws JaloItemNotFoundException Deprecated.since ages - useCommonI18NService.getCountry(String)instead.Returns theCountrywith the specified isocode.- Parameters:
iso- the isocode of the searchedCountry- Returns:
- the
Countrywith the specified isocode - Throws:
JaloItemNotFoundException- if noCountrywith the specified isocode exists
-
createCountry
@Deprecated(since="ages", forRemoval=false) public Country createCountry(String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainCountryModelcreation instead :final CountryModel model = modelService.create(CountryModel.class); model.setIsocode("tinyRed"); modelService.save(model);see also model saving example.
Creates a newCountrywith the specified isocode. The isocode of theCountrymust be unique within the countries.- Parameters:
isoCode- the isocode of the new country- Returns:
- the new
Country - Throws:
ConsistencyCheckException- if the isocode is not unique within the countries
-
createCountry
@Deprecated(since="ages", forRemoval=false) public Country createCountry(PK pkBase, String isoCode) throws ConsistencyCheckException Deprecated.since ages - use plainCountryModelcreation instead seecreateCountry(String), see also model saving exampleCreates a newCountrywith the specified isocode. The isocode of theCountrymust be unique within the countries.- Parameters:
pkBase- the primary key of the newCountryisoCode- the isocode of the new country- Returns:
- the new
Country - Throws:
ConsistencyCheckException- if the isocode is not unique within the countries
-
getAllCountries
Deprecated.since ages - useCommonI18NService.getAllCountries()instead.Returns aCollectionof all countries.- Returns:
- a
Collectionof all countries
-
getActiveCountries
Deprecated.since ages - useCommonI18NService.getAllCountries()instead.Returns aCollectionof all active countries.- Returns:
- a
Collectionof all active countries.
-
getRegionByCode
@Deprecated(since="ages", forRemoval=false) public Region getRegionByCode(String code) throws JaloItemNotFoundException, JaloSystemException Deprecated.since ages - You should consider not using region data without its country context , in that case useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.Returns theRegionwith the specified code. If there exists noRegionwith the specified code, aJaloItemNotFoundException is thrown. If there are more than oneRegionwith the specified code, aJaloSystemExceptionis thrown.- Parameters:
code- the code of the searchedRegion- Returns:
- the
Regionwith the specified code - Throws:
JaloItemNotFoundException- if there exists noRegionwith the specified codeJaloSystemException- if there are more than oneRegionwith the specified code
-
getRegionsByCode
Deprecated.since ages - You should consider not using region data without its country context, in that useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.Returns aCollectionof regions which match the specified code code.- Parameters:
code- the code of the searched regions- Returns:
- a
Collectionof regions which match the specified code code
-
getRegionByCode
@Deprecated(since="ages", forRemoval=false) public Region getRegionByCode(Country country, String code) throws JaloItemNotFoundException Deprecated.since ages - useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)instead.Returns theRegionwith the specified code which is assigned to the specifiedCountry. Throws aJaloItemNotFoundExceptionif no matchingRegion is found.- Parameters:
country- theCountry, theRegionshould belong tocode- the code of the searched region- Returns:
- the
Regionwith the specified code which is assigned to the specifiedCountry. - Throws:
JaloItemNotFoundException- if no matchingRegion is found
-
createRegion
@Deprecated(since="ages", forRemoval=false) public Region createRegion(String code, Country country) throws ConsistencyCheckException Deprecated.since ages - please useCountry.addNewRegion(String)insteadCreates a new region for the specifiedCountrywith the given code.- Parameters:
code- the code of the newRegioncountry- theCountrythe newRegionbelongs to- Returns:
- the new
Region - Throws:
ConsistencyCheckException- if aRegionwith the specified code already exists for the specifiedCountry
-
createRegion
@Deprecated(since="ages", forRemoval=false) public Region createRegion(PK pkBase, String code, Country country) throws ConsistencyCheckException Deprecated.since ages - use plainRegionModelcreation instead see also model saving example.Creates a new region for the specifiedCountrywith the given code.- Parameters:
pkBase- the primary key of the newregion. Must be unique.code- the code of the newRegioncountry- theCountrythe newRegionbelongs to- Returns:
- the new
Region - Throws:
ConsistencyCheckException- if aRegionwith the specified code already exists for the specifiedCountry
-
getRegions
Deprecated.since ages - useCountryModel.getRegions()instead.Returns aCollectionof all regions which are assigned to the specifiedCountry.- Parameters:
country- theCountrywhose regions should be returned- Returns:
- a
Collectionof all regions which are assigned to the specifiedCountry
-
getAllRegions
Deprecated.since ages - useCommonI18NService.getAllRegions()instead.Returns aCollectionof all regions, regardless whichCountrythey belong to.- Returns:
- a
Collectionof all regions, regardless whichCountrythey belong to
-
getActiveRegions
Deprecated.since ages - useCommonI18NService.getAllRegions()instead.Returns aCollection of all active regions, regardless whichCountrythey belong to.- Returns:
- a
Collection of all active regions, regardless whichCountrythey belong to
-
writeReplace
- Specified by:
writeReplacein classManager- Throws:
ObjectStreamException
-
notifyItemRemoval
Description copied from class:ManagerTODO improve API doc Is called just before a item is being removed. No exception should be thrown here. UseManager.checkBeforeItemRemoval(SessionContext, Item)instead.This method does nothing and may be overridden.
- Overrides:
notifyItemRemovalin classManager- Parameters:
ctx- the currency session contextitem- the item which is going to be removed
-
RemoveInterceptorinstead.