@PublicApi public interface

ProjectService

com.atlassian.jira.bc.project.ProjectService
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Summary

Nested Classes
class ProjectService.AbstractProjectResult  
class ProjectService.AbstractProjectValidationResult  
class ProjectService.CreateProjectResult  
class ProjectService.CreateProjectValidationResult  
class ProjectService.DeleteProjectResult  
class ProjectService.DeleteProjectValidationResult  
class ProjectService.GetProjectResult  
class ProjectService.UpdateProjectSchemesValidationResult  
class ProjectService.UpdateProjectValidationResult  
Constants
int DEFAULT_NAME_LENGTH Default project name length
int MAX_KEY_LENGTH This constant is deprecated. use getMaximumKeyLength() instead
int MAX_NAME_LENGTH This constant is deprecated. use getMaximumNameLength() instead;
int MIN_NAME_LENGTH The minimum length allowed for the project name field.
String PROJECT_DESCRIPTION The default name of HTML fields containing a Project's description.
String PROJECT_KEY The default name of HTML fields containing a Project's key.
String PROJECT_LEAD The default name of HTML fields containing a Project's lead.
String PROJECT_NAME The default name of HTML fields containing a Project's name.
String PROJECT_URL The default name of HTML fields containing a Project's URL.
Public Methods
Project createProject(ProjectService.CreateProjectValidationResult createProjectValidationResult)
Using the validation result from validateCreateProject(User, String, String, String, String, String, Long) a new project will be created.
ProjectService.DeleteProjectResult deleteProject(ApplicationUser user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult.
ProjectService.DeleteProjectResult deleteProject(User user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult.
ServiceOutcome<List<Project>> getAllProjects(User user)
Used to retrieve a list of Project objects.
ServiceOutcome<List<Project>> getAllProjects(ApplicationUser user)
Used to retrieve a list of Project objects.
ServiceOutcome<List<Project>> getAllProjectsForAction(ApplicationUser user, ProjectAction action)
Used to retrieve a list of Project objects.
ServiceOutcome<List<Project>> getAllProjectsForAction(User user, ProjectAction action)
Used to retrieve a list of Project objects.
int getMaximumKeyLength()
Used to retrieve the maximum length allowed for new project keys.
int getMaximumNameLength()
Used to retrieve the maximum length allowed for new project names.
ProjectService.GetProjectResult getProjectById(User user, Long id)
Used to retrieve a Project object by id.
ProjectService.GetProjectResult getProjectById(ApplicationUser user, Long id)
Used to retrieve a Project object by id.
ProjectService.GetProjectResult getProjectByIdForAction(User user, Long id, ProjectAction action)
Used to retrieve a Project object by id providing the user can perform the passed action on the project.
ProjectService.GetProjectResult getProjectByIdForAction(ApplicationUser user, Long id, ProjectAction action)
Used to retrieve a Project object by id providing the user can perform the passed action on the project.
ProjectService.GetProjectResult getProjectByKey(User user, String key)
Used to retrieve a Project object by key.
ProjectService.GetProjectResult getProjectByKey(ApplicationUser user, String key)
Used to retrieve a Project object by key.
ProjectService.GetProjectResult getProjectByKeyForAction(ApplicationUser user, String key, ProjectAction action)
Used to retrieve a Project object by key providing the user can perform the passed action on the project.
ProjectService.GetProjectResult getProjectByKeyForAction(User user, String key, ProjectAction action)
Used to retrieve a Project object by key providing the user can perform the passed action on the project.
long getProjectCount()
Used to retrieve the total number of Projects, regardless of the permission to see those projects.
String getProjectKeyDescription()
Get the project key description from the properties file.
boolean isValidAllProjectData(JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType)
Validates the given project fields.
boolean isValidAllProjectData(JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType, Long avatarId)
Validates the given project fields.
boolean isValidProjectKey(JiraServiceContext serviceContext, String key)
Validates the given project key.
boolean isValidRequiredProjectData(JiraServiceContext serviceContext, String name, String key, String leadName)
Validate the fields required for creating a project.
Project updateProject(ProjectService.UpdateProjectValidationResult updateProjectValidationResult)
Using the validation result from validateUpdateProject(User, String, String, String, String, String, Long) this method performs the actual update on the project.
void updateProjectSchemes(ProjectService.UpdateProjectSchemesValidationResult result, Project project)
Updates the project schemes for a particular project, given a validation result and project to update.
ProjectService.CreateProjectValidationResult validateCreateProject(User user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)
This method needs to be called before creating a project to ensure all parameters are correct.
ProjectService.CreateProjectValidationResult validateCreateProject(User user, String name, String key, String description, String leadName, String url, Long assigneeType)
This method needs to be called before creating a project to ensure all parameters are correct.
ProjectService.DeleteProjectValidationResult validateDeleteProject(ApplicationUser user, String key)
Validation to delete a project is quite straightforward.
ProjectService.DeleteProjectValidationResult validateDeleteProject(User user, String key)
Validation to delete a project is quite straightforward.
ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType)
Validates updating a project's details.
ProjectService.UpdateProjectValidationResult validateUpdateProject(User user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)
Validates updating a project's details.
ServiceResult validateUpdateProject(ApplicationUser user, String key)
Validates that the given user is authorised to update a project.
ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)
Validates updating a project's details.
ProjectService.UpdateProjectValidationResult validateUpdateProject(User user, String name, String key, String description, String leadName, String url, Long assigneeType)
Validates updating a project's details.
ServiceResult validateUpdateProject(User user, String key)
Validates that the given user is authorised to update a project.
ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes(ApplicationUser user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)
If the scheme ids are not null or -1 (-1 is often used to reset schemes), then an attempt will be made to retrieve the scheme.
ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes(User user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)
If the scheme ids are not null or -1 (-1 is often used to reset schemes), then an attempt will be made to retrieve the scheme.

Constants

public static final int DEFAULT_NAME_LENGTH

Default project name length

Constant Value: 80 (0x00000050)

public static final int MAX_KEY_LENGTH

This constant is deprecated.
use getMaximumKeyLength() instead

The maximum length allowed for the project key field.

Constant Value: 10 (0x0000000a)

public static final int MAX_NAME_LENGTH

This constant is deprecated.
use getMaximumNameLength() instead;

The maximum length allowed for the project name field.

Constant Value: 80 (0x00000050)

public static final int MIN_NAME_LENGTH

The minimum length allowed for the project name field.

Constant Value: 2 (0x00000002)

public static final String PROJECT_DESCRIPTION

The default name of HTML fields containing a Project's description. Validation methods on this service (isValidAllProjectData) will return an ErrorCollection with error messages keyed to this field name.

Constant Value: "projectDescription"

public static final String PROJECT_KEY

The default name of HTML fields containing a Project's key. Validation methods on this service (isValidAllProjectData) will return an ErrorCollection with error messages keyed to this field name.

Constant Value: "projectKey"

public static final String PROJECT_LEAD

The default name of HTML fields containing a Project's lead. Validation methods on this service (isValidAllProjectData) will return an ErrorCollection with error messages keyed to this field name.

Constant Value: "projectLead"

public static final String PROJECT_NAME

The default name of HTML fields containing a Project's name. Validation methods on this service (isValidAllProjectData) will return an ErrorCollection with error messages keyed to this field name.

Constant Value: "projectName"

public static final String PROJECT_URL

The default name of HTML fields containing a Project's URL. Validation methods on this service (isValidAllProjectData) will return an ErrorCollection with error messages keyed to this field name.

Constant Value: "projectUrl"

Public Methods

public Project createProject (ProjectService.CreateProjectValidationResult createProjectValidationResult)

Using the validation result from validateCreateProject(User, String, String, String, String, String, Long) a new project will be created. This method will throw an IllegalStateException if the validation result contains any errors.

Project creation involves creating the project itself and setting some defaults for workflow schemes and issue type screen schemes.

Parameters
createProjectValidationResult Result from the validation, which also contains all the project's details.
Returns
  • The new project
Throws
IllegalStateException if the validation result contains any errors.

public ProjectService.DeleteProjectResult deleteProject (ApplicationUser user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)

Deletes the project provided by the deleteProjectValidationResult. There's a number of steps involved in deleting a project, which are carried out in the following order:

  • Delete all the issues in the project
  • Remove any custom field associations for the project
  • Remove the IssueTypeScreenSchemeAssocation for the project
  • Remove any other associations of this project (to permission schemes, notification schemes...)
  • Remove any versions in this project
  • Remove any components in this project
  • Delete all portlets that rely on this project (either directly or via filters)
  • Delete all the filters for this project
  • Delete the project itself in the database
  • Flushing the issue, project and workflow scheme caches

Parameters
user The user trying to delete a project
deleteProjectValidationResult Result from the validation, which also contains all the project's details.
Returns
  • A result containing any errors. Users of this method should check the result.

public ProjectService.DeleteProjectResult deleteProject (User user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)

Deletes the project provided by the deleteProjectValidationResult. There's a number of steps involved in deleting a project, which are carried out in the following order:

  • Delete all the issues in the project
  • Remove any custom field associations for the project
  • Remove the IssueTypeScreenSchemeAssocation for the project
  • Remove any other associations of this project (to permission schemes, notification schemes...)
  • Remove any versions in this project
  • Remove any components in this project
  • Delete all portlets that rely on this project (either directly or via filters)
  • Delete all the filters for this project
  • Delete the project itself in the database
  • Flushing the issue, project and workflow scheme caches

Parameters
user The user trying to delete a project
deleteProjectValidationResult Result from the validation, which also contains all the project's details.
Returns
  • A result containing any errors. Users of this method should check the result.

public ServiceOutcome<List<Project>> getAllProjects (User user)

Used to retrieve a list of Project objects. This method returns a ServiceOutcome containing a list of projects. The list will be empty, if the user does not have the BROWSE project permission for any project or no projects are visible when using anonymous access.

Parameters
user The user retrieving the list of projects or NULL when using anonymous access.
Returns
  • A ServiceOutcome containing a list of projects

public ServiceOutcome<List<Project>> getAllProjects (ApplicationUser user)

Used to retrieve a list of Project objects. This method returns a ServiceOutcome containing a list of projects. The list will be empty, if the user does not have the BROWSE project permission for any project or no projects are visible when using anonymous access.

Parameters
user The user retrieving the list of projects or NULL when using anonymous access.
Returns
  • A ServiceOutcome containing a list of projects

public ServiceOutcome<List<Project>> getAllProjectsForAction (ApplicationUser user, ProjectAction action)

Used to retrieve a list of Project objects. This method returns a ServiceOutcome containing a list of projects that the user can perform the passed action on. The list will be empty if no projects match the passed action.

Parameters
user The user retrieving the list of projects or NULL when using anonymous access.
action the action the user must be able to perform on the returned projects.
Returns
  • A ServiceOutcome containing a list of projects the user can perform the passed action on.

public ServiceOutcome<List<Project>> getAllProjectsForAction (User user, ProjectAction action)

Used to retrieve a list of Project objects. This method returns a ServiceOutcome containing a list of projects that the user can perform the passed action on. The list will be empty if no projects match the passed action.

Parameters
user The user retrieving the list of projects or NULL when using anonymous access.
action the action the user must be able to perform on the returned projects.
Returns
  • A ServiceOutcome containing a list of projects the user can perform the passed action on.

public int getMaximumKeyLength ()

Used to retrieve the maximum length allowed for new project keys.

Returns
  • The configured maximum project length

public int getMaximumNameLength ()

Used to retrieve the maximum length allowed for new project names.

Returns
  • The configured maximum project length

public ProjectService.GetProjectResult getProjectById (User user, Long id)

Used to retrieve a Project object by id. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the id specified can be found, or if the user making the request does not have the BROWSE project permission for the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
id The id of the project.
Returns
  • A ProjectResult object

public ProjectService.GetProjectResult getProjectById (ApplicationUser user, Long id)

Used to retrieve a Project object by id. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the id specified can be found, or if the user making the request does not have the BROWSE project permission for the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
id The id of the project.
Returns
  • A ProjectResult object

public ProjectService.GetProjectResult getProjectByIdForAction (User user, Long id, ProjectAction action)

Used to retrieve a Project object by id providing the user can perform the passed action on the project. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the id specified can be found, or if the user making the request cannot perform the passed action on the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
id The id of the project.
action the action the user must be able to perform on the project.
Returns
  • A ProjectResult object

public ProjectService.GetProjectResult getProjectByIdForAction (ApplicationUser user, Long id, ProjectAction action)

Used to retrieve a Project object by id providing the user can perform the passed action on the project. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the id specified can be found, or if the user making the request cannot perform the passed action on the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
id The id of the project.
action the action the user must be able to perform on the project.
Returns
  • A ProjectResult object

public ProjectService.GetProjectResult getProjectByKey (User user, String key)

Used to retrieve a Project object by key. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the key specified can be found, or if the user making the request does not have the BROWSE project permission for the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
key The key of the project.
Returns
  • A GetProjectResult object

public ProjectService.GetProjectResult getProjectByKey (ApplicationUser user, String key)

Used to retrieve a Project object by key. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the key specified can be found, or if the user making the request does not have the BROWSE project permission for the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
key The key of the project.
Returns
  • A GetProjectResult object

public ProjectService.GetProjectResult getProjectByKeyForAction (ApplicationUser user, String key, ProjectAction action)

Used to retrieve a Project object by key providing the user can perform the passed action on the project. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the key specified can be found, or if the user making the request cannot perform the passed action on the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
key The key of the project.
action the action the user must be able to perform on the project.
Returns
  • A GetProjectResult object

public ProjectService.GetProjectResult getProjectByKeyForAction (User user, String key, ProjectAction action)

Used to retrieve a Project object by key providing the user can perform the passed action on the project. This method returns a ProjectService.GetProjectResult. The project will be null if no project for the key specified can be found, or if the user making the request cannot perform the passed action on the project. In both of these cases, the errorCollection in the result object will contain an appropriate error message.

Parameters
user The user retrieving the project.
key The key of the project.
action the action the user must be able to perform on the project.
Returns
  • A GetProjectResult object

public long getProjectCount ()

Used to retrieve the total number of Projects, regardless of the permission to see those projects.

Returns
  • A long value representing the total number of projects.

public String getProjectKeyDescription ()

Get the project key description from the properties file. If the user has specified a custom regex that project keys must conform to and a description for that regex, this method should return the description.

If the user has not specified a custom regex, this method will return the default project key description:

"Usually the key is just 3 letters - i.e. if your project name is Foo Bar Raz, a key of FBR would make sense.
The key must contain only uppercase alphabetic characters, and be at least 2 characters in length.
It is recommended to use only ASCII characters, as other characters may not work."

Returns
  • a String description of the project key format

public boolean isValidAllProjectData (JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType)

Validates the given project fields. Any errors will be added to the JiraServiceContext.

Parameters
serviceContext containing the ErrorCollection that will be populated with any validation errors that are encountered
name the name of the project @NotNull
key the key of the project @NotNull
leadName the username of the project lead @NotNull
url the project URL (optional)
assigneeType the default assignee type (optional - only appears on some forms)
Returns
  • true if project data is valid, false otherwise

public boolean isValidAllProjectData (JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType, Long avatarId)

Validates the given project fields. Any errors will be added to the JiraServiceContext.

Parameters
serviceContext containing the ErrorCollection that will be populated with any validation errors that are encountered
name the name of the project @NotNull
key the key of the project @NotNull
leadName the username of the project lead @NotNull
url the project URL (optional)
assigneeType the default assignee type (optional - only appears on some forms)
avatarId the id of the avatar (null indicates default avatar)
Returns
  • true if project data is valid, false otherwise

public boolean isValidProjectKey (JiraServiceContext serviceContext, String key)

Validates the given project key. Any errors will be added to the JiraServiceContext.

Parameters
serviceContext containing the ErrorCollection that will be populated with any validation errors that are encountered
key The key to validate @NotNull
Returns
  • true if project key is valid, false otherwise

public boolean isValidRequiredProjectData (JiraServiceContext serviceContext, String name, String key, String leadName)

Validate the fields required for creating a project. Any errors will be added to the JiraServiceContext.

Parameters
serviceContext containing the ErrorCollection that will be populated with any validation errors that are encountered
name the name of the project @NotNull
key the key of the project @NotNull
leadName the username of the project lead @NotNull
Returns
  • true if project data is valid, false otherwise

public Project updateProject (ProjectService.UpdateProjectValidationResult updateProjectValidationResult)

Using the validation result from validateUpdateProject(User, String, String, String, String, String, Long) this method performs the actual update on the project.

Parameters
updateProjectValidationResult Result from the validation, which also contains all the project's details.
Returns
  • The updated project
Throws
IllegalStateException if the validation result contains any errors.

public void updateProjectSchemes (ProjectService.UpdateProjectSchemesValidationResult result, Project project)

Updates the project schemes for a particular project, given a validation result and project to update.

Parameters
result Result from the validation, which also contains all the schemes details.
project The project which will have its schemes updated.
Throws
IllegalStateException if the validation result contains any errors.

public ProjectService.CreateProjectValidationResult validateCreateProject (User user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)

This method needs to be called before creating a project to ensure all parameters are correct. There are a number of required parameters, such as a project name, key and lead. The validation will also check if a project with the name or key provided already exists and throw an appropriate error. The project key will be validated that it matches the allowed key pattern, and it is not a reserved word. A validation error will also be added if no user exists for the lead username provided.

Optional validation will be done for the url, assigneetype and avatarId parameters. The url needs to be a valid URL and the assigneeType needs to be either PROJECT_LEAD or UNASSIGNED. UNASSIGNED will also only be valid, if unassigned issues are enabled in the General Configuration.

The method will return a ProjectService.CreateProjectValidationResult which contains an ErrorCollection with any potential errors and all the project's details.

Parameters
user The user trying to create a project
name The name of the new project
key The project key of the new project
description An optional description for the project
leadName The username 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 avatar.
Returns
  • A validation result containing any errors and all project details

public ProjectService.CreateProjectValidationResult validateCreateProject (User user, String name, String key, String description, String leadName, String url, Long assigneeType)

This method needs to be called before creating a project to ensure all parameters are correct. There are a number of required parameters, such as a project name, key and lead. The validation will also check if a project with the name or key provided already exists and throw an appropriate error. The project key will be validated that it matches the allowed key pattern, and it is not a reserved word. A validation error will also be added if no user exists for the lead username provided.

The default avatar will be used for the created project.

Optional validation will be done for the url and assigneetype parameters. The url needs to be a valid URL, and the assigneeType needs to be either PROJECT_LEAD or UNASSIGNED. UNASSIGNED will also only be valid, if unassigned issues are enabled in the General Configuration.

The method will return a ProjectService.CreateProjectValidationResult which contains an ErrorCollection with any potential errors and all the project's details.

Parameters
user The user trying to create a project
name The name of the new project
key The project key of the new project
description An optional description for the project
leadName The username 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.
Returns
  • A validation result containing any errors and all project details

public ProjectService.DeleteProjectValidationResult validateDeleteProject (ApplicationUser user, String key)

Validation to delete a project is quite straightforward. The user must have global admin rights and the project about to be deleted needs to exist.

Parameters
user The user trying to delete a project
key The key of the project to delete
Returns
  • A validation result containing any errors and all project details

public ProjectService.DeleteProjectValidationResult validateDeleteProject (User user, String key)

Validation to delete a project is quite straightforward. The user must have global admin rights and the project about to be deleted needs to exist.

Parameters
user The user trying to delete a project
key The key of the project to delete
Returns
  • A validation result containing any errors and all project details

public ProjectService.UpdateProjectValidationResult validateUpdateProject (ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType)

Validates updating a project's details. The project is looked up by the key provided. If no project with the key provided can be found, an appropriate error will be added to the result.

Validation performed will be the same as for the validateCreateProject(User, String, String, String, String, String, Long) method. The only difference is that the project key will obviously not be validated.

A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
name The name of the new project
key The project key of the project to update.
description An optional description for the project
lead The userkey for the lead developer for the project
url An optional URL for the project
assigneeType The default assignee for issues created in this project. May be either project lead, or unassigned if unassigned issues are enabled.
Returns
  • A validation result containing any errors and all project details

public ProjectService.UpdateProjectValidationResult validateUpdateProject (User user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)

Validates updating a project's details. The project is looked up by the key provided. If no project with the key provided can be found, an appropriate error will be added to the result.

Validation performed will be the same as for the validateCreateProject(User, String, String, String, String, String, Long) method. The only difference is that the project key will obviously not be validated.

A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
name The name of the new project
key The project key of the project to update.
description An optional description for the project
leadName The username of the lead developer for the project
url An optional URL for the 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
  • A validation result containing any errors and all project details

public ServiceResult validateUpdateProject (ApplicationUser user, String key)

Validates that the given user is authorised to update a project. A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
key The project key of the project to update.
Returns
  • a ServiceResult, which will contain errors if the user is not authorised to update the project

public ProjectService.UpdateProjectValidationResult validateUpdateProject (ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)

Validates updating a project's details. The project is looked up by the key provided. If no project with the key provided can be found, an appropriate error will be added to the result.

Validation performed will be the same as for the validateCreateProject(User, String, String, String, String, String, Long) method. The only difference is that the project key will obviously not be validated.

A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
name The name of the new project
key The project key of the project to update.
description An optional description for the project
lead The userkey of the lead developer for the project
url An optional URL for the 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
  • A validation result containing any errors and all project details

public ProjectService.UpdateProjectValidationResult validateUpdateProject (User user, String name, String key, String description, String leadName, String url, Long assigneeType)

Validates updating a project's details. The project is looked up by the key provided. If no project with the key provided can be found, an appropriate error will be added to the result.

Validation performed will be the same as for the validateCreateProject(User, String, String, String, String, String, Long) method. The only difference is that the project key will obviously not be validated.

A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
name The name of the new project
key The project key of the project to update.
description An optional description for the project
leadName The username of the lead developer for the project
url An optional URL for the project
assigneeType The default assignee for issues created in this project. May be either project lead, or unassigned if unassigned issues are enabled.
Returns
  • A validation result containing any errors and all project details

public ServiceResult validateUpdateProject (User user, String key)

Validates that the given user is authorised to update a project. A project can be updated by any user with the global admin permission or project admin permission for the project in question.

Parameters
user The user trying to update a project
key The project key of the project to update.
Returns
  • a ServiceResult, which will contain errors if the user is not authorised to update the project

public ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes (ApplicationUser user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)

If the scheme ids are not null or -1 (-1 is often used to reset schemes), then an attempt will be made to retrieve the scheme. If this attempt fails an error will be added. IssueSecuritySchemes will only be validated in enterprise edition.

Parameters
permissionSchemeId The permission scheme that the new project should use
notificationSchemeId The notification scheme that the new project should use. Optional.
issueSecuritySchemeId The issue security scheme that the new project should use. Optional.
Returns
  • A validation result containing any errors and all scheme ids

public ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes (User user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)

If the scheme ids are not null or -1 (-1 is often used to reset schemes), then an attempt will be made to retrieve the scheme. If this attempt fails an error will be added. IssueSecuritySchemes will only be validated in enterprise edition.

Parameters
permissionSchemeId The permission scheme that the new project should use
notificationSchemeId The notification scheme that the new project should use. Optional.
issueSecuritySchemeId The issue security scheme that the new project should use. Optional.
Returns
  • A validation result containing any errors and all scheme ids