com.atlassian.jira.sharing
Interface SharedEntityAccessor<S extends SharedEntity>

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

public interface SharedEntityAccessor<S extends SharedEntity>

Provides an abstraction for accessing SharedEntity objects. This class abstracts away the details of the SharedEntity implementation to those components that need it.

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.
 EnclosedIterable<S> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 EnclosedIterable<S> get(com.opensymphony.user.User searcher, SharedEntityAccessor.RetrievalDescriptor descriptor)
          Used to get sharable entities from a search result.
 EnclosedIterable<S> getAll()
          Get all sharable entities this accessor can see.
 EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
          Get all sharable entities this accessor can see for use in indexing.
 S getSharedEntity(java.lang.Long entityId)
          This will call back to ask for a SharedEntity based on id.
 S getSharedEntity(com.opensymphony.user.User user, java.lang.Long entityId)
          This is called to get SharedEntity by id If the user is allows to see it
 SharedEntity.TypeDescriptor<S> getType()
          Returns the type that this object can work with.
 boolean hasPermissionToUse(com.opensymphony.user.User user, S entity)
          Returns true if the user has permission to use the SharedEntity
 

Method Detail

getType

SharedEntity.TypeDescriptor<S> 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

S getSharedEntity(java.lang.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

S getSharedEntity(com.opensymphony.user.User user,
                  java.lang.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(com.opensymphony.user.User user,
                           S 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

EnclosedIterable<S> getAll()
Get all sharable entities this accessor can see.

Returns:
a EnclosedIterable of SharedEntity's

getAllIndexableSharedEntities

EnclosedIterable<SharedEntity> getAllIndexableSharedEntities()
Get all sharable entities this accessor can see for use in indexing.

Returns:
a EnclosedIterable of SharedEntity's

get

EnclosedIterable<S> get(SharedEntityAccessor.RetrievalDescriptor descriptor)
Used to get sharable entities from a search result.

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

get

EnclosedIterable<S> get(com.opensymphony.user.User searcher,
                        SharedEntityAccessor.RetrievalDescriptor descriptor)
Used to get sharable entities from a search result. The entities returned may be modified by the user parameter (e.g. permissions or clause sanitisation).

Parameters:
searcher - the user performing the search
descriptor - retrieval descriptor
Returns:
a EnclosedIterable of SharedEntity's


Copyright © 2002-2010 Atlassian. All Rights Reserved.