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 void
addSessionCatalogVersion(CatalogVersionModel catalogVersion)
Adds theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
to the current active Session CatalogVersions.boolean
canRead(CatalogVersionModel catalogVersion, UserModel user)
Determines whether user can read from given catalogVersion.boolean
canWrite(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 ofT
defined in the systemjava.util.Collection<CatalogVersionModel>
getAllReadableCatalogVersions(PrincipalModel principal)
Returns all readableCatalogVersionModel
s for the given principal.java.util.Collection<CatalogVersionModel>
getAllWritableCatalogVersions(PrincipalModel principal)
Returns all writableCatalogVersionModel
s for the given principal.CatalogVersionModel
getCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)
CatalogVersionModel
getSessionCatalogVersionForCatalog(java.lang.String catalogId)
Returns theCatalogVersionModel
in the session with the specifiedcatalogId
.java.util.Collection<CatalogVersionModel>
getSessionCatalogVersions()
Returns a collection of theCatalogVersionModel
s which are activated for the current session.java.util.Collection<CatalogVersionModel>
getSessionCatalogVersionsForCatalog(java.lang.String catalogId)
Returns theCatalogVersionModel
s in the session of theCatalogModel
matching the specifiedcatalogId
.void
setCatalogVersionDao(CatalogVersionDao catalogVersionDao)
void
setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
void
setSessionCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)
Sets theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
as the active CatalogVersion of the current session.void
setSessionCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions)
Sets the specified collection ofCatalogVersionModel
s as the active CatalogVersions of the current session.void
setUserService(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:CatalogVersionService
Sets theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
as the active CatalogVersion of the current session. Previously set active CatalogVersions are replaced.- Specified by:
setSessionCatalogVersion
in 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:CatalogVersionService
Sets the specified collection ofCatalogVersionModel
s as the active CatalogVersions of the current session. The previous active session catalog versions are replaced.- Specified by:
setSessionCatalogVersions
in interfaceCatalogVersionService
- Parameters:
catalogVersions
- the catalogVersions to be set as active session CatalogVersions
-
getSessionCatalogVersions
public java.util.Collection<CatalogVersionModel> getSessionCatalogVersions()
Description copied from interface:CatalogVersionService
Returns a collection of theCatalogVersionModel
s which are activated for the current session.- Specified by:
getSessionCatalogVersions
in 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:CatalogVersionService
Adds theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
to the current active Session CatalogVersions.- Specified by:
addSessionCatalogVersion
in 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:
getCatalogVersion
in 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:CatalogVersionService
Returns theCatalogVersionModel
in 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, theAmbiguousIdentifierException
will be thrown.- Specified by:
getSessionCatalogVersionForCatalog
in interfaceCatalogVersionService
- Parameters:
catalogId
- the Catalog id the CatalogVersion belongs to- Returns:
- the catalog version in the session with the specified
catalogId
, ornull
if no such catalog version was found.
-
getSessionCatalogVersionsForCatalog
public java.util.Collection<CatalogVersionModel> getSessionCatalogVersionsForCatalog(java.lang.String catalogId)
Description copied from interface:CatalogVersionService
Returns theCatalogVersionModel
s in the session of theCatalogModel
matching the specifiedcatalogId
.- Specified by:
getSessionCatalogVersionsForCatalog
in interfaceCatalogVersionService
- Parameters:
catalogId
- the Catalog id the CatalogVersion belongs to- Returns:
- the collection of
CatalogVersionModel
s 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:CatalogVersionService
Determines whether user can read from given catalogVersion.- Specified by:
canRead
in interfaceCatalogVersionService
- Parameters:
catalogVersion
- targetCatalogVersionModel
user
- targetUserModel
-
canWrite
public boolean canWrite(CatalogVersionModel catalogVersion, UserModel user)
Description copied from interface:CatalogVersionService
Determines whether user can write to given catalogVersion.- Specified by:
canWrite
in interfaceCatalogVersionService
- Parameters:
catalogVersion
- targetCatalogVersionModel
user
- targetUserModel
-
getAllReadableCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllReadableCatalogVersions(PrincipalModel principal)
Description copied from interface:CatalogVersionService
Returns all readableCatalogVersionModel
s for the given principal.- Specified by:
getAllReadableCatalogVersions
in interfaceCatalogVersionService
- Parameters:
principal
- target principal
-
getAllWritableCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllWritableCatalogVersions(PrincipalModel principal)
Description copied from interface:CatalogVersionService
Returns all writableCatalogVersionModel
s for the given principal.- Specified by:
getAllWritableCatalogVersions
in interfaceCatalogVersionService
- Parameters:
principal
- target principal
-
getAllCatalogVersions
public java.util.Collection<CatalogVersionModel> getAllCatalogVersions()
Description copied from interface:CatalogVersionService
Returns all catalog versions defined in the system. Return empty collection if none was found.- Specified by:
getAllCatalogVersions
in 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:CatalogVersionService
Returns for the givenT
(upper bound CatalogVersionModel) all catalog versions ofT
defined in the system- Specified by:
getAllCatalogVersionsOfType
in interfaceCatalogVersionService
- Type Parameters:
T
- This could be aClassificationSystemVersionModel
or aCatalogVersionModel
- Returns:
- an empty collection if no
CatalogVersionModel
s orClassificationSystemVersionModel
were found.
-
findDuplicatedIds
public java.util.Collection<DuplicatedItemIdentifier> findDuplicatedIds(CatalogVersionModel catalogVersionModel)
Description copied from interface:CatalogVersionService
Returs collection of duplicated items in given catalog.- Specified by:
findDuplicatedIds
in interfaceCatalogVersionService
- Returns:
-
setUserService
public void setUserService(UserService userService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
-