Package de.hybris.platform.catalog
Interface CatalogVersionService
- All Known Implementing Classes:
DefaultCatalogVersionService
public interface 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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddSessionCatalogVersion(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.findDuplicatedIds(CatalogVersionModel catalogVersionModel) Returs collection of duplicated items in given catalog.Returns all catalog versions defined in the system.<T extends CatalogVersionModel>
Collection<T>getAllCatalogVersionsOfType(Class<T> versionType) Returns for the givenT(upper bound CatalogVersionModel) all catalog versions ofTdefined in the systemgetAllReadableCatalogVersions(PrincipalModel principal) Returns all readableCatalogVersionModels for the given principal.getAllWritableCatalogVersions(PrincipalModel principal) Returns all writableCatalogVersionModels for the given principal.getCatalogVersion(String catalogId, String catalogVersionName) getSessionCatalogVersionForCatalog(String catalogId) Returns theCatalogVersionModelin the session with the specifiedcatalogId.Returns a collection of theCatalogVersionModels which are activated for the current session.getSessionCatalogVersionsForCatalog(String catalogId) Returns theCatalogVersionModels in the session of theCatalogModelmatching the specifiedcatalogId.voidsetSessionCatalogVersion(String catalogId, String catalogVersionName) Sets theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameas the active CatalogVersion of the current session.voidsetSessionCatalogVersions(Collection<CatalogVersionModel> catalogVersions) Sets the specified collection ofCatalogVersionModels as the active CatalogVersions of the current session.
-
Method Details
-
setSessionCatalogVersion
Sets theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameas the active CatalogVersion of the current session. Previously set active CatalogVersions are replaced.- Parameters:
catalogId- the id of the Catalog the CatalogVersion belongs tocatalogVersionName- the name of the Catalog version- Throws:
UnknownIdentifierException- if no CatalogVersion with the specified catalog id and version existsAmbiguousIdentifierException- if more than one CatalogVersion is found with the specified catalog id and versionIllegalArgumentException- ifcatalogIdorcatalogVersionNameisnull
-
setSessionCatalogVersions
Sets the specified collection ofCatalogVersionModels as the active CatalogVersions of the current session. The previous active session catalog versions are replaced.- Parameters:
catalogVersions- the catalogVersions to be set as active session CatalogVersions- Throws:
IllegalArgumentException- if catalogVersions isnull
-
addSessionCatalogVersion
Adds theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameto the current active Session CatalogVersions.- Parameters:
catalogVersion- CatalogVersion to add- Throws:
IllegalArgumentException- ifcatalogVersionisnull
-
getSessionCatalogVersions
Collection<CatalogVersionModel> getSessionCatalogVersions()Returns a collection of theCatalogVersionModels which are activated for the current session.- Returns:
- an empty collection if no active catalog versions for the current session were found.
-
getCatalogVersion
- Parameters:
catalogId- the id for the catalogcatalogVersionName- the version string for the catalog version- Returns:
- the CatalogVersion with the specified catalog id and version
- Throws:
UnknownIdentifierException- if no CatalogVersion with the specified catalog id and version existsAmbiguousIdentifierException- if more than one CatalogVersion is found with the specified catalog id and versionIllegalArgumentException- ifcatalogIdorcatalogVersionNameisnull
-
getSessionCatalogVersionForCatalog
Returns 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.- 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. - Throws:
IllegalArgumentException- ifcatalogIdis nullAmbiguousIdentifierException- if more than oneCatalogVersionModelcan be found in the session with the specifiedcatalogId
-
getSessionCatalogVersionsForCatalog
Returns theCatalogVersionModels in the session of theCatalogModelmatching the specifiedcatalogId.- 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. - Throws:
IllegalArgumentException- ifcatalogIdis null
-
canRead
Determines whether user can read from given catalogVersion.- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
canWrite
Determines whether user can write to given catalogVersion.- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
getAllWritableCatalogVersions
Returns all writableCatalogVersionModels for the given principal.- Parameters:
principal- target principal
-
getAllReadableCatalogVersions
Returns all readableCatalogVersionModels for the given principal.- Parameters:
principal- target principal
-
getAllCatalogVersions
Collection<CatalogVersionModel> getAllCatalogVersions()Returns all catalog versions defined in the system. Return empty collection if none was found. -
getAllCatalogVersionsOfType
Returns for the givenT(upper bound CatalogVersionModel) all catalog versions ofTdefined in the system- Type Parameters:
T- This could be aClassificationSystemVersionModelor aCatalogVersionModel- Returns:
- an empty collection if no
CatalogVersionModels orClassificationSystemVersionModelwere found. - Throws:
IllegalArgumentException- ifversionTypeisnull
-
findDuplicatedIds
Returs collection of duplicated items in given catalog.- Parameters:
catalogVersionModel-- Returns:
-