com.atlassian.jira.favourites
Interface FavouritesManager<S extends SharedEntity>

All Known Implementing Classes:
DefaultFavouritesManager

public interface FavouritesManager<S extends SharedEntity>

Manager for basic Favourites functionality. Used for adding, removing and checking favourites of generic entities. It also adjusts favourite counts for entities

Since:
v3.13

Method Summary
 void addFavourite(com.atlassian.crowd.embedded.api.User user, S entity)
          Add the given entity as a favourite of the user passed in add to favourites count if necessary.
 void addFavourite(User user, S entity)
          Add the given entity as a favourite of the user passed in add to favourites count if necessary.
 void addFavouriteInPosition(com.atlassian.crowd.embedded.api.User user, S entity, long position)
          Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary.
 void addFavouriteInPosition(User user, S entity, long position)
          Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary.
 void decreaseFavouriteSequence(com.atlassian.crowd.embedded.api.User user, S entity)
          Decreases the position of the SharedEntity relative to the user's set of all other entities of the same type.
 void decreaseFavouriteSequence(User user, S entity)
          Decreases the position of the SharedEntity relative to the user's set of all other entities of the same type.
 Collection<Long> getFavouriteIds(com.atlassian.crowd.embedded.api.User user, SharedEntity.TypeDescriptor<S> entityType)
          Get the ids of a user's favourite Entities for a given entity type
 Collection<Long> getFavouriteIds(User user, SharedEntity.TypeDescriptor<S> entityType)
          Get the ids of a user's favourite Entities for a given entity type
 void increaseFavouriteSequence(com.atlassian.crowd.embedded.api.User user, S entity)
          Increases the position of the SharedEntity relative to the user's set of all other entities of the same type.
 void increaseFavouriteSequence(User user, S entity)
          Increases the position of the SharedEntity relative to the user's set of all other entities of the same type.
 boolean isFavourite(com.atlassian.crowd.embedded.api.User user, S entity)
          Check to see if the given entity is a favourite of the user passed in.
 boolean isFavourite(User user, S entity)
          Check to see if the given entity is a favourite of the user passed in.
 void moveToEndFavouriteSequence(com.atlassian.crowd.embedded.api.User user, S entity)
          Moves the position of the SharedEntity to the end relative to the user's set of all other entities of the same type.
 void moveToEndFavouriteSequence(User user, S entity)
          Moves the position of the SharedEntity to the end relative to the user's set of all other entities of the same type.
 void moveToStartFavouriteSequence(com.atlassian.crowd.embedded.api.User user, S entity)
          Moves the position of the SharedEntity to the start relative to the user's set of all other entities of the same type.
 void moveToStartFavouriteSequence(User user, S entity)
          Moves the position of the SharedEntity to the start relative to the user's set of all other entities of the same type.
 void removeFavourite(com.atlassian.crowd.embedded.api.User user, S entity)
          Remove the given entity as a favourite of the user passed in.
 void removeFavourite(User user, S entity)
          Remove the given entity as a favourite of the user passed in.
 void removeFavouritesForEntityDelete(SharedEntity entity)
          Remove all favourite associations for a given entity for entity deletion.
 void removeFavouritesForUser(com.atlassian.crowd.embedded.api.User user, SharedEntity.TypeDescriptor<S> entityType)
          Remove the favourite associations for the given User and the given type
 void removeFavouritesForUser(User user, SharedEntity.TypeDescriptor<S> entityType)
          Remove the favourite associations for the given User and the given type
 

Method Detail

addFavourite

void addFavourite(com.atlassian.crowd.embedded.api.User user,
                  S entity)
                  throws PermissionException
Add the given entity as a favourite of the user passed in add to favourites count if necessary.

Parameters:
user - The user adding the favourite
entity - The entity to favourite
Throws:
PermissionException - when trying to add a filter as favourite when you have no permissions

addFavourite

void addFavourite(User user,
                  S entity)
                  throws PermissionException
Add the given entity as a favourite of the user passed in add to favourites count if necessary.

Parameters:
user - The user adding the favourite
entity - The entity to favourite
Throws:
PermissionException - when trying to add a filter as favourite when you have no permissions

addFavouriteInPosition

void addFavouriteInPosition(com.atlassian.crowd.embedded.api.User user,
                            S entity,
                            long position)
                            throws PermissionException
Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary. The entity currently in the specified position and all those after will be moved down one position.

Parameters:
user - The user adding the favourite
entity - The entity to favourite
position - the position in which this entity should be added in the favourites order.
Throws:
PermissionException - when trying to add a filter as favourite when you have no permissions

addFavouriteInPosition

void addFavouriteInPosition(User user,
                            S entity,
                            long position)
                            throws PermissionException
Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary. The entity currently in the specified position and all those after will be moved down one position.

Parameters:
user - The user adding the favourite
entity - The entity to favourite
position - the position in which this entity should be added in the favourites order.
Throws:
PermissionException - when trying to add a filter as favourite when you have no permissions

removeFavourite

void removeFavourite(com.atlassian.crowd.embedded.api.User user,
                     S entity)
Remove the given entity as a favourite of the user passed in. Remove even if user doesn't have permission to see it and adjust count of favourites if necessary.

Parameters:
user - The user removing the favourite
entity - The entity to favourite

removeFavourite

void removeFavourite(User user,
                     S entity)
Remove the given entity as a favourite of the user passed in. Remove even if user doesn't have permission to see it and adjust count of favourites if necessary.

Parameters:
user - The user removing the favourite
entity - The entity to favourite

isFavourite

boolean isFavourite(com.atlassian.crowd.embedded.api.User user,
                    S entity)
                    throws PermissionException
Check to see if the given entity is a favourite of the user passed in.

Parameters:
user - The user checking the favourite
entity - The entity to favourite
Returns:
true if the entity is favourite and can be seen by user, otherwise false
Throws:
PermissionException - when checking a filter with no permission

isFavourite

boolean isFavourite(User user,
                    S entity)
                    throws PermissionException
Check to see if the given entity is a favourite of the user passed in.

Parameters:
user - The user checking the favourite
entity - The entity to favourite
Returns:
true if the entity is favourite and can be seen by user, otherwise false
Throws:
PermissionException - when checking a filter with no permission

getFavouriteIds

Collection<Long> getFavouriteIds(com.atlassian.crowd.embedded.api.User user,
                                 SharedEntity.TypeDescriptor<S> entityType)
Get the ids of a user's favourite Entities for a given entity type

Parameters:
user - The user for the associated entities. Can not be null.
entityType - The type of entities to get. E.g. SearchRequest.ENTITY_TYPE. Can not be null.
Returns:
A Collection on Longs that represent the entities, sorted into sequence order
Throws:
IllegalArgumentException - for null user or entity type

getFavouriteIds

Collection<Long> getFavouriteIds(User user,
                                 SharedEntity.TypeDescriptor<S> entityType)
Get the ids of a user's favourite Entities for a given entity type

Parameters:
user - The user for the associated entities. Can not be null.
entityType - The type of entities to get. E.g. SearchRequest.ENTITY_TYPE. Can not be null.
Returns:
A Collection on Longs that represent the entities, sorted into sequence order
Throws:
IllegalArgumentException - for null user or entity type

removeFavouritesForUser

void removeFavouritesForUser(com.atlassian.crowd.embedded.api.User user,
                             SharedEntity.TypeDescriptor<S> entityType)
Remove the favourite associations for the given User and the given type

Parameters:
user - The user with whom to disassociate entities with
entityType - The type of entity to disassociate user with.

removeFavouritesForUser

void removeFavouritesForUser(User user,
                             SharedEntity.TypeDescriptor<S> entityType)
Remove the favourite associations for the given User and the given type

Parameters:
user - The user with whom to disassociate entities with
entityType - The type of entity to disassociate user with.

removeFavouritesForEntityDelete

void removeFavouritesForEntityDelete(SharedEntity entity)
Remove all favourite associations for a given entity for entity deletion. This method is for only for when an entity is deleted as it does not adjust favourite counts.

Parameters:
entity - The entity that is being deleted

increaseFavouriteSequence

void increaseFavouriteSequence(com.atlassian.crowd.embedded.api.User user,
                               S entity)
                               throws PermissionException
Increases the position of the SharedEntity relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

increaseFavouriteSequence

void increaseFavouriteSequence(User user,
                               S entity)
                               throws PermissionException
Increases the position of the SharedEntity relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

decreaseFavouriteSequence

void decreaseFavouriteSequence(com.atlassian.crowd.embedded.api.User user,
                               S entity)
                               throws PermissionException
Decreases the position of the SharedEntity relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

decreaseFavouriteSequence

void decreaseFavouriteSequence(User user,
                               S entity)
                               throws PermissionException
Decreases the position of the SharedEntity relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

moveToStartFavouriteSequence

void moveToStartFavouriteSequence(com.atlassian.crowd.embedded.api.User user,
                                  S entity)
                                  throws PermissionException
Moves the position of the SharedEntity to the start relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

moveToStartFavouriteSequence

void moveToStartFavouriteSequence(User user,
                                  S entity)
                                  throws PermissionException
Moves the position of the SharedEntity to the start relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

moveToEndFavouriteSequence

void moveToEndFavouriteSequence(com.atlassian.crowd.embedded.api.User user,
                                S entity)
                                throws PermissionException
Moves the position of the SharedEntity to the end relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.

moveToEndFavouriteSequence

void moveToEndFavouriteSequence(User user,
                                S entity)
                                throws PermissionException
Moves the position of the SharedEntity to the end relative to the user's set of all other entities of the same type.

Parameters:
user - the user whom the entity belongs to
entity - The entity in question
Throws:
PermissionException - when the user does not have permission to perform the action.


Copyright © 2002-2011 Atlassian. All Rights Reserved.