Class ObjectCollectionServiceImpl
- java.lang.Object
-
- de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
-
- de.hybris.platform.cockpit.services.impl.ObjectCollectionServiceImpl
-
- All Implemented Interfaces:
ObjectCollectionService
public class ObjectCollectionServiceImpl extends AbstractServiceImpl implements ObjectCollectionService
Default implementation of theObjectCollectionService
interface.
-
-
Field Summary
Fields Modifier and Type Field Description protected CockpitObjectAbstractCollectionDao
objectCollectionDao
-
Fields inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
modelService, typeService
-
-
Constructor Summary
Constructors Constructor Description ObjectCollectionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addReadUser(PrincipalModel user, ObjectCollection collection)
Allows given user to read given collection.int
addToCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)
void
addWriteUser(PrincipalModel user, ObjectCollection collection)
Allows given user to modify given collection.ObjectCollection
cloneCollection(ObjectCollection collection, UserModel user)
Clones the given collection and assigns just cloned collection to the given user.ObjectCollection
createCollection(java.lang.String qualifier, UserModel user)
Creates the collection for the given parameters.ObjectCollection
createSpecialCollection(java.lang.String qualifier, UserModel user)
Creates the special collection with the collection type set to null.ObjectCollection
createSpecialCollection(java.lang.String qualifier, UserModel user, HybrisEnumValue collectionType)
Creates the special collection for the given parameters.ObjectCollection
createSpecialCollection(java.lang.String qualifier, UserModel user, EnumerationValue collectionType)
Creates the special collection for the given parameters.protected CockpitCollectionService
getCockpitCollectionService()
java.util.List<ObjectCollection>
getCollections(UserModel user)
Gets the collections.java.util.List<ObjectCollection>
getCollectionsForUser(UserModel user)
Gets all collections for given user including the collections that given user has permission to read or write.int
getElementCount(ObjectCollection collection)
Gets the number of the elements in the given collection.java.util.List<TypedObject>
getElements(ObjectCollection collection, int start, int count)
Returns elements of the given object collection.protected EnumerationService
getEnumerationService()
protected CockpitObjectAbstractCollectionDao
getObjectCollectionDao()
protected java.util.Set<java.lang.String>
getObjectTypeFilterSet()
java.util.List<PrincipalModel>
getReadUsers(ObjectCollection collection)
Returns list of all users who are allowed to read given collection.java.util.List<PrincipalModel>
getReadUsersForCollection(ObjectCollection collection)
Returns list of all users who are allowed to read given collection.java.util.List<ObjectCollection>
getSpecialCollections(UserModel user)
Gets the special collections.java.util.List<ObjectCollection>
getSpecialCollections(UserModel user, java.lang.String collectionType)
Gets the special collections of the specified type that belongs to the given user.java.util.List<ObjectCollection>
getSpecialCollectionsForUser(UserModel user)
Gets the special collections for a given user.java.util.List<PrincipalModel>
getWriteUsers(ObjectCollection collection)
Returns list of all users who are allowed to modify given collection.java.util.List<PrincipalModel>
getWriteUsersForCollection(ObjectCollection collection)
Returns list of all users who are allowed to modify given collection.java.lang.Boolean
hasReadCollectionRight(PrincipalModel principal, ObjectCollection collection)
Returns information whether the user can read collection.java.lang.Boolean
hasWriteCollectionRight(PrincipalModel principal, ObjectCollection collection)
Returns information whether the user can modify collection.java.lang.Boolean
isCollectionOwner(PrincipalModel principal, ObjectCollection collection)
Checks if given collection belongs to the given user.java.lang.Boolean
isInCollection(TypedObject object, ObjectCollection collection)
Checks if the given element belongs to the specified collection.ObjectCollection
mapCollection(CockpitObjectAbstractCollection source)
Deprecated.since 6.3, usemapCollection(CockpitObjectAbstractCollectionModel)
insteadvoid
publishCollection(ObjectCollection collection)
Sets the collection's owner to null, so it can be accessed by any user.ObjectCollection
refreshCollection(ObjectCollection collection)
Removes all not existing items from the collection.void
removeCollection(ObjectCollection collection)
Removes the collection from the system.int
removeFromCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)
int
removeNullItemReferences(ObjectCollection collection)
Removes references to non-existing itemsvoid
removeReadUser(PrincipalModel user, ObjectCollection collection)
Disallow given user to read given collection.void
removeWriteUser(PrincipalModel user, ObjectCollection collection)
Disallow given user to modify given collection.void
renameCollection(ObjectCollection collection, java.lang.String label)
Renames the collection with the specified label.void
setCockpitCollectionService(CockpitCollectionService cockpitCollectionService)
void
setEnumerationService(EnumerationService enumerationService)
void
setObjectCollectionDao(CockpitObjectAbstractCollectionDao dao)
void
setObjectTypeFilterList(java.util.List<java.lang.String> objectTypeFilterList)
Sets the object type filter list.protected CockpitObjectAbstractCollection
unmapCollection(ObjectCollection collection)
Deprecated.since 6.3, useunmapToModel(ObjectCollection)
insteadprotected CockpitObjectAbstractCollectionModel
unmapToModel(ObjectCollection collection)
-
Methods inherited from class de.hybris.platform.cockpit.services.impl.AbstractServiceImpl
getEnum, getEnums, getLocalizedLabel, getLocalizedLabel, getModelService, getTypeService, setCockpitTypeService, setLabelResolver, setModelService
-
-
-
-
Field Detail
-
objectCollectionDao
protected CockpitObjectAbstractCollectionDao objectCollectionDao
-
-
Method Detail
-
addReadUser
public void addReadUser(PrincipalModel user, ObjectCollection collection)
Allows given user to read given collection.- Specified by:
addReadUser
in interfaceObjectCollectionService
- Parameters:
user
- to add read accesscollection
- to add read access
-
addToCollection
public int addToCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements) throws java.lang.IllegalStateException
- Specified by:
addToCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to which elements are to be addedelements
- the elements to add- Returns:
- the number of elements actually added to the collection.
- Throws:
java.lang.IllegalStateException
-
getElements
public java.util.List<TypedObject> getElements(ObjectCollection collection, int start, int count)
Returns elements of the given object collection.- Specified by:
getElements
in interfaceObjectCollectionService
- Parameters:
collection
- the object collection to search elements ofstart
- starting index of the searchcount
- max. count of elements to be found- Returns:
- elements of the given object collection according to given offset and count
-
removeNullItemReferences
public int removeNullItemReferences(ObjectCollection collection)
Removes references to non-existing items- Specified by:
removeNullItemReferences
in interfaceObjectCollectionService
- Parameters:
collection
- the object collection to search elements of- Returns:
- the number of removed references
-
getElementCount
public int getElementCount(ObjectCollection collection)
Gets the number of the elements in the given collection.- Specified by:
getElementCount
in interfaceObjectCollectionService
- Parameters:
collection
- the collection- Returns:
- the element count
-
addWriteUser
public void addWriteUser(PrincipalModel user, ObjectCollection collection)
Allows given user to modify given collection.- Specified by:
addWriteUser
in interfaceObjectCollectionService
- Parameters:
user
- to add write accesscollection
- to add write access
-
cloneCollection
public ObjectCollection cloneCollection(ObjectCollection collection, UserModel user)
Clones the given collection and assigns just cloned collection to the given user.- Specified by:
cloneCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to cloneuser
- the user - clonned collection owner- Returns:
- the just cloned collection
-
createCollection
public ObjectCollection createCollection(java.lang.String qualifier, UserModel user)
Creates the collection for the given parameters.- Specified by:
createCollection
in interfaceObjectCollectionService
- Parameters:
qualifier
- the qualifieruser
- the user that created collection will belong to- Returns:
- the created object collection
-
createSpecialCollection
public ObjectCollection createSpecialCollection(java.lang.String qualifier, UserModel user)
Creates the special collection with the collection type set to null.- Specified by:
createSpecialCollection
in interfaceObjectCollectionService
- Parameters:
qualifier
- the qualifieruser
- the user that created collection will belong to- Returns:
- the object collection
-
createSpecialCollection
public ObjectCollection createSpecialCollection(java.lang.String qualifier, UserModel user, EnumerationValue collectionType)
Description copied from interface:ObjectCollectionService
Creates the special collection for the given parameters.- Specified by:
createSpecialCollection
in interfaceObjectCollectionService
- Parameters:
qualifier
- the qualifieruser
- the user that created collection will belong tocollectionType
- the collection type (quickcollection, blacklist, clipboard, etc)- Returns:
- the object collection
-
createSpecialCollection
public ObjectCollection createSpecialCollection(java.lang.String qualifier, UserModel user, HybrisEnumValue collectionType)
Creates the special collection for the given parameters.- Specified by:
createSpecialCollection
in interfaceObjectCollectionService
- Parameters:
qualifier
- the qualifieruser
- the user that created collection will belong tocollectionType
- the collection type (quickcollection, blacklist, clipboard, etc)- Returns:
- the object collection
-
getCollections
public java.util.List<ObjectCollection> getCollections(UserModel user)
Description copied from interface:ObjectCollectionService
Gets the collections.- Specified by:
getCollections
in interfaceObjectCollectionService
- Parameters:
user
- the user- Returns:
- the collections
-
getReadUsers
public java.util.List<PrincipalModel> getReadUsers(ObjectCollection collection)
Description copied from interface:ObjectCollectionService
Returns list of all users who are allowed to read given collection.- Specified by:
getReadUsers
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to check read access- Returns:
- user list of the users that are allowed to read from the given collection
-
getSpecialCollections
public java.util.List<ObjectCollection> getSpecialCollections(UserModel user)
Description copied from interface:ObjectCollectionService
Gets the special collections.- Specified by:
getSpecialCollections
in interfaceObjectCollectionService
- Parameters:
user
- the user- Returns:
- the special collections
-
getSpecialCollections
public java.util.List<ObjectCollection> getSpecialCollections(UserModel user, java.lang.String collectionType)
Gets the special collections of the specified type that belongs to the given user.- Specified by:
getSpecialCollections
in interfaceObjectCollectionService
- Parameters:
user
- the usercollectionType
- the collection type- Returns:
- the special collections
-
getWriteUsers
public java.util.List<PrincipalModel> getWriteUsers(ObjectCollection collection)
Description copied from interface:ObjectCollectionService
Returns list of all users who are allowed to modify given collection.- Specified by:
getWriteUsers
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to check write access- Returns:
- user list of the users that are allowed to modify the given collection
-
isCollectionOwner
public java.lang.Boolean isCollectionOwner(PrincipalModel principal, ObjectCollection collection)
Checks if given collection belongs to the given user.- Specified by:
isCollectionOwner
in interfaceObjectCollectionService
- Parameters:
principal
- the principalcollection
- the collection- Returns:
- true if the user is collection owner
-
hasWriteCollectionRight
public java.lang.Boolean hasWriteCollectionRight(PrincipalModel principal, ObjectCollection collection)
Returns information whether the user can modify collection.- Specified by:
hasWriteCollectionRight
in interfaceObjectCollectionService
- Parameters:
principal
- the requested principalcollection
- the requested collection- Returns:
- the boolean
-
hasReadCollectionRight
public java.lang.Boolean hasReadCollectionRight(PrincipalModel principal, ObjectCollection collection)
Returns information whether the user can read collection.- Specified by:
hasReadCollectionRight
in interfaceObjectCollectionService
- Parameters:
principal
- the requested principalcollection
- the requested collection- Returns:
- the boolean
-
mapCollection
@Deprecated public ObjectCollection mapCollection(CockpitObjectAbstractCollection source)
Deprecated.since 6.3, usemapCollection(CockpitObjectAbstractCollectionModel)
instead
-
publishCollection
public void publishCollection(ObjectCollection collection)
Sets the collection's owner to null, so it can be accessed by any user.- Specified by:
publishCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to publish
-
refreshCollection
public ObjectCollection refreshCollection(ObjectCollection collection)
Removes all not existing items from the collection.- Specified by:
refreshCollection
in interfaceObjectCollectionService
- Parameters:
collection
- given collection- Returns:
- refreshed collection
-
isInCollection
public java.lang.Boolean isInCollection(TypedObject object, ObjectCollection collection)
Checks if the given element belongs to the specified collection.- Specified by:
isInCollection
in interfaceObjectCollectionService
- Parameters:
object
- the objectcollection
- the collection- Returns:
- true if given element is in the specified collection
-
removeCollection
public void removeCollection(ObjectCollection collection)
Removes the collection from the system.- Specified by:
removeCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to remove
-
removeFromCollection
public int removeFromCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)
- Specified by:
removeFromCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection from which elements are to be removedelements
- the elements to remove- Returns:
- the number of elements actually removed from the collection.
-
removeReadUser
public void removeReadUser(PrincipalModel user, ObjectCollection collection)
Disallow given user to read given collection.- Specified by:
removeReadUser
in interfaceObjectCollectionService
- Parameters:
user
- to remove read accesscollection
- to remove read access
-
removeWriteUser
public void removeWriteUser(PrincipalModel user, ObjectCollection collection)
Disallow given user to modify given collection.- Specified by:
removeWriteUser
in interfaceObjectCollectionService
- Parameters:
user
- to remove write accesscollection
- to remove write access
-
renameCollection
public void renameCollection(ObjectCollection collection, java.lang.String label)
Renames the collection with the specified label.- Specified by:
renameCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to renamelabel
- the new collection label
-
setObjectTypeFilterList
public void setObjectTypeFilterList(java.util.List<java.lang.String> objectTypeFilterList)
Sets the object type filter list.- Parameters:
objectTypeFilterList
- the objectTypeFilterList to set
-
getObjectTypeFilterSet
protected java.util.Set<java.lang.String> getObjectTypeFilterSet()
-
unmapCollection
@Deprecated protected CockpitObjectAbstractCollection unmapCollection(ObjectCollection collection)
Deprecated.since 6.3, useunmapToModel(ObjectCollection)
instead
-
unmapToModel
protected CockpitObjectAbstractCollectionModel unmapToModel(ObjectCollection collection)
-
setObjectCollectionDao
public void setObjectCollectionDao(CockpitObjectAbstractCollectionDao dao)
-
getObjectCollectionDao
protected CockpitObjectAbstractCollectionDao getObjectCollectionDao()
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
setEnumerationService
public void setEnumerationService(EnumerationService enumerationService)
-
getCockpitCollectionService
protected CockpitCollectionService getCockpitCollectionService()
-
setCockpitCollectionService
public void setCockpitCollectionService(CockpitCollectionService cockpitCollectionService)
-
getCollectionsForUser
public java.util.List<ObjectCollection> getCollectionsForUser(UserModel user)
Gets all collections for given user including the collections that given user has permission to read or write.- Specified by:
getCollectionsForUser
in interfaceObjectCollectionService
- Parameters:
user
- the user- Returns:
- the collections for user
-
getSpecialCollectionsForUser
public java.util.List<ObjectCollection> getSpecialCollectionsForUser(UserModel user)
Gets the special collections for a given user.- Specified by:
getSpecialCollectionsForUser
in interfaceObjectCollectionService
- Parameters:
user
- the user- Returns:
- the special collections for user
-
getReadUsersForCollection
public java.util.List<PrincipalModel> getReadUsersForCollection(ObjectCollection collection)
Returns list of all users who are allowed to read given collection.- Specified by:
getReadUsersForCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to check read access- Returns:
- user list of the users that are allowed to read from the given collection
-
getWriteUsersForCollection
public java.util.List<PrincipalModel> getWriteUsersForCollection(ObjectCollection collection)
Returns list of all users who are allowed to modify given collection.- Specified by:
getWriteUsersForCollection
in interfaceObjectCollectionService
- Parameters:
collection
- the collection to check write access- Returns:
- user list of the users that are allowed to modify the given collection
-
-