Package de.hybris.platform.cockpit.impl
Class DefaultCockpitCollectionService
- java.lang.Object
-
- de.hybris.platform.cockpit.impl.DefaultCockpitCollectionService
-
- All Implemented Interfaces:
CockpitCollectionService
public class DefaultCockpitCollectionService extends java.lang.Object implements CockpitCollectionService
Default implementation forCockpitCollectionService
interface.
-
-
Constructor Summary
Constructors Constructor Description DefaultCockpitCollectionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to read given collection.int
addToCollection(CockpitObjectAbstractCollectionModel collModel, java.util.List<ItemModel> elements)
void
addWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to modify given collection.CockpitObjectAbstractCollectionModel
cloneCollection(CockpitObjectAbstractCollectionModel collection, UserModel user)
Clones the given collection and assigns just cloned collection to the given user.java.util.List<CockpitObjectAbstractCollectionModel>
getCollectionsForUser(UserModel user)
Gets all collections for given user including the collections that given user has permission to read or write.int
getElementCount(CockpitObjectAbstractCollectionModel collection)
Gets the element count for the given collection.java.util.List<ItemModel>
getElements(CockpitObjectAbstractCollectionModel collModel, int start, int count)
Returns elements of the given object collection.protected EnumerationService
getEnumerationService()
protected ModelService
getModelService()
protected CockpitObjectAbstractCollectionDao
getObjectCollectionDao()
java.util.List<CockpitObjectSpecialCollectionModel>
getSpecialCollections(UserModel user, java.lang.String collectionType)
Gets the special collections of the specified type that belongs to the given user.java.util.List<CockpitObjectSpecialCollectionModel>
getSpecialCollectionsForUser(UserModel user)
Gets the special collections for a given user.boolean
hasReadCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can read collection.boolean
hasWriteCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can modify collection.boolean
isInCollection(ItemModel object, CockpitObjectAbstractCollectionModel collection)
Checks if the given element belongs to the specified collection.int
removeFromCollection(CockpitObjectAbstractCollectionModel collectionModel, java.util.List<ItemModel> elements)
int
removeNullItemReferences(CockpitObjectAbstractCollectionModel collModel)
Removes references to non-existing itemsvoid
removeReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to read given collection.void
removeWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to modify given collection.void
setEnumerationService(EnumerationService enumerationService)
void
setModelService(ModelService modelService)
void
setObjectCollectionDao(CockpitObjectAbstractCollectionDao objectCollectionDao)
protected CockpitObjectAbstractCollectionModel
unmapToModel(ObjectCollection collection)
-
-
-
Method Detail
-
addToCollection
public int addToCollection(CockpitObjectAbstractCollectionModel collModel, java.util.List<ItemModel> elements)
- Specified by:
addToCollection
in interfaceCockpitCollectionService
- Parameters:
collModel
- the collection to which elements are to be addedelements
- the elements to add- Returns:
- the number of elements actually added to the collection.
-
removeFromCollection
public int removeFromCollection(CockpitObjectAbstractCollectionModel collectionModel, java.util.List<ItemModel> elements)
- Specified by:
removeFromCollection
in interfaceCockpitCollectionService
- Parameters:
collectionModel
- the collection from which elements are to be removedelements
- the elements to remove- Returns:
- the number of elements actually removed from the collection.
-
getElements
public java.util.List<ItemModel> getElements(CockpitObjectAbstractCollectionModel collModel, int start, int count)
Returns elements of the given object collection.- Specified by:
getElements
in interfaceCockpitCollectionService
- Parameters:
collModel
- 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(CockpitObjectAbstractCollectionModel collModel)
Removes references to non-existing items- Specified by:
removeNullItemReferences
in interfaceCockpitCollectionService
- Parameters:
collModel
- the object collection to search elements of- Returns:
- the number of removed references
-
getElementCount
public int getElementCount(CockpitObjectAbstractCollectionModel collection)
Gets the element count for the given collection.- Specified by:
getElementCount
in interfaceCockpitCollectionService
- Parameters:
collection
- the collection- Returns:
- the element count
-
cloneCollection
public CockpitObjectAbstractCollectionModel cloneCollection(CockpitObjectAbstractCollectionModel collection, UserModel user)
Clones the given collection and assigns just cloned collection to the given user.- Specified by:
cloneCollection
in interfaceCockpitCollectionService
- Parameters:
collection
- the collection to cloneuser
- the user - clonned collection owner- Returns:
- the just cloned collection
-
getCollectionsForUser
public java.util.List<CockpitObjectAbstractCollectionModel> 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 interfaceCockpitCollectionService
- Parameters:
user
- the user- Returns:
- the collections for user
-
getSpecialCollectionsForUser
public java.util.List<CockpitObjectSpecialCollectionModel> getSpecialCollectionsForUser(UserModel user)
Gets the special collections for a given user.- Specified by:
getSpecialCollectionsForUser
in interfaceCockpitCollectionService
- Parameters:
user
- the user- Returns:
- the special collections for user
-
getSpecialCollections
public java.util.List<CockpitObjectSpecialCollectionModel> 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 interfaceCockpitCollectionService
- Parameters:
user
- the usercollectionType
- the collection type- Returns:
- the special collections
-
hasReadCollectionRight
public boolean hasReadCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can read collection.- Specified by:
hasReadCollectionRight
in interfaceCockpitCollectionService
- Parameters:
principal
- the requested principalcollection
- the requested collection
-
hasWriteCollectionRight
public boolean hasWriteCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can modify collection.- Specified by:
hasWriteCollectionRight
in interfaceCockpitCollectionService
- Parameters:
principal
- the requested principalcollection
- the requested collection
-
isInCollection
public boolean isInCollection(ItemModel object, CockpitObjectAbstractCollectionModel collection)
Checks if the given element belongs to the specified collection.- Specified by:
isInCollection
in interfaceCockpitCollectionService
- Parameters:
object
- the objectcollection
- the collection- Returns:
- true if given element is in the specified collection
-
addReadUser
public void addReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to read given collection.- Specified by:
addReadUser
in interfaceCockpitCollectionService
- Parameters:
user
- to add read accesscollection
- to add read access
-
addWriteUser
public void addWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to modify given collection.- Specified by:
addWriteUser
in interfaceCockpitCollectionService
- Parameters:
user
- to add write accesscollection
- to add write access
-
removeReadUser
public void removeReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to read given collection.- Specified by:
removeReadUser
in interfaceCockpitCollectionService
- Parameters:
user
- to remove read accesscollection
- to remove read access
-
removeWriteUser
public void removeWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to modify given collection.- Specified by:
removeWriteUser
in interfaceCockpitCollectionService
- Parameters:
user
- to remove write accesscollection
- to remove write access
-
unmapToModel
protected CockpitObjectAbstractCollectionModel unmapToModel(ObjectCollection collection)
-
getObjectCollectionDao
protected CockpitObjectAbstractCollectionDao getObjectCollectionDao()
-
setObjectCollectionDao
public void setObjectCollectionDao(CockpitObjectAbstractCollectionDao objectCollectionDao)
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
setEnumerationService
public void setEnumerationService(EnumerationService enumerationService)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-