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 theObjectCollectionServiceinterface.
-
-
Field Summary
Fields Modifier and Type Field Description protected CockpitObjectAbstractCollectionDaoobjectCollectionDao-
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 voidaddReadUser(PrincipalModel user, ObjectCollection collection)Allows given user to read given collection.intaddToCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)voidaddWriteUser(PrincipalModel user, ObjectCollection collection)Allows given user to modify given collection.ObjectCollectioncloneCollection(ObjectCollection collection, UserModel user)Clones the given collection and assigns just cloned collection to the given user.ObjectCollectioncreateCollection(java.lang.String qualifier, UserModel user)Creates the collection for the given parameters.ObjectCollectioncreateSpecialCollection(java.lang.String qualifier, UserModel user)Creates the special collection with the collection type set to null.ObjectCollectioncreateSpecialCollection(java.lang.String qualifier, UserModel user, HybrisEnumValue collectionType)Creates the special collection for the given parameters.ObjectCollectioncreateSpecialCollection(java.lang.String qualifier, UserModel user, EnumerationValue collectionType)Creates the special collection for the given parameters.protected CockpitCollectionServicegetCockpitCollectionService()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.intgetElementCount(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 EnumerationServicegetEnumerationService()protected CockpitObjectAbstractCollectionDaogetObjectCollectionDao()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.BooleanhasReadCollectionRight(PrincipalModel principal, ObjectCollection collection)Returns information whether the user can read collection.java.lang.BooleanhasWriteCollectionRight(PrincipalModel principal, ObjectCollection collection)Returns information whether the user can modify collection.java.lang.BooleanisCollectionOwner(PrincipalModel principal, ObjectCollection collection)Checks if given collection belongs to the given user.java.lang.BooleanisInCollection(TypedObject object, ObjectCollection collection)Checks if the given element belongs to the specified collection.ObjectCollectionmapCollection(CockpitObjectAbstractCollection source)Deprecated.since 6.3, usemapCollection(CockpitObjectAbstractCollectionModel)insteadvoidpublishCollection(ObjectCollection collection)Sets the collection's owner to null, so it can be accessed by any user.ObjectCollectionrefreshCollection(ObjectCollection collection)Removes all not existing items from the collection.voidremoveCollection(ObjectCollection collection)Removes the collection from the system.intremoveFromCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)intremoveNullItemReferences(ObjectCollection collection)Removes references to non-existing itemsvoidremoveReadUser(PrincipalModel user, ObjectCollection collection)Disallow given user to read given collection.voidremoveWriteUser(PrincipalModel user, ObjectCollection collection)Disallow given user to modify given collection.voidrenameCollection(ObjectCollection collection, java.lang.String label)Renames the collection with the specified label.voidsetCockpitCollectionService(CockpitCollectionService cockpitCollectionService)voidsetEnumerationService(EnumerationService enumerationService)voidsetObjectCollectionDao(CockpitObjectAbstractCollectionDao dao)voidsetObjectTypeFilterList(java.util.List<java.lang.String> objectTypeFilterList)Sets the object type filter list.protected CockpitObjectAbstractCollectionunmapCollection(ObjectCollection collection)Deprecated.since 6.3, useunmapToModel(ObjectCollection)insteadprotected CockpitObjectAbstractCollectionModelunmapToModel(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:
addReadUserin 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:
addToCollectionin 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:
getElementsin 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:
removeNullItemReferencesin 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:
getElementCountin 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:
addWriteUserin 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:
cloneCollectionin 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:
createCollectionin 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:
createSpecialCollectionin 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:ObjectCollectionServiceCreates the special collection for the given parameters.- Specified by:
createSpecialCollectionin 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:
createSpecialCollectionin 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:ObjectCollectionServiceGets the collections.- Specified by:
getCollectionsin interfaceObjectCollectionService- Parameters:
user- the user- Returns:
- the collections
-
getReadUsers
public java.util.List<PrincipalModel> getReadUsers(ObjectCollection collection)
Description copied from interface:ObjectCollectionServiceReturns list of all users who are allowed to read given collection.- Specified by:
getReadUsersin 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:ObjectCollectionServiceGets the special collections.- Specified by:
getSpecialCollectionsin 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:
getSpecialCollectionsin 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:ObjectCollectionServiceReturns list of all users who are allowed to modify given collection.- Specified by:
getWriteUsersin 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:
isCollectionOwnerin 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:
hasWriteCollectionRightin 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:
hasReadCollectionRightin 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:
publishCollectionin interfaceObjectCollectionService- Parameters:
collection- the collection to publish
-
refreshCollection
public ObjectCollection refreshCollection(ObjectCollection collection)
Removes all not existing items from the collection.- Specified by:
refreshCollectionin 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:
isInCollectionin 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:
removeCollectionin interfaceObjectCollectionService- Parameters:
collection- the collection to remove
-
removeFromCollection
public int removeFromCollection(ObjectCollection collection, java.util.Collection<TypedObject> elements)
- Specified by:
removeFromCollectionin 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:
removeReadUserin 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:
removeWriteUserin 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:
renameCollectionin 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:
getCollectionsForUserin 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:
getSpecialCollectionsForUserin 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:
getReadUsersForCollectionin 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:
getWriteUsersForCollectionin interfaceObjectCollectionService- Parameters:
collection- the collection to check write access- Returns:
- user list of the users that are allowed to modify the given collection
-
-