Package de.hybris.platform.catalog.impl
Class DefaultCatalogVersionService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.catalog.impl.DefaultCatalogVersionService
-
- All Implemented Interfaces:
CatalogVersionService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultCatalogVersionService extends AbstractBusinessService implements CatalogVersionService
Service provides basic catalog version oriented functionality. Allows fetching catalog version information, managing session catalog versions and determining whether user is eligible for read/write operations within the given catalog version.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCatalogVersionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSessionCatalogVersion(CatalogVersionModel catalogVersion)Adds theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameto the current active Session CatalogVersions.booleancanRead(CatalogVersionModel catalogVersion, UserModel user)Determines whether user can read from given catalogVersion.booleancanWrite(CatalogVersionModel catalogVersion, UserModel user)Determines whether user can write to given catalogVersion.java.util.Collection<DuplicatedItemIdentifier>findDuplicatedIds(CatalogVersionModel catalogVersionModel)Returs collection of duplicated items in given catalog.java.util.Collection<CatalogVersionModel>getAllCatalogVersions()Returns all catalog versions defined in the system.<T extends CatalogVersionModel>
java.util.Collection<T>getAllCatalogVersionsOfType(java.lang.Class<T> versionType)Returns for the givenT(upper bound CatalogVersionModel) all catalog versions ofTdefined in the systemjava.util.Collection<CatalogVersionModel>getAllReadableCatalogVersions(PrincipalModel principal)Returns all readableCatalogVersionModels for the given principal.java.util.Collection<CatalogVersionModel>getAllWritableCatalogVersions(PrincipalModel principal)Returns all writableCatalogVersionModels for the given principal.CatalogVersionModelgetCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)CatalogVersionModelgetSessionCatalogVersionForCatalog(java.lang.String catalogId)Returns theCatalogVersionModelin the session with the specifiedcatalogId.java.util.Collection<CatalogVersionModel>getSessionCatalogVersions()Returns a collection of theCatalogVersionModels which are activated for the current session.java.util.Collection<CatalogVersionModel>getSessionCatalogVersionsForCatalog(java.lang.String catalogId)Returns theCatalogVersionModels in the session of theCatalogModelmatching the specifiedcatalogId.voidsetCatalogVersionDao(CatalogVersionDao catalogVersionDao)voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService)voidsetSessionCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)Sets theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameas the active CatalogVersion of the current session.voidsetSessionCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions)Sets the specified collection ofCatalogVersionModels as the active CatalogVersions of the current session.voidsetUserService(UserService userService)-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
setSessionCatalogVersion
public void setSessionCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)Description copied from interface:CatalogVersionServiceSets theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameas the active CatalogVersion of the current session. Previously set active CatalogVersions are replaced.- Specified by:
setSessionCatalogVersionin interfaceCatalogVersionService- Parameters:
catalogId- the id of the Catalog the CatalogVersion belongs tocatalogVersionName- the name of the Catalog version
-
setSessionCatalogVersions
public void setSessionCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions)
Description copied from interface:CatalogVersionServiceSets the specified collection ofCatalogVersionModels as the active CatalogVersions of the current session. The previous active session catalog versions are replaced.- Specified by:
setSessionCatalogVersionsin interfaceCatalogVersionService- Parameters:
catalogVersions- the catalogVersions to be set as active session CatalogVersions
-
getSessionCatalogVersions
public java.util.Collection<CatalogVersionModel> getSessionCatalogVersions()
Description copied from interface:CatalogVersionServiceReturns a collection of theCatalogVersionModels which are activated for the current session.- Specified by:
getSessionCatalogVersionsin interfaceCatalogVersionService- Returns:
- an empty collection if no active catalog versions for the current session were found.
-
addSessionCatalogVersion
public void addSessionCatalogVersion(CatalogVersionModel catalogVersion)
Description copied from interface:CatalogVersionServiceAdds theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameto the current active Session CatalogVersions.- Specified by:
addSessionCatalogVersionin interfaceCatalogVersionService- Parameters:
catalogVersion- CatalogVersion to add
-
getCatalogVersion
public CatalogVersionModel getCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)
Description copied from interface:CatalogVersionService- Specified by:
getCatalogVersionin interfaceCatalogVersionService- Parameters:
catalogId- the id for the catalogcatalogVersionName- the version string for the catalog version- Returns:
- the CatalogVersion with the specified catalog id and version
-
getSessionCatalogVersionForCatalog
public CatalogVersionModel getSessionCatalogVersionForCatalog(java.lang.String catalogId)
Description copied from interface:CatalogVersionServiceReturns theCatalogVersionModelin the session with the specifiedcatalogId. This method expects only one catalog version per catalog in the session, which is true for majority of cases. If this is not the case, theAmbiguousIdentifierExceptionwill be thrown.- Specified by:
getSessionCatalogVersionForCatalogin interfaceCatalogVersionService- Parameters:
catalogId- the Catalog id the CatalogVersion belongs to- Returns:
- the catalog version in the session with the specified
catalogId, ornullif no such catalog version was found.
-
getSessionCatalogVersionsForCatalog
public java.util.Collection<CatalogVersionModel> getSessionCatalogVersionsForCatalog(java.lang.String catalogId)
Description copied from interface:CatalogVersionServiceReturns theCatalogVersionModels in the session of theCatalogModelmatching the specifiedcatalogId.- Specified by:
getSessionCatalogVersionsForCatalogin interfaceCatalogVersionService- Parameters:
catalogId- the Catalog id the CatalogVersion belongs to- Returns:
- the collection of
CatalogVersionModels or empty collection if no matching catalog versions were found in the session.
-
canRead
public boolean canRead(CatalogVersionModel catalogVersion, UserModel user)
Description copied from interface:CatalogVersionServiceDetermines whether user can read from given catalogVersion.- Specified by:
canReadin interfaceCatalogVersionService- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
canWrite
public boolean canWrite(CatalogVersionModel catalogVersion, UserModel user)
Description copied from interface:CatalogVersionServiceDetermines whether user can write to given catalogVersion.- Specified by:
canWritein interfaceCatalogVersionService- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
getAllReadableCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllReadableCatalogVersions(PrincipalModel principal)
Description copied from interface:CatalogVersionServiceReturns all readableCatalogVersionModels for the given principal.- Specified by:
getAllReadableCatalogVersionsin interfaceCatalogVersionService- Parameters:
principal- target principal
-
getAllWritableCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllWritableCatalogVersions(PrincipalModel principal)
Description copied from interface:CatalogVersionServiceReturns all writableCatalogVersionModels for the given principal.- Specified by:
getAllWritableCatalogVersionsin interfaceCatalogVersionService- Parameters:
principal- target principal
-
getAllCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllCatalogVersions()
Description copied from interface:CatalogVersionServiceReturns all catalog versions defined in the system. Return empty collection if none was found.- Specified by:
getAllCatalogVersionsin interfaceCatalogVersionService
-
setCatalogVersionDao
public void setCatalogVersionDao(CatalogVersionDao catalogVersionDao)
-
getAllCatalogVersionsOfType
public <T extends CatalogVersionModel> java.util.Collection<T> getAllCatalogVersionsOfType(java.lang.Class<T> versionType)
Description copied from interface:CatalogVersionServiceReturns for the givenT(upper bound CatalogVersionModel) all catalog versions ofTdefined in the system- Specified by:
getAllCatalogVersionsOfTypein interfaceCatalogVersionService- Type Parameters:
T- This could be aClassificationSystemVersionModelor aCatalogVersionModel- Returns:
- an empty collection if no
CatalogVersionModels orClassificationSystemVersionModelwere found.
-
findDuplicatedIds
public java.util.Collection<DuplicatedItemIdentifier> findDuplicatedIds(CatalogVersionModel catalogVersionModel)
Description copied from interface:CatalogVersionServiceReturs collection of duplicated items in given catalog.- Specified by:
findDuplicatedIdsin interfaceCatalogVersionService- Returns:
-
setUserService
public void setUserService(UserService userService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
-