com.atlassian.jira.sharing
Interface SharedEntityAccessor

All Known Subinterfaces:
PortalPageManager, SearchRequestManager
All Known Implementing Classes:
DefaultPortalPageManager, DefaultSearchRequestManager

public interface SharedEntityAccessor

Provides an abstraction for accessing SharedEntity objects. This class abstracts away the details of the SharedEntity implementation to those components that need it. For instance, the AjaxFavouriteControl uses SharedEntityAccessors to ensure that it will continue to work without change for any SharedEntity.

Since:
v3.13

Nested Class Summary
static interface SharedEntityAccessor.Factory
          Factory to retrieve a SharedEntityAccessor for a given SharedEntity
static interface SharedEntityAccessor.RetrievalDescriptor
          Used when getting a Collection of shared entities.
 
Method Summary
 void adjustFavouriteCount(SharedEntity entity, int adjustmentValue)
          Adjusts the favourite counts for a given entity.
 CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 CloseableIterable getAll()
          Get all sharable entities this accessor can see.
 SharedEntity getSharedEntity(Long entityId)
          This will call back to ask for a SharedEntity based on id.
 SharedEntity getSharedEntity(User user, Long entityId)
          This is called to get SharedEntity by id If the user is allows to see it
 SharedEntity.TypeDescriptor getType()
          Returns the type that this object can work with.
 boolean hasPermissionToUse(User user, SharedEntity entity)
          Returns true if the user has permission to use the SharedEntity
 

Method Detail

getType

SharedEntity.TypeDescriptor getType()
Returns the type that this object can work with.

Returns:
the type that this object can work with.

adjustFavouriteCount

void adjustFavouriteCount(SharedEntity entity,
                          int adjustmentValue)
Adjusts the favourite counts for a given entity. This resulting value must always be greater or equal to one.

Parameters:
entity - the entity to adjust
adjustmentValue - the value to adjust by.

getSharedEntity

SharedEntity getSharedEntity(Long entityId)
This will call back to ask for a SharedEntity based on id.

Parameters:
entityId - the id of the SharedEntity
Returns:
a SharedEntity or null if it cant be found

getSharedEntity

SharedEntity getSharedEntity(User user,
                             Long entityId)
This is called to get SharedEntity by id If the user is allows to see it

Parameters:
user - the user in play
entityId - the id of the SharedEntity
Returns:
a SharedEntity if it exists and the user can see it and null otherwise

hasPermissionToUse

boolean hasPermissionToUse(User user,
                           SharedEntity entity)
Returns true if the user has permission to use the SharedEntity

Parameters:
user - the user in play
entity - the SharedEntity to check
Returns:
true if the user has permission to use it

getAll

CloseableIterable getAll()
Get all sharable entities this accessor can see.

Returns:
a CloseableIterable of SharedEntity's

get

CloseableIterable get(SharedEntityAccessor.RetrievalDescriptor descriptor)
Used to get sharable entities from a search result.

Parameters:
descriptor - retrieval descriptor
Returns:
a CloseableIterable of SharedEntity's


Copyright © 2002-2009 Atlassian. All Rights Reserved.