Class DefaultProjectComponentService
java.lang.Object
com.atlassian.jira.bc.project.component.DefaultProjectComponentService
- All Implemented Interfaces:
ProjectComponentService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
assignee type field namestatic final String
lead field namestatic final String
name field namestatic final String
project ID field namestatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultProjectComponentService
(JiraAuthenticationContext jiraAuthenticationContext, PermissionManager permissionManager, ProjectComponentManager projectComponentManager, ProjectManager projectManager, IssueManager issueManager, UserManager userManager, com.atlassian.event.api.EventPublisher eventPublisher, InternalProjectPermissionHelper projectPermissionHelper) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(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.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) find
(ApplicationUser user, ErrorCollection errorCollection, Long id) findAllForProject
(ErrorCollection errorCollection, Long projectId) findComponents
(ApplicationUser user, String substring, List<Long> projectIds) Returns components whose names start with or fully match given substring.update
(ApplicationUser user, ErrorCollection errorCollection, MutableProjectComponent component) protected void
validateAssigneeType
(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, Long assigneeType) protected void
validateLead
(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, String lead) Validates lead.protected void
validateName
(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, String oldName, String newName, Long projectId) Validates newName.protected void
validateProjectId
(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, Long projectId) Validates project ID.protected void
verifyUserExists
(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, String user) Verifies that the user with the name specified is a valid JIRA user.
-
Field Details
-
KEY_USER_NO_PERMISSION
- See Also:
-
KEY_USER_NO_PERMISSION_WITH_USER
- See Also:
-
KEY_NO_SUCH_COMPONENT
- See Also:
-
KEY_NO_SUCH_COMPONENT_WITH_ID
- See Also:
-
KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID
- See Also:
-
KEY_ID_NULL
- See Also:
-
KEY_PROJECT_ID_NULL
- See Also:
-
KEY_PROJECT_ID_NOT_FOUND
- See Also:
-
KEY_NAME_NOT_SET
- See Also:
-
KEY_NAME_NOT_UNIQUE
- See Also:
-
KEY_USER_DOES_NOT_EXIST
- See Also:
-
KEY_ASSIGNEE_TYPE_INVALID
- See Also:
-
FIELD_PROJECT_ID
project ID field name- See Also:
-
FIELD_NAME
name field name- See Also:
-
FIELD_COMPONENT_LEAD
lead field name- See Also:
-
FIELD_ASSIGNEE_TYPE
assignee type field name- See Also:
-
-
Constructor Details
-
DefaultProjectComponentService
public DefaultProjectComponentService(JiraAuthenticationContext jiraAuthenticationContext, PermissionManager permissionManager, ProjectComponentManager projectComponentManager, ProjectManager projectManager, IssueManager issueManager, UserManager userManager, com.atlassian.event.api.EventPublisher eventPublisher, InternalProjectPermissionHelper projectPermissionHelper)
-
-
Method Details
-
create
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.
- Specified by:
create
in interfaceProjectComponentService
- Parameters:
user
- user performing this operationerrorCollection
- collection to add error messages to if validation and permission checks fail - String objectsname
- name of componentdescription
- description of componentlead
- user name associated with componentprojectId
- ID of project that component is associated with- Returns:
- new instance of ProjectComponent with the values specified
-
create
public ProjectComponent create(ApplicationUser user, ErrorCollection errorCollection, String name, String description, String lead, Long projectId, Long assigneeType) Description copied from interface:ProjectComponentService
Create a project component with assignee type set as provided.- Specified by:
create
in interfaceProjectComponentService
- Returns:
- A newly created project component
ProjectComponent
-
find
- Specified by:
find
in interfaceProjectComponentService
- Parameters:
user
- user performing this operation ornull
for anonymous accesserrorCollection
- collection to add error messages to if validation and permission checks fail - String objectsid
- component id- Returns:
- project component or null and then
errorCollection
should contain some error information
-
findAllForProject
public Collection<ProjectComponent> findAllForProject(ErrorCollection errorCollection, Long projectId) - Specified by:
findAllForProject
in interfaceProjectComponentService
-
update
public ProjectComponent update(ApplicationUser user, ErrorCollection errorCollection, MutableProjectComponent component) - Specified by:
update
in interfaceProjectComponentService
-
deleteComponentForIssues
- Specified by:
deleteComponentForIssues
in interfaceProjectComponentService
-
deleteAndSwapComponentForIssues
public void deleteAndSwapComponentForIssues(JiraServiceContext context, Long componentId, Long swapComponentId) - Specified by:
deleteAndSwapComponentForIssues
in interfaceProjectComponentService
-
findComponents
public Stream<ProjectComponent> findComponents(@Nullable ApplicationUser user, @Nonnull String substring, @Nonnull List<Long> projectIds) Description copied from interface:ProjectComponentService
Returns components whose names start with or fully match given substring. Components that the calling user has no permissions to see or archived components are filtered out.- Specified by:
findComponents
in interfaceProjectComponentService
- Parameters:
user
- the calling usersubstring
- the string that component names will be matched withprojectIds
- the list of project ids to filter components
-
validateProjectId
protected void validateProjectId(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, Long projectId) Validates project ID. Project ID is valid if not null.- Parameters:
handler
- validation and permission check handlerprojectId
- project ID
-
validateName
protected void validateName(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, String oldName, String newName, Long projectId) Validates newName. Name must be not null and unique.- Parameters:
oldName
- old namenewName
- new nameprojectId
- project IDhandler
- validation and permission check handler
-
validateLead
protected void validateLead(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.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:
lead
- leadhandler
- validation and permission check handler
-
validateAssigneeType
protected void validateAssigneeType(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.Handler handler, Long assigneeType) -
verifyUserExists
protected void verifyUserExists(com.atlassian.jira.bc.project.component.DefaultProjectComponentService.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
-