Wehave dozens of projects in Jira and are creating more over time. We would prefer a project key length greater than 10 characters because we will shortly run into uniqueness problems with how we like to name and key our projects.
Concerns we have are the following:
a) we have many product lines and we prefer the Jira project key be descriptive and recognizable
b) we sometimes have long release labels
c) we would prefer that dots(.) be allowed to better match our releases
d) we currently use [A-Za-z0-9_\.]+ for our custom project key pattern (regex)
e) we like to keep current with Jira, but moving from 5.x to 6.x is currently a concern because of Project Keys.
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 AssigneeTypes.PROJECT_LEAD, AssigneeTypes.UNASSIGNED, or null to let JIRA decide on the best default assignee. UNASSIGNED will also only be valid, if unassigned issues are enabled in the General Configuration. All the projects created in JIRA must have a project type, and its value must correspond to one of the project types defined on the JIRA instance. A validation error will be reported if the passed value is null or if it does not meet the previous criteria. There are two ways to provide the project type to this method: directly via ProjectCreationData.getProjectTypeKey() or indirectly via ProjectCreatedData.getProjectTemplateKey(). If a project template key is provided, this method will look up the project template and use the template's project type as the type of the created project. If both a project type and a template key are provided on the received ProjectCreationData, the project type defined on the template with the given key will be the one used to create the project. Providing a template key is the preferred method for creating a project since templates ensure projects are created in a more useful way for a particular use case. 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 performing the actionprojectCreationData - An object encapsulating all the data for the project that will get createdReturns:A validation result containing any errors and all project detailsSince:7.0createProjectProject createProject(ProjectService.CreateProjectValidationResult createProjectValidationResult)Using the validation result from validateCreateProject(ApplicationUser, ProjectCreationData) 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. If the validation result contains an existing project id, the new project will be created with shared schemes, that is the a new project will be associated with the the same schemes as the existing project: Permission Scheme Notification Scheme Issue Security Scheme Workflow Scheme Issue Type Scheme Issue Type Screen Scheme In addition this method will also add the new project to the same project category as the existing project.Parameters:createProjectValidationResult - Result from the validation, which also contains all the project's details.Returns:The new projectThrows:IllegalStateException - if the validation result contains any errors.validateCreateProj...@NonnullProjectService.CreateProjectValidationResult validateCreateProjectBasedOnExistingProject(ApplicationUser user, @Nonnull Long existingProjectId, ProjectCreationData projectCreationData)Validates if the current user can create a new project with shared schemes based on the existing project provided. This method validates that the passed project exists and that the current user has ProjectAction.EDIT_PROJECT_CONFIG permissions for it. Beyond these checks, validation rules will be the same as validateCreateProject(ApplicationUser, ProjectCreationData).Parameters:user - The user performing the actionexistingProjectId - An existing project id to use as the base for the new project being createdprojectCreationData - An object encapsulating all the data for the project that will get createdReturns:A validation result containing any errors and all project detailsSince:7.0validateUpdateProjectServiceResult 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 projectkey - The project key of the project to update.Returns:a ServiceResult, which will contain errors if the user is not authorised to update the projectvalidateUpdateProjectProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser 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(ApplicationUser, ProjectCreationData) 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 projectname - The name of the new projectkey - The project key of the project to update.description - An optional description for the projectleadName - The username of the lead developer for the projecturl - An optional URL for the projectassigneeType - 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 detailsvalidateUpdateProjectProjectService.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(ApplicationUser, ProjectCreationData) 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. WARNING: In 6.0-6.0.5, this method is available but does not work properly for renamed users (JRA-33843).Parameters:user - The user trying to update a projectname - The name of the new projectkey - The project key of the project to update.description - An optional description for the projectlead - The lead developer for the projecturl - An optional URL for the projectassigneeType - 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 detailsSince:6.0.6 (see warning in method description)validateUpdateProjectProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, Project originalProject, 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 project object. You may change the project key. Validation performed will be the same as for the validateCreateProject(ApplicationUser, ProjectCreationData) method. A project can be updated by any user with the global admin permission or project admin permission for the project in question. A project key can be updated by any user with the global admin permission.Parameters:user - The user trying to update a projectoriginalProject - The project to update with the values put in arguments (Project object should not be modified)name - The name of the new projectkey - The new project keydescription - An optional description for the projectlead - The lead developer for the projecturl - An optional URL for the projectassigneeType - 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 detailsvalidateUpdateProjectProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, Project originalProject, 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 project object. You may change the project key. Validation performed will be the same as for the validateCreateProject(ApplicationUser, ProjectCreationData) method. A project can be updated by any user with the global admin permission or project admin permission for the project in question. A project key can be updated by any user with the global admin permission.Parameters:user - The user trying to update a projectoriginalProject - The project to update with the values put in arguments (Project object should not be modified)name - The name of the new projectkey - The new project keydescription - An optional description for the projectleadName - The user key for the lead developer for the projecturl - An optional URL for the projectassigneeType - 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 detailsvalidateUpdateProjectProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser 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(ApplicationUser, ProjectCreationData) 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 projectname - The name of the new projectkey - The project key of the project to update.description - An optional description for the projectleadName - The username of the lead developer for the projecturl - An optional URL for the 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:A validation result containing any errors and all project detailsvalidateUpdateProjectProjectService.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(ApplicationUser, ProjectCreationData) 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. WARNING: In 6.0-6.0.5, this method is available but does not work properly for renamed users (JRA-33843).Parameters:user - The user trying to update a projectname - The name of the new projectkey - The project key of the project to update.description - An optional description for the projectlead - The lead developer for the projecturl - An optional URL for the 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:A validation result containing any errors and all project detailsSince:6.0.6 (see warning in method description)updateProjectProject 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 projectThrows:IllegalStateException - if the validation result contains any errors.updateProjectTypecom.atlassian.fugue.Either updateProjectType(ApplicationUser user, Project project, ProjectTypeKey newProjectType)Updates the type of a project. If the update completes successfully, all the registered ProjectTypeUpdatedHandlers will be notified. If an exception is thrown by one of the ProjectTypeUpdatedHandler, the project type update will be rolled back.Parameters:user - The user performing the actionproject - The project which type needs to be updatednewProjectType - The new project typeReturns:Either the updated project if everything went well or an error collection indicating the reasons of the failureThrows:PermissionException - If the user does not have permission to perform the operationSince:7.0validateDeleteProjectProjectService.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 projectkey - The key of the project to deleteReturns:A validation result containing any errors and all project detailsdeleteProjectProjectService.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 projectdeleteProjectValidationResult - 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.validateUpdateProjectSchemesProjectService.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 usenotificationSchemeId - 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 idsupdateProjectSchemesvoid 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.isValidAllProjectDataboolean isValidAllProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData)Validates the given project fields. Any errors will be added to the JiraServiceContext. The project type is mandatory and its value must correspond to one of the project types defined on the JIRA instance. A validation error will be reported if the passed value is null or if it does not meet the previous criteria.Parameters:serviceContext - containing the ErrorCollection that will be populated with any validation errors that are encountered. It also contains the logged in user so the correct locale is used for the error messages.projectCreationData - An object encapsulating all the data for the project that will get createdReturns:true if project data is valid, false otherwiseisValidRequiredProjectDataboolean isValidRequiredProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData)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 encounteredprojectCreationData - An object encapsulating all the data for the project that will get createdReturns:true if project data is valid, false otherwiseisValidProjectKeyboolean 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 encounteredkey - The key to validate @NonnullReturns:true if project key is valid, false otherwisegetProjectKeyDescriptionString 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 formatgetProjectByIdProjectService.GetProjectResult getProjectById(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.
3a8082e126