public class CachingProjectRoleAndActorStore extends Object implements ProjectRoleAndActorStore
ProjectRoleAndActorStore
that delegates to another ProjectRoleAndActorStore
.
This class maintains two separate unrelated caches, one for ProjectRoles and another for the actors associated with a Project/ProjectRole combination. These use separate approaches to maintain correctness under concurrent usage.
The caching of the ProjectRoleActors maintains its correctness under concurrent updates/miss population by using
ConcurrentMap.putIfAbsent(Object, Object)
to store the result of a retrieval operation from the database
(non-mutative), but Map.put(Object, Object)
to store the result of an update.
Constructor and Description |
---|
CachingProjectRoleAndActorStore(ProjectRoleAndActorStore delegate,
RoleActorFactory roleActorFactory,
com.atlassian.cache.CacheManager cacheManager,
ProjectRoleActorsCacheSettings projectRoleActorsCacheSettings) |
public CachingProjectRoleAndActorStore(ProjectRoleAndActorStore delegate, RoleActorFactory roleActorFactory, com.atlassian.cache.CacheManager cacheManager, ProjectRoleActorsCacheSettings projectRoleActorsCacheSettings)
public Collection<ProjectRole> getAllProjectRoles()
getAllProjectRoles
in interface ProjectRoleAndActorStore
public ProjectRole getProjectRole(Long id)
getProjectRole
in interface ProjectRoleAndActorStore
public ProjectRole getProjectRoleByName(String name)
getProjectRoleByName
in interface ProjectRoleAndActorStore
public ProjectRole addProjectRole(ProjectRole projectRole)
addProjectRole
in interface ProjectRoleAndActorStore
public void updateProjectRole(ProjectRole projectRole)
updateProjectRole
in interface ProjectRoleAndActorStore
public void deleteProjectRole(ProjectRole projectRole)
deleteProjectRole
in interface ProjectRoleAndActorStore
public DefaultRoleActors getDefaultRoleActors(Long projectRoleId)
ProjectRoleAndActorStore
ProjectRoleActors
for a given project role ID.getDefaultRoleActors
in interface ProjectRoleAndActorStore
projectRoleId
- the ID of the project role.ProjectRoleActors
object containing the default role actors for the given project. If none are
found, a ProjectRoleActors
object with an empty set will be returned.public ProjectRoleActors getProjectRoleActors(@Nonnull Long projectRoleId, Long projectId)
ProjectRoleAndActorStore
ProjectRoleActors
for a given project role ID and project ID.getProjectRoleActors
in interface ProjectRoleAndActorStore
projectRoleId
- the ID of the project role.projectId
- the ID of the project.ProjectRoleActors
object containing the role actors for the given project with the given
project role id. If none are found, a ProjectRoleActors
object with an empty set will be returned.public Collection<ProjectRoleActors> getProjectRoleActorsByRoleId(@Nonnull Long projectRoleId)
ProjectRoleAndActorStore
ProjectRoleActors
that have a given project role ID, including the default ones (null project).getProjectRoleActorsByRoleId
in interface ProjectRoleAndActorStore
projectRoleId
- the ID of the project role.public void updateProjectRoleActors(ProjectRoleActors projectRoleActors)
updateProjectRoleActors
in interface ProjectRoleAndActorStore
public void updateDefaultRoleActors(DefaultRoleActors defaultRoleActors)
updateDefaultRoleActors
in interface ProjectRoleAndActorStore
public void applyDefaultsRolesToProject(Project project)
applyDefaultsRolesToProject
in interface ProjectRoleAndActorStore
public void removeAllRoleActorsByKeyAndType(String key, String type)
removeAllRoleActorsByKeyAndType
in interface ProjectRoleAndActorStore
public void removeAllRoleActorsByProject(Project project)
removeAllRoleActorsByProject
in interface ProjectRoleAndActorStore
public Collection<Long> getProjectIdsContainingRoleActorByKeyAndType(String key, String type)
getProjectIdsContainingRoleActorByKeyAndType
in interface ProjectRoleAndActorStore
public List<Long> roleActorOfTypeExistsForProjects(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String projectRoleParameter)
roleActorOfTypeExistsForProjects
in interface ProjectRoleAndActorStore
public Map<Long,List<String>> getProjectIdsForUserInGroupsBecauseOfRole(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String userKey)
getProjectIdsForUserInGroupsBecauseOfRole
in interface ProjectRoleAndActorStore
@EventListener public void onClearCache(ClearCacheEvent event)
public void clearCaches()
protected com.atlassian.jira.security.roles.CachingProjectRoleAndActorStore.CachedRoleActors toCachedRoleActor(@Nonnull DefaultRoleActors defaultRoleActors)
public boolean isGroupUsed(@Nonnull String group)
isGroupUsed
in interface ProjectRoleAndActorStore
Copyright © 2002-2019 Atlassian. All Rights Reserved.