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
,java.io.Serializable
public class C2LManager extends Manager
The manager for all items of this package, which offers methods to create and getItem
s of this package.- See Also:
JaloSession
,Cart
,Order
,Address
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
C2LManager.C2LCacheKey
protected static class
C2LManager.C2LManagerSerializableDTO
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Manager
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BEAN_NAME
-
Constructor Summary
Constructors Constructor Description C2LManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
checkBeforeItemRemoval(SessionContext ctx, Item item)
Deprecated.since ages - useRemoveInterceptor
instead.Country
createCountry(PK pkBase, java.lang.String isoCode)
Deprecated.since ages - use plainCountryModel
creation instead seecreateCountry(String)
, see also model saving exampleCountry
createCountry(java.lang.String isoCode)
Deprecated.since ages - use plainCountryModel
creation instead :Currency
createCurrency(PK pkBase, java.lang.String isoCode)
Deprecated.since ages - use plainCurrencyModel
creation instead seecreateCurrency(String)
see also model saving example.Currency
createCurrency(java.lang.String isoCode)
Deprecated.since ages - use plainCurrencyModel
creation instead :Language
createLanguage(PK pk, java.lang.String isoCode)
Deprecated.since ages - use plainLanguageModel
creation seecreateLanguage(String)
see also model saving example.Language
createLanguage(java.lang.String isoCode)
Deprecated.since ages - use plainLanguageModel
creation instead :Region
createRegion(PK pkBase, java.lang.String code, Country country)
Deprecated.since ages - use plainRegionModel
creation instead see also model saving example.Region
createRegion(java.lang.String code, Country country)
Deprecated.since ages - please useCountry.addNewRegion(String)
insteadjava.util.Set<Country>
getActiveCountries()
Deprecated.since ages - useCommonI18NService.getAllCountries()
instead.java.util.Set<Currency>
getActiveCurrencies()
Deprecated.since ages - useCommonI18NService.getAllCurrencies()
instead.java.util.Set<Language>
getActiveLanguages()
Deprecated.since ages - useCommonI18NService.getAllLanguages()
instead.java.util.Set<Region>
getActiveRegions()
Deprecated.since ages - useCommonI18NService.getAllRegions()
instead.java.util.Set<Country>
getAllCountries()
Deprecated.since ages - useCommonI18NService.getAllCountries()
instead.java.util.Set<Currency>
getAllCurrencies()
Deprecated.since ages - useCommonI18NService.getAllCurrencies()
instead.java.util.Set<Language>
getAllLanguages()
Deprecated.since ages - useCommonI18NService.getAllLanguages()
instead.java.util.Set<Region>
getAllRegions()
Deprecated.since ages - useCommonI18NService.getAllRegions()
instead.Currency
getBaseCurrency()
Deprecated.since ages - useCommonI18NService.getBaseCurrency()
instead.Country
getCountryByIsoCode(java.lang.String iso)
Deprecated.since ages - useCommonI18NService.getCountry(String)
instead.Currency
getCurrencyByIsoCode(java.lang.String iso)
Deprecated.since ages - useCommonI18NService.getCurrency(String)
instead.Currency
getDefaultCurrencyForTenant(Tenant t)
Language
getDefaultLanguageForTenant(Tenant t)
static C2LManager
getInstance()
Language
getLanguageByIsoCode(java.lang.String iso)
Deprecated.since ages - useCommonI18NService.getLanguage(String)
instead.Region
getRegionByCode(Country country, java.lang.String code)
Deprecated.since ages - useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)
instead.Region
getRegionByCode(java.lang.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.java.util.Collection<Region>
getRegions(Country country)
Deprecated.since ages - useCountryModel.getRegions()
instead.java.util.Collection<Region>
getRegionsByCode(java.lang.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.void
init()
called once for each tenant, so this method fits best to perform some initialization stuffprotected void
notifyItemRemoval(SessionContext ctx, Item item)
TODO improve API doc Is called just before a item is being removed.void
setBaseCurrency(Currency currency)
Deprecated.since ages - use {Currency#setBase()} instead.java.lang.Object
writeReplace()
-
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 Detail
-
BEAN_NAME
public static final java.lang.String BEAN_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static C2LManager getInstance()
- Returns:
- instance of this manager
-
init
public void init()
Description copied from class:Manager
called once for each tenant, so this method fits best to perform some initialization stuff
-
checkBeforeItemRemoval
@Deprecated protected void checkBeforeItemRemoval(SessionContext ctx, Item item) throws ConsistencyCheckException
Deprecated.since ages - useRemoveInterceptor
instead.Superclass method overridden to avoid call to EJB layer. Disallows removal of:- the last active currency,
- the base currency,
- any active language.
- Overrides:
checkBeforeItemRemoval
in 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 public Language getLanguageByIsoCode(java.lang.String iso) throws JaloItemNotFoundException
Deprecated.since ages - useCommonI18NService.getLanguage(String)
instead.Returns theLanguage
with the specified iso code. If there exists noLanguage
with the specified iso code aJaloItemNotFoundException
is thrown.- Parameters:
iso
- the isocode of the searchedLanguage
- Returns:
- the
Language
with the specified isocode - Throws:
JaloItemNotFoundException
- if there exists noLanguage
with the specified iso code
-
createLanguage
@Deprecated public Language createLanguage(java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainLanguageModel
creation instead :final LanguageModel lmodel = modelService.create(LanguageModel.class); lmodel.setIsocode("tinyRed"); modelService.save(lmodel);
see also model saving example.
Creates a newLanguage
with the specified iso code.- Parameters:
isoCode
- the iso code of the newLanguage
- Returns:
- the
Language
with the specified iso code - Throws:
ConsistencyCheckException
- if there already exists a language with the specified iso code
-
createLanguage
@Deprecated public Language createLanguage(PK pk, java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainLanguageModel
creation seecreateLanguage(String)
see also model saving example.Creates a newLanguage
with the specified iso code and pk.- Parameters:
pk
- the primary key of the newLanguage
isoCode
- the iso code of the newLanguage
- Returns:
- the
Language
with the specified iso code - Throws:
ConsistencyCheckException
- if there already exists a language with the specified iso code
-
getAllLanguages
@Deprecated public java.util.Set<Language> getAllLanguages()
Deprecated.since ages - useCommonI18NService.getAllLanguages()
instead.Returns aSet
of all languages.- Returns:
- a
Set
of all languages
-
getActiveLanguages
@Deprecated public java.util.Set<Language> getActiveLanguages()
Deprecated.since ages - useCommonI18NService.getAllLanguages()
instead.Returns aCollection
of 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
Collection
of all active languages
-
getCurrencyByIsoCode
@Deprecated public Currency getCurrencyByIsoCode(java.lang.String iso) throws JaloItemNotFoundException
Deprecated.since ages - useCommonI18NService.getCurrency(String)
instead.Returns theCurrency
with the specified iso code. If there exists noCurrency
with the specified iso code aJaloItemNotFoundException
is thrown.- Parameters:
iso
- the iso code of the searchedCurrency
- Returns:
- the
Currency
with the specified iso code - Throws:
JaloItemNotFoundException
- if there exists noCurrency
with the specified iso code
-
createCurrency
@Deprecated public Currency createCurrency(java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainCurrencyModel
creation instead :final CurrencyModel model = modelService.create(CurrencyModel.class); model.setIsocode("tinyRed"); modelService.save(model);
see also model saving example
Creates a newCurrency
with the specified iso code.- Parameters:
isoCode
- the iso code of the newCurrency
- Returns:
- the new
Currency
- Throws:
ConsistencyCheckException
- if there already exists aCurrency
with this iso code
-
createCurrency
@Deprecated public Currency createCurrency(PK pkBase, java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainCurrencyModel
creation instead seecreateCurrency(String)
see also model saving example.Creates a newCurrency
with the specified iso code.- Parameters:
pkBase
- thePK
of the newCurrency
isoCode
- the iso code of the newCurrency
- Returns:
- the new
Currency
- Throws:
ConsistencyCheckException
- if there already exists aCurrency
with this iso code
-
getAllCurrencies
@Deprecated public java.util.Set<Currency> getAllCurrencies()
Deprecated.since ages - useCommonI18NService.getAllCurrencies()
instead.Returns aCollection
of all currencies.- Returns:
- a
Collection
of all currencies
-
getActiveCurrencies
@Deprecated public java.util.Set<Currency> getActiveCurrencies()
Deprecated.since ages - useCommonI18NService.getAllCurrencies()
instead.Returns aCollection
of 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
Collection
of all active currencies
-
getBaseCurrency
@Deprecated public Currency getBaseCurrency()
Deprecated.since ages - useCommonI18NService.getBaseCurrency()
instead.Returns the base currency (GeneratedCurrency.isBase()
) 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.- Returns:
- the base
Currency
orNull
if no base currency is set
-
setBaseCurrency
@Deprecated public void setBaseCurrency(Currency currency)
Deprecated.since ages - use {Currency#setBase()} instead.Sets the specifiedCurrency
as the base currency of this system.- Parameters:
currency
- the new base currency- See Also:
getBaseCurrency()
-
getCountryByIsoCode
@Deprecated public Country getCountryByIsoCode(java.lang.String iso) throws JaloItemNotFoundException
Deprecated.since ages - useCommonI18NService.getCountry(String)
instead.Returns theCountry
with the specified isocode.- Parameters:
iso
- the isocode of the searchedCountry
- Returns:
- the
Country
with the specified isocode - Throws:
JaloItemNotFoundException
- if noCountry
with the specified isocode exists
-
createCountry
@Deprecated public Country createCountry(java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainCountryModel
creation instead :final CountryModel model = modelService.create(CountryModel.class); model.setIsocode("tinyRed"); modelService.save(model);
see also model saving example.
Creates a newCountry
with the specified isocode. The isocode of theCountry
must 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 public Country createCountry(PK pkBase, java.lang.String isoCode) throws ConsistencyCheckException
Deprecated.since ages - use plainCountryModel
creation instead seecreateCountry(String)
, see also model saving exampleCreates a newCountry
with the specified isocode. The isocode of theCountry
must be unique within the countries.- Parameters:
pkBase
- the primary key of the newCountry
isoCode
- the isocode of the new country- Returns:
- the new
Country
- Throws:
ConsistencyCheckException
- if the isocode is not unique within the countries
-
getAllCountries
@Deprecated public java.util.Set<Country> getAllCountries()
Deprecated.since ages - useCommonI18NService.getAllCountries()
instead.Returns aCollection
of all countries.- Returns:
- a
Collection
of all countries
-
getActiveCountries
@Deprecated public java.util.Set<Country> getActiveCountries()
Deprecated.since ages - useCommonI18NService.getAllCountries()
instead.Returns aCollection
of all active countries.- Returns:
- a
Collection
of all active countries.
-
getRegionByCode
@Deprecated public Region getRegionByCode(java.lang.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 theRegion
with the specified code. If there exists noRegion
with the specified code, aJaloItemNotFoundException is thrown. If there are more than one
Region
with the specified code, aJaloSystemException
is thrown.- Parameters:
code
- the code of the searchedRegion
- Returns:
- the
Region
with the specified code - Throws:
JaloItemNotFoundException
- if there exists noRegion
with the specified codeJaloSystemException
- if there are more than oneRegion
with the specified code
-
getRegionsByCode
@Deprecated public java.util.Collection<Region> getRegionsByCode(java.lang.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.Returns aCollection
of regions which match the specified code code.- Parameters:
code
- the code of the searched regions- Returns:
- a
Collection
of regions which match the specified code code
-
getRegionByCode
@Deprecated public Region getRegionByCode(Country country, java.lang.String code) throws JaloItemNotFoundException
Deprecated.since ages - useCommonI18NService.getRegion(de.hybris.platform.core.model.c2l.CountryModel, String)
instead.Returns theRegion
with the specified code which is assigned to the specifiedCountry
. Throws aJaloItemNotFoundException
if no matchingRegion is found.
- Parameters:
country
- theCountry
, theRegion
should belong tocode
- the code of the searched region- Returns:
- the
Region
with the specified code which is assigned to the specifiedCountry
. - Throws:
JaloItemNotFoundException
- if no matchingRegion is found
-
createRegion
@Deprecated public Region createRegion(java.lang.String code, Country country) throws ConsistencyCheckException
Deprecated.since ages - please useCountry.addNewRegion(String)
insteadCreates a new region for the specifiedCountry
with the given code.- Parameters:
code
- the code of the newRegion
country
- theCountry
the newRegion
belongs to- Returns:
- the new
Region
- Throws:
ConsistencyCheckException
- if aRegion
with the specified code already exists for the specifiedCountry
-
createRegion
@Deprecated public Region createRegion(PK pkBase, java.lang.String code, Country country) throws ConsistencyCheckException
Deprecated.since ages - use plainRegionModel
creation instead see also model saving example.Creates a new region for the specifiedCountry
with the given code.- Parameters:
pkBase
- the primary key of the newregion
. Must be unique.code
- the code of the newRegion
country
- theCountry
the newRegion
belongs to- Returns:
- the new
Region
- Throws:
ConsistencyCheckException
- if aRegion
with the specified code already exists for the specifiedCountry
-
getRegions
@Deprecated public java.util.Collection<Region> getRegions(Country country)
Deprecated.since ages - useCountryModel.getRegions()
instead.Returns aCollection
of all regions which are assigned to the specifiedCountry
.- Parameters:
country
- theCountry
whose regions should be returned- Returns:
- a
Collection
of all regions which are assigned to the specifiedCountry
-
getAllRegions
@Deprecated public java.util.Set<Region> getAllRegions()
Deprecated.since ages - useCommonI18NService.getAllRegions()
instead.Returns aCollection
of all regions, regardless whichCountry
they belong to.- Returns:
- a
Collection
of all regions, regardless whichCountry
they belong to
-
getActiveRegions
@Deprecated public java.util.Set<Region> getActiveRegions()
Deprecated.since ages - useCommonI18NService.getAllRegions()
instead.Returns aCollection of all active regions, regardless which
Country
they belong to.- Returns:
- a
Collection of all active regions, regardless which
Country
they belong to
-
writeReplace
public java.lang.Object writeReplace() throws java.io.ObjectStreamException
- Specified by:
writeReplace
in classManager
- Throws:
java.io.ObjectStreamException
-
notifyItemRemoval
protected void notifyItemRemoval(SessionContext ctx, Item item)
Description copied from class:Manager
TODO 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:
notifyItemRemoval
in classManager
- Parameters:
ctx
- the currency session contextitem
- the item which is going to be removed
-
-