public abstract class

AbstractProjectManager

extends Object
implements ProjectManager
java.lang.Object
   ↳ com.atlassian.jira.project.AbstractProjectManager
Known Direct Subclasses

Summary

Public Constructors
AbstractProjectManager(UserManager userManager, ApplicationProperties applicationProperties)
Public Methods
List<Project> convertToProjectObjects(Collection<Long> projectIds)
Converts a collection of projectIds to a list of projects.
List<GenericValue> convertToProjects(Collection<Long> projectIds)
Converts a collection of projectIds to a collection of projects.
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.
User getDefaultAssignee(Project project, ProjectComponent component)
Gets the default assignee for a project and/or component depending on if a component was specified.
User getDefaultAssignee(GenericValue project, GenericValue component)
This function returns the default assignee if the system has been setup incorrectly then it will throw an error The isDefaultAssignee(GenericValue, GenericValue) checks if there is a valid default assignee
User getDefaultAssignee(Project project, Collection<ProjectComponent> components)
Gets the default assignee for an issue given its project and list of Components.
GenericValue getProject(GenericValue issue)
Returns a project GenericValue that an issue is in.
Project getProjectByCurrentKey(String projectKey)
Returns the Project with the given project key.
GenericValue getProjectCategoryByName(String projectCategoryName)
Find a project category by name.
GenericValue getProjectCategoryByNameIgnoreCase(String projectCategoryName)
Find a project category by name ignoring the case of the category name.
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.
boolean isDefaultAssignee(GenericValue project, GenericValue component)
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
boolean isDefaultAssignee(GenericValue project)
Checks if there is a valid default assignee for a given project.
Project updateProject(Project updatedProject, String name, String description, String lead, String url, Long assigneeType, Long avatarId)
Updates the project provided with the new attributes passed in.
Project updateProject(Project updatedProject, String name, String description, String lead, String url, Long assigneeType)
Updates the project provided with the new attributes passed in.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.project.ProjectManager

Public Constructors

public AbstractProjectManager (UserManager userManager, ApplicationProperties applicationProperties)

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)

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 User getDefaultAssignee (Project project, ProjectComponent component)

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

public User getDefaultAssignee (GenericValue project, GenericValue component)

This function returns the default assignee if the system has been setup incorrectly then it will throw an error The isDefaultAssignee(GenericValue, GenericValue) checks if there is a valid default assignee

Parameters
project project
component component
Returns

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

public GenericValue getProject (GenericValue issue)

Returns a project GenericValue that an issue is in.

Parameters
issue the issue.
Returns
  • GenericValue representation of a Project.

public Project getProjectByCurrentKey (String projectKey)

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 GenericValue getProjectCategoryByName (String projectCategoryName)

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

public GenericValue getProjectCategoryByNameIgnoreCase (String projectCategoryName)

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

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 boolean isDefaultAssignee (GenericValue project, GenericValue component)

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 boolean isDefaultAssignee (GenericValue project)

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 projectleas is not assignable. Otherwise there is a default assigneed.

public Project updateProject (Project updatedProject, String name, String description, String lead, 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
updatedProject The project to be updated.
name The name for the updated project
description An optional description for the project
lead 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 Project updateProject (Project updatedProject, String name, String description, String lead, 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
updatedProject The project to be updated.
name The name for the updated project
description An optional description for the project
lead 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