|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.bc.project.component.CachingProjectComponentStore
public class CachingProjectComponentStore
Decorates an implementation of the project component delegateStore with caching. The actual delegateStore implementation is delegated so this class is a Composite and also a Decorator.
Constructor Summary | |
---|---|
CachingProjectComponentStore(ProjectComponentStore delegateStore,
com.atlassian.event.api.EventPublisher eventPublisher)
Creates a new instance of this class backed by given delegateStore. |
Method Summary | |
---|---|
boolean |
containsName(String name,
Long projectId)
Checks whether component with specified name is stored. |
void |
delete(Long componentId)
Removes the component from the persistent storage and a cache. |
MutableProjectComponent |
find(Long id)
Looks up the project component by the given ID and returns it. |
Collection |
findAll()
Retrieve all ProjectComponent objects stored. |
Collection |
findAllForProject(Long projectId)
Looks up all components that are related to the project with given ID. |
MutableProjectComponent |
findByComponentName(Long projectId,
String componentName)
Looks up the component with the given name in the project with the given id. |
Collection<MutableProjectComponent> |
findByComponentNameCaseInSensitive(String componentName)
Finds one or more ProjectComponent with a given name. |
Collection |
findComponentsBylead(String userName)
Retrieves all ProjectComponents that have the given user as their lead. |
Long |
findProjectIdForComponent(Long componentId)
Looks up the project ID for the given component ID. |
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. |
MutableProjectComponent |
store(MutableProjectComponent component)
Persist the component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachingProjectComponentStore(ProjectComponentStore delegateStore, com.atlassian.event.api.EventPublisher eventPublisher)
delegateStore
- underlying persistence storeeventPublisher
- used to register ourselves for a clear cache event.Method Detail |
---|
public void start() throws Exception
Startable
start
in interface Startable
Exception
- Allows implementations to throw an Exception.@EventListener public void onClearCache(ClearCacheEvent event)
public MutableProjectComponent find(Long id) throws EntityNotFoundException
find
in interface ProjectComponentStore
id
- project component ID
EntityNotFoundException
- if the component not foundpublic Collection findAllForProject(Long projectId)
findAllForProject
in interface ProjectComponentStore
projectId
- project ID
public MutableProjectComponent findByComponentName(Long projectId, String componentName) throws EntityNotFoundException
findByComponentName
in interface ProjectComponentStore
projectId
- id of the project.componentName
- name of the component.
EntityNotFoundException
- if no such component can be found.public Collection<MutableProjectComponent> findByComponentNameCaseInSensitive(String componentName)
findByComponentNameCaseInSensitive
in interface ProjectComponentStore
componentName
- the name of the component to find.
EntityNotFoundException
public Long findProjectIdForComponent(Long componentId) throws EntityNotFoundException
findProjectIdForComponent
in interface ProjectComponentStore
componentId
- component ID
EntityNotFoundException
- if project not found for the given component IDpublic boolean containsName(String name, Long projectId)
containsName
in interface ProjectComponentStore
name
- component name, null will cause IllegalArgumentException
IllegalArgumentException
- if name or projectId is nullpublic MutableProjectComponent store(MutableProjectComponent component) throws EntityNotFoundException, DataAccessException
store
in interface ProjectComponentStore
component
- component to persist
EntityNotFoundException
- in case of update if the component does not exist (maybe was deleted :-)
DataAccessException
- if cannot persist the componentpublic void delete(Long componentId) throws EntityNotFoundException
delete
in interface ProjectComponentStore
componentId
- the id of the component to delete
EntityNotFoundException
- if component does not exist (maybe was removed previously :-)public Collection findComponentsBylead(String userName)
findComponentsBylead
in interface ProjectComponentStore
userName
- user name
public Collection findAll()
findAll
in interface ProjectComponentStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |