Package de.hybris.platform.catalog
Interface CatalogVersionService
-
- All Known Implementing Classes:
DefaultCatalogVersionService
public interface CatalogVersionServiceService 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
All Methods Instance Methods Abstract 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.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.
-
-
-
Method Detail
-
setSessionCatalogVersion
void setSessionCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)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 versionjava.lang.IllegalArgumentException- ifcatalogIdorcatalogVersionNameisnull
-
setSessionCatalogVersions
void setSessionCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions)
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:
java.lang.IllegalArgumentException- if catalogVersions isnull
-
addSessionCatalogVersion
void addSessionCatalogVersion(CatalogVersionModel catalogVersion)
Adds theCatalogVersionModelspecified bycatalogIdandcatalogVersionNameto the current active Session CatalogVersions.- Parameters:
catalogVersion- CatalogVersion to add- Throws:
java.lang.IllegalArgumentException- ifcatalogVersionisnull
-
getSessionCatalogVersions
java.util.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
CatalogVersionModel getCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)
- 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 versionjava.lang.IllegalArgumentException- ifcatalogIdorcatalogVersionNameisnull
-
getSessionCatalogVersionForCatalog
CatalogVersionModel getSessionCatalogVersionForCatalog(java.lang.String catalogId)
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:
java.lang.IllegalArgumentException- ifcatalogIdis nullAmbiguousIdentifierException- if more than oneCatalogVersionModelcan be found in the session with the specifiedcatalogId
-
getSessionCatalogVersionsForCatalog
java.util.Collection<CatalogVersionModel> getSessionCatalogVersionsForCatalog(java.lang.String catalogId)
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:
java.lang.IllegalArgumentException- ifcatalogIdis null
-
canRead
boolean canRead(CatalogVersionModel catalogVersion, UserModel user)
Determines whether user can read from given catalogVersion.- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
canWrite
boolean canWrite(CatalogVersionModel catalogVersion, UserModel user)
Determines whether user can write to given catalogVersion.- Parameters:
catalogVersion- targetCatalogVersionModeluser- targetUserModel
-
getAllWritableCatalogVersions
java.util.Collection<CatalogVersionModel> getAllWritableCatalogVersions(PrincipalModel principal)
Returns all writableCatalogVersionModels for the given principal.- Parameters:
principal- target principal
-
getAllReadableCatalogVersions
java.util.Collection<CatalogVersionModel> getAllReadableCatalogVersions(PrincipalModel principal)
Returns all readableCatalogVersionModels for the given principal.- Parameters:
principal- target principal
-
getAllCatalogVersions
java.util.Collection<CatalogVersionModel> getAllCatalogVersions()
Returns all catalog versions defined in the system. Return empty collection if none was found.
-
getAllCatalogVersionsOfType
<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 system- Type Parameters:
T- This could be aClassificationSystemVersionModelor aCatalogVersionModel- Returns:
- an empty collection if no
CatalogVersionModels orClassificationSystemVersionModelwere found. - Throws:
java.lang.IllegalArgumentException- ifversionTypeisnull
-
findDuplicatedIds
java.util.Collection<DuplicatedItemIdentifier> findDuplicatedIds(CatalogVersionModel catalogVersionModel)
Returs collection of duplicated items in given catalog.- Parameters:
catalogVersionModel-- Returns:
-
-