Package de.hybris.platform.cockpit
Interface CockpitCollectionService
-
- All Known Implementing Classes:
DefaultCockpitCollectionService
public interface CockpitCollectionService
Service contains methods to deal with collections of objects that are used in cockpits on the model layer. Additionally each cockpit have in web layer its own instance ofObjectCollectionService
that will be parametrized with the allowed item types that are valid for collections present in the specific cockpit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to read given collection.int
addToCollection(CockpitObjectAbstractCollectionModel collection, 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 collection, int start, int count)
Returns elements of the given object collection.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 collection, java.util.List<ItemModel> elements)
int
removeNullItemReferences(CockpitObjectAbstractCollectionModel collection)
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.
-
-
-
Method Detail
-
addToCollection
int addToCollection(CockpitObjectAbstractCollectionModel collection, java.util.List<ItemModel> elements)
- 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.
-
removeFromCollection
int removeFromCollection(CockpitObjectAbstractCollectionModel collection, java.util.List<ItemModel> elements)
- 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.
-
getElements
java.util.List<ItemModel> getElements(CockpitObjectAbstractCollectionModel collection, int start, int count)
Returns elements of the given object collection.- 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
int removeNullItemReferences(CockpitObjectAbstractCollectionModel collection)
Removes references to non-existing items- Parameters:
collection
- the object collection to search elements of- Returns:
- the number of removed references
-
getElementCount
int getElementCount(CockpitObjectAbstractCollectionModel collection)
Gets the element count for the given collection.- Parameters:
collection
- the collection- Returns:
- the element count
-
cloneCollection
CockpitObjectAbstractCollectionModel cloneCollection(CockpitObjectAbstractCollectionModel collection, UserModel user)
Clones the given collection and assigns just cloned collection to the given user.- Parameters:
collection
- the collection to cloneuser
- the user - clonned collection owner- Returns:
- the just cloned collection
-
getCollectionsForUser
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.- Parameters:
user
- the user- Returns:
- the collections for user
-
getSpecialCollectionsForUser
java.util.List<CockpitObjectSpecialCollectionModel> getSpecialCollectionsForUser(UserModel user)
Gets the special collections for a given user.- Parameters:
user
- the user- Returns:
- the special collections for user
-
getSpecialCollections
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.- Parameters:
user
- the usercollectionType
- the collection type- Returns:
- the special collections
-
hasReadCollectionRight
boolean hasReadCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can read collection.- Parameters:
principal
- the requested principalcollection
- the requested collection
-
hasWriteCollectionRight
boolean hasWriteCollectionRight(PrincipalModel principal, CockpitObjectAbstractCollectionModel collection)
Returns information whether the user can modify collection.- Parameters:
principal
- the requested principalcollection
- the requested collection
-
isInCollection
boolean isInCollection(ItemModel object, CockpitObjectAbstractCollectionModel collection)
Checks if the given element belongs to the specified collection.- Parameters:
object
- the objectcollection
- the collection- Returns:
- true if given element is in the specified collection
-
addReadUser
void addReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to read given collection.- Parameters:
user
- to add read accesscollection
- to add read access
-
addWriteUser
void addWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Allows given user to modify given collection.- Parameters:
user
- to add write accesscollection
- to add write access
-
removeReadUser
void removeReadUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to read given collection.- Parameters:
user
- to remove read accesscollection
- to remove read access
-
removeWriteUser
void removeWriteUser(PrincipalModel user, CockpitObjectAbstractCollectionModel collection)
Disallow given user to modify given collection.- Parameters:
user
- to remove write accesscollection
- to remove write access
-
-