public class CachingProjectManager extends AbstractProjectManager
Constructor and Description |
---|
CachingProjectManager(ProjectManager delegateProjectManager,
ProjectComponentManager projectComponentManager,
ProjectFactory projectFactory,
UserManager userManager,
ApplicationProperties applicationProperties,
ProjectKeyStore projectKeyStore,
com.atlassian.cache.CacheManager cacheManager,
NodeAssociationStore nodeAssociationStore) |
Modifier and Type | Method and Description |
---|---|
Project |
createProject(ApplicationUser user,
ProjectCreationData projectCreationData)
Creates the project in the database, and adds default project roles for this project.
|
ProjectCategory |
createProjectCategory(String name,
String description)
Creates a new ProjectCategory with the given name and description.
|
Collection<ProjectCategory> |
getAllProjectCategories()
Returns all ProjectCategories, ordered by name.
|
Set<String> |
getAllProjectKeys(Long projectId)
Returns all project keys that are associated with
Project . |
List<Project> |
getArchivedProjects()
Return archived
Project s ordered by name. |
long |
getCurrentCounterForProject(Long id)
Returns the curremt issue counter for the given project.
|
long |
getNextId(Project project)
Get the next issue ID from this project (transactional).
|
Project |
getProjectByCurrentKey(String projectKey)
Returns the
Project with the given project key. |
Project |
getProjectByCurrentKeyIgnoreCase(String projectKey)
Returns a
Project object based on the passed in project key, not taking into account the case
of the project key. |
ProjectCategory |
getProjectCategory(Long id)
Returns a single project category by id.
|
ProjectCategory |
getProjectCategoryForProject(Project project)
Returns a project's category.
|
ProjectCategory |
getProjectCategoryObject(Long id)
Returns a single project category by id.
|
long |
getProjectCount()
Return the total number of
Project s. |
Project |
getProjectObj(Long id)
Retrieves a single
Project by its id. |
Project |
getProjectObjByKey(String projectKey)
Returns a
Project object based on the passed in project key. |
Project |
getProjectObjByKeyIgnoreCase(String projectKey)
Returns a
Project object based on the passed in project key, not taking into account the case
of the project key. |
Project |
getProjectObjByName(String projectName)
Returns a
Project object based on the passed in project name. |
List<Project> |
getProjectObjects()
Return all open
Project s ordered by name. |
Collection<Project> |
getProjectObjectsFromProjectCategory(Long projectCategoryId)
Returns a list of projects in a particular category.
|
Collection<Project> |
getProjectObjectsWithNoCategory()
Returns a list of projects without project category, sorted by project name
|
List<Project> |
getProjects()
Return all
Project s ordered by name. |
Collection<Project> |
getProjectsFromProjectCategory(ProjectCategory projectCategory)
Returns a list of projects in a particular category.
|
List<Project> |
getProjectsLeadBy(ApplicationUser leadUser)
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.
|
boolean |
isProjectCategoryUnique(String projectCategory)
Checks if a project category with a given name exists.
|
protected static <T> Collection<T> |
noNull(Collection<T> col) |
void |
onClearCache(ClearCacheEvent event) |
void |
onProjectFKChangedEvent(ProjectFKChangedEvent event) |
void |
refresh()
Causes a full refresh of the project cache.
|
void |
removeProject(Project project)
Deletes the provided project from the database.
|
void |
removeProjectCategory(Long id)
Removes the given ProjectCategory.
|
void |
removeProjectIssues(Project project)
Removes all issues for a particular project.
|
void |
removeProjectIssues(Project project,
Context taskContext)
Removes all issues for a particular project.
|
void |
setCurrentCounterForProject(Project project,
long counter)
Set the project counter.
|
void |
setProjectCategory(Project project,
ProjectCategory category)
Sets a project's category.
|
void |
updateCache() |
Project |
updateProject(Project updatedProject,
String name,
String description,
String leadKey,
String url,
Long assigneeType,
Long avatarId,
String projectKey)
Updates the project provided with the new attributes passed in.
|
Project |
updateProject(UpdateProjectParameters parameters)
Updates the project with the given changes.
|
void |
updateProjectCategory(ProjectCategory projectCategory)
Persist an updated project category.
|
Project |
updateProjectType(ApplicationUser user,
Project project,
ProjectTypeKey newProjectType)
Updates the type of a project.
|
convertToOptionalProjectObjects, convertToProjectObjects, getDefaultAssignee, getDefaultAssignee, getProjectCategoryObjectByName, getProjectCategoryObjectByNameIgnoreCase, getProjectsByArgs, updateProject, updateProject
public CachingProjectManager(ProjectManager delegateProjectManager, ProjectComponentManager projectComponentManager, ProjectFactory projectFactory, UserManager userManager, ApplicationProperties applicationProperties, ProjectKeyStore projectKeyStore, com.atlassian.cache.CacheManager cacheManager, NodeAssociationStore nodeAssociationStore)
@EventListener public void onClearCache(ClearCacheEvent event)
@EventListener public void onProjectFKChangedEvent(ProjectFKChangedEvent event)
public void updateCache()
public long getNextId(Project project)
ProjectManager
project
- The Projectpublic void refresh()
ProjectManager
public Project getProjectObj(Long id)
ProjectManager
Project
by its id.id
- ID of the Project.public Project getProjectObjByKey(String projectKey)
ProjectManager
Project
object based on the passed in project key.projectKey
- the Project key.Project
object specified by the key or nullpublic Project getProjectByCurrentKey(String projectKey)
ProjectManager
Project
with the given project key.
This method will strictly only return the project whose current project key is the one given.
This method is added to the API in anticipation of being able to edit the project key, but this feature has not actually been added in 6.0.
getProjectByCurrentKey
in interface ProjectManager
getProjectByCurrentKey
in class AbstractProjectManager
projectKey
- the Project key.Project
with the given project key.ProjectManager.getProjectObjByKey(String)
public Project getProjectByCurrentKeyIgnoreCase(String projectKey)
ProjectManager
Project
object based on the passed in project key, not taking into account the case
of the project key.projectKey
- the project key, case does not matter.public Project getProjectObjByKeyIgnoreCase(String projectKey)
ProjectManager
Project
object based on the passed in project key, not taking into account the case
of the project key. Matches also by previous keys that were associated with a project.projectKey
- the project key, case does not matter.public Set<String> getAllProjectKeys(Long projectId)
ProjectManager
Project
.public Project getProjectObjByName(String projectName)
ProjectManager
Project
object based on the passed in project name.projectName
- the name of the projectProject
object specified by the supplied name or null@Nonnull public List<Project> getProjects()
ProjectManager
Project
s ordered by name.@Nonnull public List<Project> getArchivedProjects()
ProjectManager
Project
s ordered by name.@Nonnull public List<Project> getProjectObjects()
ProjectManager
Project
s ordered by name.
This method does the same thing as getProjects() and exists for legacy reasons.
ProjectManager.getProjects()
public long getProjectCount() throws DataAccessException
ProjectManager
Project
s.DataAccessException
- if any errors occur accessing the DB.protected static <T> Collection<T> noNull(Collection<T> col)
public Project createProject(@Nonnull ApplicationUser user, @Nonnull ProjectCreationData projectCreationData)
ProjectManager
If no name, key, lead or project type are provided an exception will be thrown.
user
- The user creating the projectprojectCreationData
- An object encapsulating all the data for the project that will get createdProjectCreationData
public Project updateProject(UpdateProjectParameters parameters)
ProjectManager
parameters
- containing the changes to the project that needs to be made.public Project updateProject(Project updatedProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId, String projectKey)
ProjectManager
updatedProject
- The project to be updated.name
- The name for the updated projectdescription
- An optional description for the projectleadKey
- The userkey of the lead developer for the projecturl
- An optional URL for the updated projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.projectKey
- The new project key (not updated if null)public Project updateProjectType(ApplicationUser user, Project project, ProjectTypeKey newProjectType)
ProjectManager
user
- The user performing the actionproject
- The project which type needs to be updatednewProjectType
- The new project typepublic void removeProjectIssues(Project project) throws RemoveException
ProjectManager
project
- The project for which issues will be deleted.RemoveException
- if there's any errors removing issuespublic void removeProjectIssues(Project project, Context taskContext) throws RemoveException
ProjectManager
project
- The project for which issues will be deleted.taskContext
- A task context for providing progress.RemoveException
- if there's any errors removing issuespublic void removeProject(Project project)
ProjectManager
ProjectService.deleteProject(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.bc.project.ProjectService.DeleteProjectValidationResult)
to
properly delete a project.project
- The project to be deleted.public Collection<ProjectCategory> getAllProjectCategories()
ProjectManager
public ProjectCategory getProjectCategory(Long id)
ProjectManager
id
- ProjectCategory
id.ProjectCategory
for the provided id if it was found or else null@Nullable public ProjectCategory getProjectCategoryObject(Long id)
ProjectManager
Legacy synonym for ProjectManager.getProjectCategory(Long)
id
- Project Category ID.public void updateProjectCategory(ProjectCategory projectCategory) throws DataAccessException
ProjectManager
projectCategory
- project category.DataAccessException
- If any errors occur accessing the DB.public Collection<Project> getProjectsFromProjectCategory(ProjectCategory projectCategory) throws DataAccessException
ProjectManager
projectCategory
- project category.DataAccessException
- If any errors occur accessing the DB.public Collection<Project> getProjectObjectsFromProjectCategory(Long projectCategoryId)
ProjectManager
projectCategoryId
- project category id.Project
s sorted by name.@Nullable public ProjectCategory getProjectCategoryForProject(Project project)
ProjectManager
project
- projectpublic Collection<Project> getProjectObjectsWithNoCategory() throws DataAccessException
ProjectManager
Project
s sorted by nameDataAccessException
- If any errors occur accessing the DB.public void setProjectCategory(Project project, ProjectCategory category) throws DataAccessException
ProjectManager
project
- projectcategory
- categoryDataAccessException
- If any errors occur accessing the DB.public List<Project> getProjectsLeadBy(ApplicationUser leadUser)
ProjectManager
leadUser
- Project Leadpublic ProjectCategory createProjectCategory(String name, String description)
ProjectManager
name
- the Namedescription
- the Description.public void removeProjectCategory(Long id)
ProjectManager
id
- the ProjectCategory to remove.public boolean isProjectCategoryUnique(String projectCategory)
ProjectManager
projectCategory
- the name of the project categorypublic long getCurrentCounterForProject(Long id)
ProjectManager
id
- the ID of the project for which to retrieve the counterpublic void setCurrentCounterForProject(Project project, long counter)
ProjectManager
project
- the project for which to set the counter (required)counter
- the counter value to setCopyright © 2002-2024 Atlassian. All Rights Reserved.