public class

DefaultProjectComponentService

extends Object
implements ProjectComponentService
java.lang.Object
   ↳ com.atlassian.jira.bc.project.component.DefaultProjectComponentService

Summary

Constants
String FIELD_ASSIGNEE_TYPE assignee type field name
String FIELD_COMPONENT_LEAD lead field name
String FIELD_NAME name field name
String FIELD_PROJECT_ID project ID field name
String KEY_ASSIGNEE_TYPE_INVALID
String KEY_ID_NULL
String KEY_NAME_NOT_SET
String KEY_NAME_NOT_UNIQUE
String KEY_NO_SUCH_COMPONENT
String KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID
String KEY_NO_SUCH_COMPONENT_WITH_ID
String KEY_PROJECT_ID_NOT_FOUND
String KEY_PROJECT_ID_NULL
String KEY_USER_DOES_NOT_EXIST
String KEY_USER_NO_PERMISSION
String KEY_USER_NO_PERMISSION_WITH_USER
Public Constructors
DefaultProjectComponentService(JiraAuthenticationContext jiraAuthenticationContext, PermissionManager permissionManager, ProjectComponentManager projectComponentManager, ProjectManager projectManager, IssueManager issueManager, UserManager userManager, EventPublisher eventPublisher)
Public Methods
ProjectComponent create(ApplicationUser user, ErrorCollection errorCollection, String name, String description, String lead, Long projectId)
Create a new ProjectComponent object associated with the project with the ID specified and with the values given.
ProjectComponent create(ApplicationUser user, ErrorCollection errorCollection, String name, String description, String lead, Long projectId, Long assigneeType)
Create a project component with assignee type set as provided.
void deleteAndSwapComponentForIssues(JiraServiceContext context, Long componentId, Long swapComponentId)
void deleteComponentForIssues(JiraServiceContext context, Long componentId)
ProjectComponent find(ApplicationUser user, ErrorCollection errorCollection, Long id)
Collection<ProjectComponent> findAllForProject(ErrorCollection errorCollection, Long projectId)
ProjectComponent update(ApplicationUser user, ErrorCollection errorCollection, MutableProjectComponent component)
Protected Methods
void validateAssigneeType(Handler handler, Long assigneeType)
void validateLead(Handler handler, String lead)
Validates lead.
void validateName(Handler handler, String oldName, String newName, Long projectId)
Validates newName.
void validateProjectId(Handler handler, Long projectId)
Validates project ID.
void verifyUserExists(Handler handler, String user)
Verifies that the user with the name specified is a valid JIRA user.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.project.component.ProjectComponentService

Constants

public static final String FIELD_ASSIGNEE_TYPE

assignee type field name

Constant Value: "assigneeType"

public static final String FIELD_COMPONENT_LEAD

lead field name

Constant Value: "componentLead"

public static final String FIELD_NAME

name field name

Constant Value: "name"

public static final String FIELD_PROJECT_ID

project ID field name

Constant Value: "projectId"

public static final String KEY_ASSIGNEE_TYPE_INVALID

Constant Value: "admin.projects.component.assignee.type.invalid"

public static final String KEY_ID_NULL

Constant Value: "admin.projects.component.nullId"

public static final String KEY_NAME_NOT_SET

Constant Value: "admin.projects.component.namenotset"

public static final String KEY_NAME_NOT_UNIQUE

Constant Value: "admin.projects.component.namenotunique"

public static final String KEY_NO_SUCH_COMPONENT

Constant Value: "admin.projects.component.nosuchcomponent"

public static final String KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID

Constant Value: "admin.projects.component.nosuchcomponent.toswap.withid"

public static final String KEY_NO_SUCH_COMPONENT_WITH_ID

Constant Value: "admin.projects.component.nosuchcomponent.withid"

public static final String KEY_PROJECT_ID_NOT_FOUND

Constant Value: "admin.projects.component.nosuchprojectid"

public static final String KEY_PROJECT_ID_NULL

Constant Value: "admin.projects.component.nullprojectid"

public static final String KEY_USER_DOES_NOT_EXIST

Constant Value: "admin.projects.component.userdoesnotexist"

public static final String KEY_USER_NO_PERMISSION

Constant Value: "admin.projects.component.usernopermission"

public static final String KEY_USER_NO_PERMISSION_WITH_USER

Constant Value: "admin.projects.component.usernopermission.withuser"

Public Constructors

public DefaultProjectComponentService (JiraAuthenticationContext jiraAuthenticationContext, PermissionManager permissionManager, ProjectComponentManager projectComponentManager, ProjectManager projectManager, IssueManager issueManager, UserManager userManager, EventPublisher eventPublisher)

Public Methods

public ProjectComponent create (ApplicationUser user, ErrorCollection errorCollection, String name, String description, String lead, Long projectId)

Create a new ProjectComponent object associated with the project with the ID specified and with the values given.

Validates the values - stores and returns the ProjectComponent if validation successful. Otherwise, null is returned.

Parameters
user user performing this operation
errorCollection collection to add error messages to if validation and permission checks fail - String objects
name name of component
description description of component
lead user name associated with component
projectId ID of project that component is associated with
Returns
  • new instance of ProjectComponent with the values specified

public ProjectComponent create (ApplicationUser user, ErrorCollection errorCollection, String name, String description, String lead, Long projectId, Long assigneeType)

Create a project component with assignee type set as provided.

Returns

public void deleteAndSwapComponentForIssues (JiraServiceContext context, Long componentId, Long swapComponentId)

public void deleteComponentForIssues (JiraServiceContext context, Long componentId)

public ProjectComponent find (ApplicationUser user, ErrorCollection errorCollection, Long id)

Parameters
user user performing this operation or null for anonymous access
errorCollection collection to add error messages to if validation and permission checks fail - String objects
id component id
Returns
  • project component or null and then errorCollection should contain some error information

public Collection<ProjectComponent> findAllForProject (ErrorCollection errorCollection, Long projectId)

public ProjectComponent update (ApplicationUser user, ErrorCollection errorCollection, MutableProjectComponent component)

Protected Methods

protected void validateAssigneeType (Handler handler, Long assigneeType)

protected void validateLead (Handler handler, String lead)

Validates lead.

For Standard & Professional - lead is always valid and will return null in all cases. For Enterprise - lead is valid if null or a valid user.

Parameters
handler validation and permission check handler
lead lead

protected void validateName (Handler handler, String oldName, String newName, Long projectId)

Validates newName. Name must be not null and unique.

Parameters
handler validation and permission check handler
oldName old name
newName new name
projectId project ID

protected void validateProjectId (Handler handler, Long projectId)

Validates project ID. Project ID is valid if not null.

Parameters
handler validation and permission check handler
projectId project ID

protected void verifyUserExists (Handler handler, String user)

Verifies that the user with the name specified is a valid JIRA user.

Parameters
user user to verify
Throws
IllegalArgumentException if user does not exist