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
All Methods Instance Methods Abstract 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
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.
-
-
-
Method Detail
-
setSessionCatalogVersion
void setSessionCatalogVersion(java.lang.String catalogId, java.lang.String catalogVersionName)
Sets theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
as 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
- ifcatalogId
orcatalogVersionName
isnull
-
setSessionCatalogVersions
void setSessionCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions)
Sets the specified collection ofCatalogVersionModel
s 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 theCatalogVersionModel
specified bycatalogId
andcatalogVersionName
to the current active Session CatalogVersions.- Parameters:
catalogVersion
- CatalogVersion to add- Throws:
java.lang.IllegalArgumentException
- ifcatalogVersion
isnull
-
getSessionCatalogVersions
java.util.Collection<CatalogVersionModel> getSessionCatalogVersions()
Returns a collection of theCatalogVersionModel
s 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
- ifcatalogId
orcatalogVersionName
isnull
-
getSessionCatalogVersionForCatalog
CatalogVersionModel getSessionCatalogVersionForCatalog(java.lang.String catalogId)
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.- 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. - Throws:
java.lang.IllegalArgumentException
- ifcatalogId
is nullAmbiguousIdentifierException
- if more than oneCatalogVersionModel
can be found in the session with the specifiedcatalogId
-
getSessionCatalogVersionsForCatalog
java.util.Collection<CatalogVersionModel> getSessionCatalogVersionsForCatalog(java.lang.String catalogId)
Returns theCatalogVersionModel
s in the session of theCatalogModel
matching the specifiedcatalogId
.- 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. - Throws:
java.lang.IllegalArgumentException
- ifcatalogId
is null
-
canRead
boolean canRead(CatalogVersionModel catalogVersion, UserModel user)
Determines whether user can read from given catalogVersion.- Parameters:
catalogVersion
- targetCatalogVersionModel
user
- targetUserModel
-
canWrite
boolean canWrite(CatalogVersionModel catalogVersion, UserModel user)
Determines whether user can write to given catalogVersion.- Parameters:
catalogVersion
- targetCatalogVersionModel
user
- targetUserModel
-
getAllWritableCatalogVersions
java.util.Collection<CatalogVersionModel> getAllWritableCatalogVersions(PrincipalModel principal)
Returns all writableCatalogVersionModel
s for the given principal.- Parameters:
principal
- target principal
-
getAllReadableCatalogVersions
java.util.Collection<CatalogVersionModel> getAllReadableCatalogVersions(PrincipalModel principal)
Returns all readableCatalogVersionModel
s 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 ofT
defined in the system- Type Parameters:
T
- This could be aClassificationSystemVersionModel
or aCatalogVersionModel
- Returns:
- an empty collection if no
CatalogVersionModel
s orClassificationSystemVersionModel
were found. - Throws:
java.lang.IllegalArgumentException
- ifversionType
isnull
-
findDuplicatedIds
java.util.Collection<DuplicatedItemIdentifier> findDuplicatedIds(CatalogVersionModel catalogVersionModel)
Returs collection of duplicated items in given catalog.- Parameters:
catalogVersionModel
-- Returns:
-
-