Class DefaultProjectComponentService

java.lang.Object
com.atlassian.jira.bc.project.component.DefaultProjectComponentService
All Implemented Interfaces:
ProjectComponentService

public class DefaultProjectComponentService extends Object implements ProjectComponentService
  • Field Details

  • Constructor Details

  • 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 interface ProjectComponentService
      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
    • 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 interface ProjectComponentService
      Returns:
      A newly created project component ProjectComponent
    • find

      public ProjectComponent find(ApplicationUser user, ErrorCollection errorCollection, Long id)
      Specified by:
      find in interface ProjectComponentService
      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
    • findAllForProject

      public Collection<ProjectComponent> findAllForProject(ErrorCollection errorCollection, Long projectId)
      Specified by:
      findAllForProject in interface ProjectComponentService
    • update

      public ProjectComponent update(ApplicationUser user, ErrorCollection errorCollection, MutableProjectComponent component)
      Specified by:
      update in interface ProjectComponentService
    • deleteComponentForIssues

      public void deleteComponentForIssues(JiraServiceContext context, Long componentId)
      Specified by:
      deleteComponentForIssues in interface ProjectComponentService
    • deleteAndSwapComponentForIssues

      public void deleteAndSwapComponentForIssues(JiraServiceContext context, Long componentId, Long swapComponentId)
      Specified by:
      deleteAndSwapComponentForIssues in interface ProjectComponentService
    • 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 interface ProjectComponentService
      Parameters:
      user - the calling user
      substring - the string that component names will be matched with
      projectIds - 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 handler
      projectId - 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 name
      newName - new name
      projectId - project ID
      handler - 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 - lead
      handler - 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