com.atlassian.jira.bc.project.component
Class DefaultProjectComponentService

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

public class DefaultProjectComponentService
extends Object
implements ProjectComponentService


Field Summary
static String FIELD_COMPONENT_LEAD
          lead field name
static String FIELD_NAME
          name field name
static String FIELD_PROJECT_ID
          project ID field name
static String KEY_ID_NULL
           
static String KEY_NAME_NOT_SET
           
static String KEY_NAME_NOT_UNIQUE
           
static String KEY_NO_SUCH_COMPONENT
           
static String KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID
           
static String KEY_NO_SUCH_COMPONENT_WITH_ID
           
static String KEY_PROJECT_ID_NOT_FOUND
           
static String KEY_PROJECT_ID_NULL
           
static String KEY_USER_DOES_NOT_EXIST
           
static String KEY_USER_NO_PERMISSION
           
static String KEY_USER_NO_PERMISSION_WITH_USER
           
 
Constructor Summary
DefaultProjectComponentService(JiraAuthenticationContext jiraAuthenticationContext, PermissionManager permissionManager, ProjectComponentManager projectComponentManager, ProjectManager projectManager, IssueManager issueManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, UserManager userManager)
           
 
Method Summary
 ProjectComponent create(com.atlassian.crowd.embedded.api.User 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.
 void deleteAndSwapComponentForIssues(JiraServiceContext context, Long componentId, Long swapComponentId)
           
 void deleteComponentForIssues(JiraServiceContext context, Long componentId)
           
 ProjectComponent find(com.atlassian.crowd.embedded.api.User user, ErrorCollection errorCollection, Long id)
           
 Collection<ProjectComponent> findAllForProject(ErrorCollection errorCollection, Long projectId)
           
 ProjectComponent update(com.atlassian.crowd.embedded.api.User user, ErrorCollection errorCollection, MutableProjectComponent component)
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_USER_NO_PERMISSION

public static final String KEY_USER_NO_PERMISSION
See Also:
Constant Field Values

KEY_USER_NO_PERMISSION_WITH_USER

public static final String KEY_USER_NO_PERMISSION_WITH_USER
See Also:
Constant Field Values

KEY_NO_SUCH_COMPONENT

public static final String KEY_NO_SUCH_COMPONENT
See Also:
Constant Field Values

KEY_NO_SUCH_COMPONENT_WITH_ID

public static final String KEY_NO_SUCH_COMPONENT_WITH_ID
See Also:
Constant Field Values

KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID

public static final String KEY_NO_SUCH_COMPONENT_TO_SWAP_WITH_ID
See Also:
Constant Field Values

KEY_ID_NULL

public static final String KEY_ID_NULL
See Also:
Constant Field Values

KEY_PROJECT_ID_NULL

public static final String KEY_PROJECT_ID_NULL
See Also:
Constant Field Values

KEY_PROJECT_ID_NOT_FOUND

public static final String KEY_PROJECT_ID_NOT_FOUND
See Also:
Constant Field Values

KEY_NAME_NOT_SET

public static final String KEY_NAME_NOT_SET
See Also:
Constant Field Values

KEY_NAME_NOT_UNIQUE

public static final String KEY_NAME_NOT_UNIQUE
See Also:
Constant Field Values

KEY_USER_DOES_NOT_EXIST

public static final String KEY_USER_DOES_NOT_EXIST
See Also:
Constant Field Values

FIELD_PROJECT_ID

public static final String FIELD_PROJECT_ID
project ID field name

See Also:
Constant Field Values

FIELD_NAME

public static final String FIELD_NAME
name field name

See Also:
Constant Field Values

FIELD_COMPONENT_LEAD

public static final String FIELD_COMPONENT_LEAD
lead field name

See Also:
Constant Field Values
Constructor Detail

DefaultProjectComponentService

public DefaultProjectComponentService(JiraAuthenticationContext jiraAuthenticationContext,
                                      PermissionManager permissionManager,
                                      ProjectComponentManager projectComponentManager,
                                      ProjectManager projectManager,
                                      IssueManager issueManager,
                                      com.atlassian.crowd.embedded.api.CrowdService crowdService,
                                      UserManager userManager)
Method Detail

create

public ProjectComponent create(com.atlassian.crowd.embedded.api.User 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

find

public ProjectComponent find(com.atlassian.crowd.embedded.api.User 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(com.atlassian.crowd.embedded.api.User 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

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

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


Copyright © 2002-2013 Atlassian. All Rights Reserved.