public interface

ProjectManager

com.atlassian.jira.project.ProjectManager
Known Indirect Subclasses

Class Overview

Implementations of this interface are responsible for all management of project entities within JIRA.

Summary

Public Methods
List<Project> convertToProjectObjects(Collection<Long> projectIds)
Converts a collection of projectIds to a list of projects.
List<GenericValue> convertToProjects(Collection<Long> projectIds)
This method is deprecated. Use convertToProjectObjects(java.util.Collection) instead. Since v4.4.
Project createProject(String name, String key, String description, String lead, String url, Long assigneeType)
Creates the project in the database, and adds default project roles for this project.
Project createProject(String name, String key, String description, String leadKey, String url, Long assigneeType, Long avatarId)
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.
@Deprecated GenericValue getComponent(Long id)
This method is deprecated. Use ProjectComponentManager instead. Deprecated in v4.0.
@Deprecated GenericValue getComponent(GenericValue project, String name)
This method is deprecated. Use ProjectComponentManager instead. Deprecated in v4.0.
@Deprecated Collection<GenericValue> getComponents(GenericValue project)
This method is deprecated. Use ProjectComponentManager instead. Deprecated in v4.0.
long getCurrentCounterForProject(Long id)
Returns the curremt issue counter for the given project.
User getDefaultAssignee(Project project, ProjectComponent component)
This method is deprecated. Use getDefaultAssignee(Project, java.util.Collection) which allows for multiple components. Since v4.4.
User getDefaultAssignee(Project project, Collection<ProjectComponent> components)
Gets the default assignee for an issue given its project and list of Components.
User getDefaultAssignee(GenericValue project, GenericValue component)
This method is deprecated. Please use getDefaultAssignee(Project, ProjectComponent). Since v4.3
long getNextId(Project project)
Get the next issue ID from this project (transactional).
@Deprecated GenericValue getProject(Long id)
This method is deprecated. please use getProjectObj(Long)
@Deprecated GenericValue getProject(GenericValue issue)
This method is deprecated. Use getProjectObject() instead. Deprecated since v4.0.
@ExperimentalApi 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.
@Deprecated GenericValue getProjectByKey(String key)
This method is deprecated. please use the getProjectObjByKey(String) method to return a Project object
@Deprecated GenericValue getProjectByName(String name)
This method is deprecated. Please use getProjectObjByName(String) instead. Deprecated since v4.0.
Collection<GenericValue> getProjectCategories()
This method is deprecated. since v4.4. Use getAllProjectCategories() instead.
GenericValue getProjectCategory(Long id)
This method is deprecated. Use getProjectCategoryObject(Long) instead. Since v4.4.
GenericValue getProjectCategoryByName(String projectCategoryName)
This method is deprecated. Use getProjectCategoryObjectByName(String) instead. Since v4.4.
GenericValue getProjectCategoryByNameIgnoreCase(String projectCategoryName)
This method is deprecated. Use getProjectCategoryObjectByNameIgnoreCase(String) instead. Since v4.4.
ProjectCategory getProjectCategoryForProject(Project project)
Returns a project's category.
GenericValue getProjectCategoryFromProject(GenericValue project)
This method is deprecated. Use getProjectCategoryForProject(Project) instead. Since 4.4
ProjectCategory getProjectCategoryObject(Long id)
Returns a single project category by id.
ProjectCategory getProjectCategoryObjectByName(String projectCategoryName)
Find a project category by name.
ProjectCategory getProjectCategoryObjectByNameIgnoreCase(String projectCategoryName)
Find a project category by name ignoring the case of the category name.
long getProjectCount()
Return the total number of Projects.
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 Projects 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
Collection<GenericValue> getProjects()
This method is deprecated. Use getProjectObjects() instead. Deprecated in v4.0.
Collection<GenericValue> getProjectsByLead(User leadUser)
This method is deprecated. Use getProjectsLeadBy(com.atlassian.crowd.embedded.api.User) instead
Collection<Project> getProjectsFromProjectCategory(ProjectCategory projectCategory)
Returns a list of projects in a particular category.
Collection<GenericValue> getProjectsFromProjectCategory(GenericValue projectCategory)
This method is deprecated. Use getProjectsFromProjectCategory(ProjectCategory) instead. Since v4.4.
List<Project> getProjectsLeadBy(User leadUser)
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.
List<Project> getProjectsLeadBy(ApplicationUser leadUser)
Returns all the projects that leadUser is the project lead for ordered by the name of the Project.
Collection<GenericValue> getProjectsWithNoCategory()
This method is deprecated. Use getProjectObjectsWithNoCategory() instead. Since v4.4.
boolean isDefaultAssignee(GenericValue project)
This method is deprecated. Use getDefaultAssignee(Project, java.util.Collection) and check for DefaultAssigneeException. Since v4.4.
boolean isDefaultAssignee(GenericValue project, GenericValue component)
This method is deprecated. Use getDefaultAssignee(Project, java.util.Collection) and check for DefaultAssigneeException. Since v4.4.
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 setCurrentCounterForProject(Project project, long counter)
Set the project counter.
void setProjectCategory(Project project, ProjectCategory category)
Sets a project's category.
void setProjectCategory(GenericValue project, GenericValue category)
Project updateProject(Project originalProject, String name, String description, String leadKey, String url, Long assigneeType)
Updates the project provided with the new attributes passed in.
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.
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.
void updateProjectCategory(ProjectCategory projectCategory)
Persist an updated project category.
void updateProjectCategory(GenericValue projectCat)
This method is deprecated. Use updateProjectCategory(ProjectCategory) instead. Since v4.4.

Public Methods

public List<Project> convertToProjectObjects (Collection<Long> projectIds)

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

public List<GenericValue> convertToProjects (Collection<Long> projectIds)

This method is deprecated.
Use convertToProjectObjects(java.util.Collection) instead. Since v4.4.

Converts a collection of projectIds to a collection of projects. Will return null if is null or blank

Parameters
projectIds a Collection of Longs
Returns
  • List of Project GenericValues. Null if input is empty

public Project createProject (String name, String key, String description, String lead, String url, Long assigneeType)

Creates the project in the database, and adds default project roles for this project. If no name, key or lead are provided an exception will be thrown.

Parameters
name The name of the new project
key The project key of the new project
description An optional description for the project
lead The lead developer for the project
url An optional URL for the new project
assigneeType The default assignee for issues created in this project. May be either project lead, or unassigned if unassigned issues are enabled.
Returns
  • The newly created project.

public Project createProject (String name, String key, String description, String leadKey, String url, Long assigneeType, Long avatarId)

Creates the project in the database, and adds default project roles for this project. If no name, key or lead are provided an exception will be thrown.

WARNING: In 6.0, the documentation for this method incorrectly stated that this method would interpret the lead as a username, when it was in fact interpreted as a userkey. The method signatures and documentation have been updated to describe the actual behaviour.

Parameters
name The name of the new project
key The project key of the new project
description An optional description for the project
leadKey The userkey of the lead developer for the project
url An optional URL for the new project
assigneeType 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 system avatar.
Returns
  • The newly created project.

public ProjectCategory createProjectCategory (String name, String description)

Creates a new ProjectCategory with the given name and description.

Parameters
name the Name
description the Description.
Returns
  • the new ProjectCategory.

public Collection<ProjectCategory> getAllProjectCategories ()

Returns all ProjectCategories, ordered by name.

Returns
  • all ProjectCategories, ordered by name.
Throws
DataAccessException If any errors occur accessing the DB.

public Set<String> getAllProjectKeys (Long projectId)

Returns all project keys that are associated with Project.

Returns
  • all project keys (including the current one) associated with the project

@Deprecated public GenericValue getComponent (Long id)

This method is deprecated.
Use ProjectComponentManager instead. Deprecated in v4.0.

Get a component from within this project, by it's id.

Parameters
id id
Returns
  • A component GenericValue.
Throws
DataAccessException If any errors occur accessing the DB.
See Also

@Deprecated public GenericValue getComponent (GenericValue project, String name)

This method is deprecated.
Use ProjectComponentManager instead. Deprecated in v4.0.

Get a component from within this project, based on the project and the component name. NOTE: This is not cached currently.

Parameters
project project
name name
Returns
  • A component GenericValue.
Throws
DataAccessException If any errors occur accessing the DB.

@Deprecated public Collection<GenericValue> getComponents (GenericValue project)

This method is deprecated.
Use ProjectComponentManager instead. Deprecated in v4.0.

Returns a collection of components in a project.

Parameters
project project
Returns
  • A collection of GenericValues.
Throws
DataAccessException If any errors occur accessing the DB.

public long getCurrentCounterForProject (Long id)

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).

public User getDefaultAssignee (Project project, ProjectComponent component)

This method is deprecated.
Use getDefaultAssignee(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 project
component 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.

public User getDefaultAssignee (Project project, Collection<ProjectComponent> components)

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 project
components 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) .

public User getDefaultAssignee (GenericValue project, GenericValue component)

This method is deprecated.
Please use getDefaultAssignee(Project, ProjectComponent). Since v4.3

Gets the default assignee for a project and/or component depending on if a component was specified.

Parameters
project project
component component
Returns
Throws
DefaultAssigneeException If the default assignee does NOT have ASSIGNABLE permission OR Unassigned issues are turned off.

public long getNextId (Project project)

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.

@Deprecated public GenericValue getProject (Long id)

This method is deprecated.
please use getProjectObj(Long)

Retrieve a single project by it's id.

Parameters
id the Project ID.
Returns
  • GenericValue representation of a Project.
Throws
DataAccessException If any errors occur accessing the DB.

@Deprecated public GenericValue getProject (GenericValue issue)

This method is deprecated.
Use getProjectObject() instead. Deprecated since v4.0.

Returns a project GenericValue that an issue is in.

Parameters
issue the issue.
Returns
  • GenericValue representation of a Project.
Throws
DataAccessException If any errors occur accessing the DB.

@ExperimentalApi public Project getProjectByCurrentKey (String projectKey)

@ExperimentalApi

This method is considered usable by external developers but its contracts have not stabilized.

Experimental APIs may be changed at any time before being marked @Internal or @PublicApi.

Returns the 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.

Parameters
projectKey the Project key.
Returns
  • the Project with the given project key.

public 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.

Parameters
projectKey the project key, case does not matter.
Returns
  • the project object specified by the key or null if no such project exists.

@Deprecated public GenericValue getProjectByKey (String key)

This method is deprecated.
please use the getProjectObjByKey(String) method to return a Project object

Retrieve a single project by it's project key.

Parameters
key the project key
Returns
  • GenericValue representation of a Project.
Throws
DataAccessException If any errors occur accessing the DB.

@Deprecated public GenericValue getProjectByName (String name)

This method is deprecated.
Please use getProjectObjByName(String) instead. Deprecated since v4.0.

Retrieve a single project by it's project name.

Parameters
name project name
Returns
  • GenericValue representation of a Project.
Throws
DataAccessException If any errors occur accessing the DB.

public Collection<GenericValue> getProjectCategories ()

This method is deprecated.
since v4.4. Use getAllProjectCategories() instead.

Get all ProjectCategories.

Returns
  • A collection of category GenericValues
Throws
DataAccessException If any errors occur accessing the DB.

public GenericValue getProjectCategory (Long id)

This method is deprecated.
Use getProjectCategoryObject(Long) instead. Since v4.4.

Returns a single project category by id.

Parameters
id Project Category ID.
Returns
  • A category GenericValue

public GenericValue getProjectCategoryByName (String projectCategoryName)

This method is deprecated.
Use getProjectCategoryObjectByName(String) instead. Since v4.4.

Find a project category by name. NOTE: The current implementation is not the most efficient.

Parameters
projectCategoryName Name of the Project Category
Returns
  • A category GenericValue
Throws
DataAccessException If any errors occur accessing the DB.

public GenericValue getProjectCategoryByNameIgnoreCase (String projectCategoryName)

This method is deprecated.
Use getProjectCategoryObjectByNameIgnoreCase(String) instead. Since v4.4.

Find a project category by name ignoring the case of the category name. NOTE: The current implementation is not the most efficient.

Parameters
projectCategoryName Name of the Project Category
Returns
  • A category GenericValue
Throws
DataAccessException If any errors occur accessing the DB.

public ProjectCategory getProjectCategoryForProject (Project project)

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.

public GenericValue getProjectCategoryFromProject (GenericValue project)

This method is deprecated.
Use getProjectCategoryForProject(Project) instead. Since 4.4

Returns a project's category.

Parameters
project project
Returns
  • A category GenericValue or null if no category exists.
Throws
DataAccessException If any errors occur accessing the DB.

public ProjectCategory getProjectCategoryObject (Long id)

Returns a single project category by id.

Parameters
id Project Category ID.
Returns
  • The project category

public ProjectCategory getProjectCategoryObjectByName (String projectCategoryName)

Find a project category by name.

Parameters
projectCategoryName Name of the Project Category
Returns
  • The ProjectCategory or null if none found

public ProjectCategory getProjectCategoryObjectByNameIgnoreCase (String projectCategoryName)

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

public long getProjectCount ()

Return the total number of Projects.

Returns
  • A long value representing tht total number of projects.
Throws
DataAccessException if any errors occur accessing the DB.

public Project getProjectObj (Long id)

Retrieves a single Project 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.

public Project getProjectObjByKey (String projectKey)

Returns a Project object based on the passed in project key.

Parameters
projectKey the Project key.
Returns
  • the Project object specified by the key or null

public 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. 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.

public Project getProjectObjByName (String projectName)

Returns a Project 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

public List<Project> getProjectObjects ()

Return all Projects ordered by name.

Returns
  • all projects ordered by name.
Throws
DataAccessException If any errors occur accessing the DB.

public Collection<Project> getProjectObjectsFromProjectCategory (Long projectCategoryId)

Returns a list of projects in a particular category.

Parameters
projectCategoryId project category id.
Returns
  • A collection of project Projects sorted by name.
Throws
DataAccessException If any errors occur accessing the DB.

public Collection<Project> getProjectObjectsWithNoCategory ()

Returns a list of projects without project category, sorted by project name

Returns
  • A collection of Projects sorted by name
Throws
DataAccessException If any errors occur accessing the DB.

public Collection<GenericValue> getProjects ()

This method is deprecated.
Use getProjectObjects() instead. Deprecated in v4.0.

Return all project GenericValues.

Returns
  • all projects as Collection
Throws
DataAccessException If any errors occur accessing the DB.

public Collection<GenericValue> getProjectsByLead (User leadUser)

This method is deprecated.
Use getProjectsLeadBy(com.atlassian.crowd.embedded.api.User) instead

Returns all the projects that leadUser is the project lead for.

Parameters
leadUser Project Lead
Returns
  • A collection of project GenericValues

public Collection<Project> getProjectsFromProjectCategory (ProjectCategory projectCategory)

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.

public Collection<GenericValue> getProjectsFromProjectCategory (GenericValue projectCategory)

This method is deprecated.
Use getProjectsFromProjectCategory(ProjectCategory) instead. Since v4.4.

Returns a list of projects in a particular category.

Parameters
projectCategory project category.
Returns
  • A collection of project GenericValues sorted by name.
Throws
DataAccessException If any errors occur accessing the DB.

public List<Project> getProjectsLeadBy (User leadUser)

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

public List<Project> getProjectsLeadBy (ApplicationUser leadUser)

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

public Collection<GenericValue> getProjectsWithNoCategory ()

This method is deprecated.
Use getProjectObjectsWithNoCategory() instead. Since v4.4.

Returns a list of projects without project category, sorted by project name

Returns
  • A collection of project GenericValues sorted by name
Throws
DataAccessException If any errors occur accessing the DB.

public boolean isDefaultAssignee (GenericValue project)

This method is deprecated.
Use getDefaultAssignee(Project, java.util.Collection) and check for DefaultAssigneeException. Since v4.4.

Checks if there is a valid default assignee for a given project.

Parameters
project project
Returns
  • False if no assignee type is set for a project and unassigned issues are not allowed, and the projectlead is not assignable. Also false, if either the assigneetype is not unassigned or unassigned issues are not allowed and the projectlead is not assignable. Otherwise returns TRUE since there is a default assignee.

public boolean isDefaultAssignee (GenericValue project, GenericValue component)

This method is deprecated.
Use getDefaultAssignee(Project, java.util.Collection) and check for DefaultAssigneeException. Since v4.4.

This function checks if there is a valid default assignee set in the system
If this returns false then the getDefaultAssignee(GenericValue, GenericValue) will throw an exception

Parameters
project project
component component
Returns

public void refresh ()

Causes a full refresh of the project cache.

public void removeProject (Project project)

Deletes the provided project from the database. Please note that this method only deletes the project itself and not any related entities. Use deleteProject(User, ProjectService.DeleteProjectValidationResult) to properly delete a project.

Parameters
project The project to be deleted.

public void removeProjectCategory (Long id)

Removes the given ProjectCategory.

Parameters
id the ProjectCategory to remove.

public void removeProjectIssues (Project project)

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

public void setCurrentCounterForProject (Project project, long counter)

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

public void setProjectCategory (Project project, ProjectCategory category)

Sets a project's category.

Parameters
project project
category category
Throws
DataAccessException If any errors occur accessing the DB.
IllegalArgumentException if the project provided is null

public void setProjectCategory (GenericValue project, GenericValue category)

This method is deprecated.
since v4.4. Use setProjectCategory(com.atlassian.jira.project.Project, com.atlassian.jira.project.ProjectCategory) instead.

Sets a projects category.

Parameters
project project
category category
Throws
DataAccessException If any errors occur accessing the DB.
IllegalArgumentException if the project provided is null

public 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 project
description An optional description for the project
leadKey The userkey of the lead developer for the project
url An optional URL for the updated project
assigneeType 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

public 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 project
description An optional description for the project
leadKey The userkey of the lead developer for the project
url An optional URL for the updated project
assigneeType 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

public 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 project
description An optional description for the project
leadKey The userkey of the lead developer for the project
url An optional URL for the updated project
assigneeType 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

public void updateProjectCategory (ProjectCategory projectCategory)

Persist an updated project category.

Parameters
projectCategory project category.
Throws
DataAccessException If any errors occur accessing the DB.

public void updateProjectCategory (GenericValue projectCat)

This method is deprecated.
Use updateProjectCategory(ProjectCategory) instead. Since v4.4.

Persist an updated project category.

Parameters
projectCat project category.
Throws
DataAccessException If any errors occur accessing the DB.