com.atlassian.jira.avatar
Class CachingAvatarStore

java.lang.Object
  extended by com.atlassian.jira.avatar.CachingAvatarStore
All Implemented Interfaces:
AvatarStore, Startable

public class CachingAvatarStore
extends Object
implements AvatarStore, Startable

A caching implementation of the AvatarStore.

Since:
v4.2

Constructor Summary
CachingAvatarStore(AvatarStore delegate, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 Avatar create(Avatar avatar)
          Creates an avatar with the properties of the given avatar.
 boolean delete(Long avatarId)
          Permanently removes the avatar from the system.
 List<Avatar> getAllSystemAvatars(Avatar.Type type)
          Provides a list of all system avatars.
 Avatar getById(Long avatarId)
          Retrieves the Avatar by id.
 List<Avatar> getCustomAvatarsForOwner(Avatar.Type type, String ownerId)
          Provides a list of all avatars that are of the given type which have the given owner.
 void onClearCache(ClearCacheEvent event)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 void update(Avatar avatar)
          Updates an avatar's properties to match those in the given avatar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingAvatarStore

public CachingAvatarStore(AvatarStore delegate,
                          com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getById

public Avatar getById(Long avatarId)
               throws DataAccessException
Description copied from interface: AvatarStore
Retrieves the Avatar by id.

Specified by:
getById in interface AvatarStore
Parameters:
avatarId - the avatar's id, must not be null.
Returns:
the avatar with the given id or null if it doesn't exist.
Throws:
DataAccessException - if there is a back-end storage problem.

delete

public boolean delete(Long avatarId)
               throws DataAccessException
Description copied from interface: AvatarStore
Permanently removes the avatar from the system.

Specified by:
delete in interface AvatarStore
Parameters:
avatarId - the avatar's id, must not be null.
Returns:
the avatar with the given id or null if it doesn't exist.
Throws:
DataAccessException - if there is a back-end storage problem.

update

public void update(Avatar avatar)
            throws DataAccessException
Description copied from interface: AvatarStore
Updates an avatar's properties to match those in the given avatar. The avatar too change is identified by the id of the given avatar.

Specified by:
update in interface AvatarStore
Parameters:
avatar - the avatar to update, must not be null.
Throws:
DataAccessException - if there is a back-end storage problem.

create

public Avatar create(Avatar avatar)
              throws DataAccessException
Description copied from interface: AvatarStore
Creates an avatar with the properties of the given avatar.

Specified by:
create in interface AvatarStore
Parameters:
avatar - the to create, must not be null, must have a null id.
Returns:
the avatar with the given id or null if it doesn't exist.
Throws:
DataAccessException - if there is a back-end storage problem.

getAllSystemAvatars

public List<Avatar> getAllSystemAvatars(Avatar.Type type)
                                 throws DataAccessException
Description copied from interface: AvatarStore
Provides a list of all system avatars.

Specified by:
getAllSystemAvatars in interface AvatarStore
Parameters:
type - the types of avatar to retrieve
Returns:
the system avatars, never null.
Throws:
DataAccessException - if there is a back-end database problem.

getCustomAvatarsForOwner

public List<Avatar> getCustomAvatarsForOwner(Avatar.Type type,
                                             String ownerId)
                                      throws DataAccessException
Description copied from interface: AvatarStore
Provides a list of all avatars that are of the given type which have the given owner.

Specified by:
getCustomAvatarsForOwner in interface AvatarStore
Parameters:
type - the desired type of the avatars to retrieve.
ownerId - the id of the owner, matches the type.
Returns:
all the avatars that have the given type and owner, never null.
Throws:
DataAccessException - if there is a back-end database problem.


Copyright © 2002-2012 Atlassian. All Rights Reserved.