Interface ProjectManager
- All Known Implementing Classes:
AbstractProjectManager
,CachingProjectManager
,DefaultProjectManager
,MockProjectManager
-
Method Summary
Modifier and TypeMethodDescriptionconvertToOptionalProjectObjects
(Collection<Long> projectIds) Converts a collection of projectIds to a list of pairs (project id, optional project).convertToProjectObjects
(Collection<Long> projectIds) Converts a collection of projectIds to a list of projects.createProject
(ApplicationUser user, ProjectCreationData projectCreationData) Creates the project in the database, and adds default project roles for this project.createProjectCategory
(String name, String description) Creates a new ProjectCategory with the given name and description.Returns all ProjectCategories, ordered by name.getAllProjectKeys
(Long projectId) Returns all project keys that are associated withProject
.Return archivedProject
s ordered by name.long
Returns the curremt issue counter for the given project.getDefaultAssignee
(Project project, ProjectComponent component) Deprecated.getDefaultAssignee
(Project project, Collection<ProjectComponent> components) Gets the default assignee for an issue given its project and list of Components.long
Get the next issue ID from this project (transactional).getProjectByCurrentKey
(String projectKey) Returns theProject
with the given project key.getProjectByCurrentKeyIgnoreCase
(String projectKey) Returns aProject
object based on the passed in project key, not taking into account the case of the project key.Returns a single project category by id.getProjectCategoryForProject
(Project project) Returns a project's category.Returns a single project category by id.getProjectCategoryObjectByName
(String projectCategoryName) Find a project category by name.getProjectCategoryObjectByNameIgnoreCase
(String projectCategoryName) Find a project category by name ignoring the case of the category name.long
Return the total number ofProject
s.getProjectObj
(Long id) Retrieves a singleProject
by its id.getProjectObjByKey
(String projectKey) Returns aProject
object based on the passed in project key.getProjectObjByKeyIgnoreCase
(String projectKey) Returns aProject
object based on the passed in project key, not taking into account the case of the project key.getProjectObjByName
(String projectName) Returns aProject
object based on the passed in project name.Return all openProject
s ordered by name.getProjectObjectsFromProjectCategory
(Long projectCategoryId) Returns a list of projects in a particular category.Returns a list of projects without project category, sorted by project nameReturn all activeProject
s ordered by name.getProjectsByArgs
(Collection<String> projectArgs) Resolve project arguments(ID, name or key) into list of project objects.getProjectsFromProjectCategory
(ProjectCategory projectCategory) Returns a list of projects in a particular category.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.void
refresh()
Causes a full refresh of the project cache.void
removeProject
(Project project) Deletes the provided project from the database.void
Removes the given ProjectCategory.void
removeProjectIssues
(Project project) Deprecated.since v7.1.1.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.updateProject
(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType) Updates the project provided with the new attributes passed in.updateProject
(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId) Updates the project provided with the new attributes passed in.updateProject
(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId, String projectKey) Updates the project provided with the new attributes passed in.updateProject
(UpdateProjectParameters parameters) Updates the project with the given changes.void
updateProjectCategory
(ProjectCategory projectCategory) Persist an updated project category.updateProjectType
(ApplicationUser user, Project project, ProjectTypeKey newProjectType) Updates the type of a project.
-
Method Details
-
createProject
Project createProject(@Nonnull ApplicationUser user, @Nonnull ProjectCreationData projectCreationData) Creates the project in the database, and adds default project roles for this project.If no name, key, lead or project type are provided an exception will be thrown.
- Parameters:
user
- The user creating the projectprojectCreationData
- An object encapsulating all the data for the project that will get created- Returns:
- The newly created project.
- Since:
- 7.0
- See Also:
-
updateProject
Project updateProject(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType) Updates the project provided with the new attributes passed in. This method is responsible for persisting any changes to the database.- Parameters:
originalProject
- 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.- Returns:
- The updated project
-
updateProject
Project updateProject(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId, String projectKey) Updates the project provided with the new attributes passed in. This method is responsible for persisting any changes to the database.- Parameters:
originalProject
- 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)- Returns:
- The updated project
- Since:
- v6.1
-
updateProject
Project updateProject(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType, Long avatarId) Updates the project provided with the new attributes passed in. This method is responsible for persisting any changes to the database.- Parameters:
originalProject
- 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.avatarId
- the id of an existing avatar.- Returns:
- The updated project
-
updateProject
Updates the project with the given changes.- Parameters:
parameters
- containing the changes to the project that needs to be made.- Returns:
- The updated project
- Since:
- v7.2
-
updateProjectType
Updates the type of a project.- Parameters:
user
- The user performing the actionproject
- The project which type needs to be updatednewProjectType
- The new project type- Returns:
- The updated project
- Since:
- 7.0
-
removeProjectIssues
Deprecated.since v7.1.1. UseremoveProjectIssues(Project, Context)
Removes all issues for a particular project. A RemoveException will be thrown on any errors removing issues.- Parameters:
project
- The project for which issues will be deleted.- Throws:
RemoveException
- if there's any errors removing issues
-
removeProjectIssues
Removes all issues for a particular project. A RemoveException will be thrown on any errors removing issues.- Parameters:
project
- The project for which issues will be deleted.taskContext
- A task context for providing progress.- Throws:
RemoveException
- if there's any errors removing issues- Since:
- 7.1.1
-
removeProject
Deletes the provided project from the database. Please note that this method only deletes the project itself and not any related entities. UseProjectService.deleteProject(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.bc.project.ProjectService.DeleteProjectValidationResult)
to properly delete a project.- Parameters:
project
- The project to be deleted.
-
getProjectObj
Retrieves a singleProject
by its id.- Parameters:
id
- ID of the Project.- Returns:
- Project object or null if project with that id doesn't exist.
- Throws:
DataAccessException
- If any errors occur accessing the DB.
-
getProjectObjByName
Returns aProject
object based on the passed in project name.- Parameters:
projectName
- the name of the project- Returns:
- the
Project
object specified by the supplied name or null
-
getProjectObjByKey
Returns aProject
object based on the passed in project key.- Parameters:
projectKey
- the Project key.- Returns:
- the
Project
object specified by the key or null
-
getProjectByCurrentKey
Returns theProject
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.
- Parameters:
projectKey
- the Project key.- Returns:
- the
Project
with the given project key. - Since:
- 6.0
- See Also:
-
getProjectByCurrentKeyIgnoreCase
Returns aProject
object based on the passed in project key, not taking into account the case of the project key.- Parameters:
projectKey
- the project key, case does not matter.- Returns:
- the project object specified by the key or null if no such project exists.
-
getProjectObjByKeyIgnoreCase
Returns aProject
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.- Parameters:
projectKey
- the project key, case does not matter.- Returns:
- the project object specified by the key or null if no such project exists.
-
getProjectsByArgs
Resolve project arguments(ID, name or key) into list of project objects.- Parameters:
projectArgs
- set of arguments: ID, key or name- Returns:
- the collection of projects
-
getAllProjectKeys
Returns all project keys that are associated withProject
.- Returns:
- all project keys (including the current one) associated with the project
-
getProjects
Return all activeProject
s ordered by name. A project is considered active if it is not archived.- Returns:
- all active projects ordered by name.
-
getArchivedProjects
Return archivedProject
s ordered by name.- Returns:
- all projects ordered by name.
-
getProjectObjects
Return all openProject
s ordered by name.This method does the same thing as getProjects() and exists for legacy reasons.
- Returns:
- all projects ordered by name.
- Throws:
DataAccessException
- If any errors occur accessing the DB.- See Also:
-
getProjectCount
Return the total number ofProject
s.- Returns:
- A long value representing tht total number of projects.
- Throws:
DataAccessException
- if any errors occur accessing the DB.
-
getNextId
Get the next issue ID from this project (transactional). Each project maintains an internal counter for the number of issues. This method may be used to construct a new issue key.- Parameters:
project
- The Project- Returns:
- A long value representing a new issue id for the project.
- Throws:
DataAccessException
- If any errors occur accessing the DB.
-
refresh
void refresh()Causes a full refresh of the project cache. -
getAllProjectCategories
Returns all ProjectCategories, ordered by name.- Returns:
- all ProjectCategories, ordered by name.
- Throws:
DataAccessException
- If any errors occur accessing the DB.
-
getProjectCategory
Returns a single project category by id.- Parameters:
id
-ProjectCategory
id.- Returns:
- the
ProjectCategory
for the provided id if it was found or else null - Throws:
DataAccessException
- If any errors occur accessing the DB.
-
getProjectCategoryObject
Returns a single project category by id.Legacy synonym for
getProjectCategory(Long)
- Parameters:
id
- Project Category ID.- Returns:
- The project category
- Throws:
DataAccessException
-
getProjectCategoryObjectByName
Find a project category by name.- Parameters:
projectCategoryName
- Name of the Project Category- Returns:
- The ProjectCategory or null if none found
-
getProjectCategoryObjectByNameIgnoreCase
Find a project category by name ignoring the case of the category name.- Parameters:
projectCategoryName
- Name of the Project Category- Returns:
- The ProjectCategory or null if none found
-
updateProjectCategory
Persist an updated project category.- Parameters:
projectCategory
- project category.- Throws:
DataAccessException
- If any errors occur accessing the DB.
-
getProjectsFromProjectCategory
Collection<Project> getProjectsFromProjectCategory(ProjectCategory projectCategory) throws DataAccessException Returns a list of projects in a particular category.- Parameters:
projectCategory
- project category.- Returns:
- A collection of projects sorted by name.
- Throws:
DataAccessException
- If any errors occur accessing the DB.
-
getProjectObjectsFromProjectCategory
Collection<Project> getProjectObjectsFromProjectCategory(Long projectCategoryId) throws DataAccessException Returns a list of projects in a particular category.- Parameters:
projectCategoryId
- project category id.- Returns:
- A collection of project
Project
s sorted by name. - Throws:
DataAccessException
- If any errors occur accessing the DB.- Since:
- v4.0
-
getProjectObjectsWithNoCategory
Returns a list of projects without project category, sorted by project name- Returns:
- A collection of
Project
s sorted by name - Throws:
DataAccessException
- If any errors occur accessing the DB.- Since:
- v4.0
-
getProjectCategoryForProject
Returns a project's category.- Parameters:
project
- project- Returns:
- A ProjectCategory or null if this project has no category.
- Throws:
DataAccessException
- If any errors occur accessing the DB.- Since:
- 4.4
-
setProjectCategory
Sets a project's category.- Parameters:
project
- projectcategory
- category- Throws:
DataAccessException
- If any errors occur accessing the DB.IllegalArgumentException
- if the project provided is null
-
createProjectCategory
Creates a new ProjectCategory with the given name and description.- Parameters:
name
- the Namedescription
- the Description.- Returns:
- the new ProjectCategory.
-
removeProjectCategory
Removes the given ProjectCategory.- Parameters:
id
- the ProjectCategory to remove.
-
isProjectCategoryUnique
Checks if a project category with a given name exists.- Parameters:
projectCategory
- the name of the project category- Returns:
- if a category with given name exists
-
getDefaultAssignee
Deprecated.UsegetDefaultAssignee(Project, java.util.Collection)
which allows for multiple components. Since v4.4.Gets the default assignee for a project and/or component depending on if a component was specified.- Parameters:
project
- projectcomponent
- component- Returns:
- the default assignee for this project/component
- Throws:
DefaultAssigneeException
- If the default assignee does NOT have ASSIGNABLE permission OR Unassigned issues are turned off.
-
getDefaultAssignee
ApplicationUser getDefaultAssignee(Project project, Collection<ProjectComponent> components) throws DefaultAssigneeException Gets the default assignee for an issue given its project and list of Components.If the default assignee configuration is invalid, then a DefaultAssigneeException is thrown. This could be because the default is unassigned, and unassigned issues are not allowed, or because the default user does not have permission to be assigned to issues in this project.
- Parameters:
project
- projectcomponents
- The components- Returns:
- the default assignee for this project/components
- Throws:
DefaultAssigneeException
- If the default assignee is invalid (eg user does not have assign permission) .
-
getProjectsLeadBy
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.- Parameters:
leadUser
- Project Lead- Returns:
- A collection of projects
-
convertToProjectObjects
Converts a collection of projectIds to a list of projects.Will return null if incoming collection is null.
The returned list of Project Objects will have the same sort order as the incoming collection of IDs.
- Parameters:
projectIds
- a Collection of Project IDs- Returns:
- List of Projects, or null if input is null
-
convertToOptionalProjectObjects
Converts a collection of projectIds to a list of pairs (project id, optional project).Will return empty list if incoming collection is null.
The returned list of Project Objects will have the same sort order as the incoming collection of IDs.
- Parameters:
projectIds
- a Collection of Project IDs- Returns:
- List of Pairs (Project ID, Optional Project), or empty list if input is null
-
getCurrentCounterForProject
Returns the curremt issue counter for the given project. This value is for information only; you should not use it to predict or create issue ids, because it may change concurrently as new issues are created.- Parameters:
id
- the ID of the project for which to retrieve the counter- Returns:
- the current project counter (the id of the next issue to be created).
-
setCurrentCounterForProject
Set the project counter. Warning Setting the project counter is not needed in the normal operations of JIRA, this method exist for functionality like project-import etc.- Parameters:
project
- the project for which to set the counter (required)counter
- the counter value to set
-
getDefaultAssignee(Project, java.util.Collection)
which allows for multiple components.