public class CachingProjectComponentStore extends Object implements ProjectComponentStore, Startable
Constructor and Description |
---|
CachingProjectComponentStore(ProjectComponentStore delegateStore,
com.atlassian.beehive.ClusterLockService clusterLockService,
com.atlassian.cache.CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
deleteAllComponents(Long projectId)
Deletes all components in given project.
|
MutableProjectComponent |
find(Long id)
Looks up the project component by the given ID and returns it.
|
Collection<ProjectComponent> |
findAll()
Retrieve all ProjectComponent objects stored.
|
Collection<MutableProjectComponent> |
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 userKey)
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.
|
ProjectComponent |
getProjectComponent(Long projectComponentId)
Returns the ProjectComponent for the given ID, or null.
|
void |
onClearCache(ClearCacheEvent event) |
void |
onProjectComponentFKChangedEvent(ProjectComponentFKChangedEvent event) |
void |
start()
This method will 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.
|
public CachingProjectComponentStore(ProjectComponentStore delegateStore, com.atlassian.beehive.ClusterLockService clusterLockService, com.atlassian.cache.CacheManager cacheManager)
@EventListener public void onClearCache(ClearCacheEvent event)
@EventListener public void onProjectComponentFKChangedEvent(ProjectComponentFKChangedEvent event)
public void start()
Startable
public MutableProjectComponent find(Long id) throws EntityNotFoundException
find
in interface ProjectComponentStore
id
- project component IDEntityNotFoundException
- if the component not foundpublic ProjectComponent getProjectComponent(Long projectComponentId)
ProjectComponentStore
getProjectComponent
in interface ProjectComponentStore
projectComponentId
- the IDpublic Collection<MutableProjectComponent> findAllForProject(Long projectId)
findAllForProject
in interface ProjectComponentStore
projectId
- project IDpublic 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.public Long findProjectIdForComponent(Long componentId) throws EntityNotFoundException
findProjectIdForComponent
in interface ProjectComponentStore
componentId
- component IDEntityNotFoundException
- 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 IllegalArgumentExceptionIllegalArgumentException
- if name or projectId is nullpublic MutableProjectComponent store(MutableProjectComponent component) throws EntityNotFoundException, DataAccessException
store
in interface ProjectComponentStore
component
- component to persistEntityNotFoundException
- 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 deleteEntityNotFoundException
- if component does not exist (maybe was removed previously :-)public void deleteAllComponents(@Nonnull Long projectId)
ProjectComponentStore
deleteAllComponents
in interface ProjectComponentStore
projectId
- id of the project in which components will be deleted.public Collection findComponentsBylead(String userKey)
findComponentsBylead
in interface ProjectComponentStore
userKey
- key of the lead userpublic Collection<ProjectComponent> findAll()
findAll
in interface ProjectComponentStore
Copyright © 2002-2022 Atlassian. All Rights Reserved.