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

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

public class DefaultProjectComponentManager
extends Object
implements ProjectComponentManager

Validates project component values and provides methods for accessing and persisting project components.


Field Summary
protected  com.atlassian.event.api.EventPublisher eventPublisher
           
protected static String FIELD_LEAD
          lead field name
protected static String FIELD_NAME
          name field name
protected static String FIELD_PROJECT_ID
          project ID field name
 
Fields inherited from interface com.atlassian.jira.bc.project.component.ProjectComponentManager
NO_COMPONENTS
 
Constructor Summary
DefaultProjectComponentManager(ProjectComponentStore store, IssueManager issueManager, com.atlassian.event.api.EventPublisher eventPublisher, UserManager userManager, NodeAssociationStore nodeAssociationStore)
          Creates a new instance of this class and sets the store that will be used for persistence.
 
Method Summary
 boolean containsName(String name, Long projectId)
          Check whether component with specified name is stored.
 org.ofbiz.core.entity.GenericValue convertToGenericValue(ProjectComponent projectComponent)
          Converts the ProjectComponent to GenericValue form, provided as a transitional measure until GenericValue is eradicated from the front end.
 Collection<org.ofbiz.core.entity.GenericValue> convertToGenericValues(Collection<ProjectComponent> projectComponents)
          Temporary method to allow conversion of a collection of ProjectComponent objects to a collection of GenericValues representing a project component.
protected  MutableProjectComponent convertToMutableProjectComponent(ProjectComponent value)
          Convert the specified ProjectComponent to a MutableProjectComponent object and sets its project ID with the given value.
protected  ProjectComponent convertToProjectComponent(MutableProjectComponent value)
          Convert the specified MutableProjectComponent to a ProjectComponent object.
 ProjectComponent create(String name, String description, String lead, long assigneeType, Long projectId)
          Create a new ProjectComponent object associated with the project with the ID specified and with the values given.
 void delete(Long componentId)
          Delete the component.
 ProjectComponent find(Long id)
          Find the component with the specified ID
 Collection<ProjectComponent> findAll()
          Implement this method to find all components.
 Collection<ProjectComponent> findAllForProject(Long projectId)
          Find all components associated with the project with the ID specified
 Collection<String> findAllUniqueNamesForProjectObjects(Collection<Project> projects)
          Returns all unique names of the components that belong to the passed projects.
 Collection<String> findAllUniqueNamesForProjects(Collection<Long> projectIds)
          Returns all unique names of components associated with all the projects with the ID-s specified.
 ProjectComponent findByComponentName(Long projectId, String componentName)
          Finds the ProjectComponent with the given name in the project with the given id.
 Collection<ProjectComponent> findByComponentNameCaseInSensitive(String componentName)
          Finds all ProjectComponents with the given name with comparisons case insenstive.
 Collection<ProjectComponent> findComponentsByIssue(Issue issue)
           
 Collection<org.ofbiz.core.entity.GenericValue> findComponentsByIssueGV(Issue issue)
          This code used to live directly in the IssueImpl but it has been refactored into the ProjectComponentManager to make things a little cleaner.
 Collection<ProjectComponent> findComponentsByLead(String userName)
          Retrieve a collection of components - where the lead of each component is the specified user.
 Long findProjectIdForComponent(Long id)
          Implement this method to look up the project ID for the given component ID.
protected  ComponentConverter getComponentConverter()
           
 List<ProjectComponent> getComponents(List<Long> ids)
          Creates a list of ProjectComponent objects from the given list of IDs.
 Collection<Long> getIssueIdsWithComponent(ProjectComponent component)
          Returns a list of all Issue IDs with the given component.
 ProjectComponent update(MutableProjectComponent component)
          Update the component specified with the values given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_PROJECT_ID

protected static final String FIELD_PROJECT_ID
project ID field name

See Also:
Constant Field Values

FIELD_NAME

protected static final String FIELD_NAME
name field name

See Also:
Constant Field Values

FIELD_LEAD

protected static final String FIELD_LEAD
lead field name

See Also:
Constant Field Values

eventPublisher

protected final com.atlassian.event.api.EventPublisher eventPublisher
Constructor Detail

DefaultProjectComponentManager

public DefaultProjectComponentManager(ProjectComponentStore store,
                                      IssueManager issueManager,
                                      com.atlassian.event.api.EventPublisher eventPublisher,
                                      UserManager userManager,
                                      NodeAssociationStore nodeAssociationStore)
Creates a new instance of this class and sets the store that will be used for persistence.

Parameters:
store - persistent store
issueManager -
eventPublisher -
Method Detail

create

public ProjectComponent create(String name,
                               String description,
                               String lead,
                               long assigneeType,
                               Long projectId)
                        throws IllegalArgumentException
Create a new ProjectComponent object associated with the project with the ID specified and with the values given.

Specified by:
create in interface ProjectComponentManager
Parameters:
name - name of component
description - description of component
lead - user name associated with component
projectId - ID of project that component is associated with
assigneeType - assignee type
Returns:
new instance of ProjectComponent with the values specified
Throws:
IllegalArgumentException - if one or more arguments have invalid values

find

public ProjectComponent find(Long id)
                      throws EntityNotFoundException
Find the component with the specified ID

Specified by:
find in interface ProjectComponentManager
Parameters:
id - component ID to search for
Returns:
ProjectComponent with the specified ID
Throws:
EntityNotFoundException - if the component is not found

findAllForProject

public Collection<ProjectComponent> findAllForProject(Long projectId)
Find all components associated with the project with the ID specified

Specified by:
findAllForProject in interface ProjectComponentManager
Parameters:
projectId - ID of project to search for
Returns:
collection of ProjectComponent objects associated with the project with the ID specified

findAllUniqueNamesForProjects

public Collection<String> findAllUniqueNamesForProjects(Collection<Long> projectIds)
Description copied from interface: ProjectComponentManager
Returns all unique names of components associated with all the projects with the ID-s specified.

Specified by:
findAllUniqueNamesForProjects in interface ProjectComponentManager
Parameters:
projectIds - ID-s of project to search for
Returns:
collection of unique names of components associated with all the projects with the ID-s specified.

findAll

public Collection<ProjectComponent> findAll()
Description copied from interface: ProjectComponentManager
Implement this method to find all components.

Specified by:
findAll in interface ProjectComponentManager
Returns:
collection of all ProjectComponent objects

findAllUniqueNamesForProjectObjects

public Collection<String> findAllUniqueNamesForProjectObjects(Collection<Project> projects)
Description copied from interface: ProjectComponentManager
Returns all unique names of the components that belong to the passed projects.

Specified by:
findAllUniqueNamesForProjectObjects in interface ProjectComponentManager
Parameters:
projects - projects to search in
Returns:
collection of unique names of all components.

getComponents

public List<ProjectComponent> getComponents(List<Long> ids)
                                     throws EntityNotFoundException
Description copied from interface: ProjectComponentManager
Creates a list of ProjectComponent objects from the given list of IDs.

Specified by:
getComponents in interface ProjectComponentManager
Parameters:
ids - The List of ProjectComponent IDs.
Returns:
a list of ProjectComponent objects from the given list of IDs.
Throws:
EntityNotFoundException - if no ProjectComponent exists for any of the given IDs.

update

public ProjectComponent update(MutableProjectComponent component)
                        throws EntityNotFoundException
Update the component specified with the values given.

Specified by:
update in interface ProjectComponentManager
Parameters:
component - component to be updated
Returns:
ProjectComponent with updated values as specified
Throws:
EntityNotFoundException - if component is not found

delete

public void delete(Long componentId)
            throws EntityNotFoundException
Delete the component.

Specified by:
delete in interface ProjectComponentManager
Parameters:
componentId - component id
Throws:
EntityNotFoundException - if the component is not found

containsName

public boolean containsName(String name,
                            Long projectId)
Check whether component with specified name is stored.

Specified by:
containsName in interface ProjectComponentManager
Parameters:
name - component name, null will cause IllegalArgumentException
projectId - project ID
Returns:
true if new name is stored

findProjectIdForComponent

public Long findProjectIdForComponent(Long id)
                               throws EntityNotFoundException
Description copied from interface: ProjectComponentManager
Implement this method to look up the project ID for the given component ID. If project is not found, throws EntityNotFoundException.

Specified by:
findProjectIdForComponent in interface ProjectComponentManager
Parameters:
id - component ID
Returns:
project ID
Throws:
EntityNotFoundException - if component with the specified id cannot be found

convertToProjectComponent

protected ProjectComponent convertToProjectComponent(MutableProjectComponent value)
Convert the specified MutableProjectComponent to a ProjectComponent object.

Parameters:
value - MutableProjectComponent to be converted into a ProjectComponent.
Returns:
new instance of ProjectComponent with same values as given in the parameter object

convertToMutableProjectComponent

protected MutableProjectComponent convertToMutableProjectComponent(ProjectComponent value)
Convert the specified ProjectComponent to a MutableProjectComponent object and sets its project ID with the given value.

Parameters:
value - ProjectComponent to be converted into a MutableProjectComponent.
Returns:
new instance of MutableProjectComponent with same values as given in the parameter object and with project ID set

convertToGenericValue

public org.ofbiz.core.entity.GenericValue convertToGenericValue(ProjectComponent projectComponent)
Description copied from interface: ProjectComponentManager
Converts the ProjectComponent to GenericValue form, provided as a transitional measure until GenericValue is eradicated from the front end.

Specified by:
convertToGenericValue in interface ProjectComponentManager
Parameters:
projectComponent - project component
Returns:
the ProjectComponent as a GenericValue.

convertToGenericValues

public Collection<org.ofbiz.core.entity.GenericValue> convertToGenericValues(Collection<ProjectComponent> projectComponents)
Temporary method to allow conversion of a collection of ProjectComponent objects to a collection of GenericValues representing a project component.

Specified by:
convertToGenericValues in interface ProjectComponentManager
Parameters:
projectComponents - a collection of project components
Returns:
Collection of GenericValues representing the collection of ProjectComponent objects passed in

findByComponentName

public ProjectComponent findByComponentName(Long projectId,
                                            String componentName)
Description copied from interface: ProjectComponentManager
Finds the ProjectComponent with the given name in the project with the given id.

Specified by:
findByComponentName in interface ProjectComponentManager
Parameters:
projectId - id of the project.
componentName - name of the component.
Returns:
the ProjectComponent or null if there is no such ProjectComponent.

findByComponentNameCaseInSensitive

public Collection<ProjectComponent> findByComponentNameCaseInSensitive(String componentName)
Description copied from interface: ProjectComponentManager
Finds all ProjectComponents with the given name with comparisons case insenstive.

Specified by:
findByComponentNameCaseInSensitive in interface ProjectComponentManager
Parameters:
componentName - name of the component.
Returns:
all ProjectComponents with the given name or an empty collection if there is no such ProjectComponent.

findComponentsByLead

public Collection<ProjectComponent> findComponentsByLead(String userName)
Retrieve a collection of components - where the lead of each component is the specified user.

Specified by:
findComponentsByLead in interface ProjectComponentManager
Parameters:
userName - the lead user name
Returns:
collection of components - where the lead of each component is the specified user

findComponentsByIssue

public Collection<ProjectComponent> findComponentsByIssue(Issue issue)
Specified by:
findComponentsByIssue in interface ProjectComponentManager
Parameters:
issue - find components on this issue
Returns:
collection of project components associated with this issue

getIssueIdsWithComponent

@Nonnull
public Collection<Long> getIssueIdsWithComponent(@Nonnull
                                                         ProjectComponent component)
Description copied from interface: ProjectComponentManager
Returns a list of all Issue IDs with the given component.

Specified by:
getIssueIdsWithComponent in interface ProjectComponentManager
Parameters:
component - the component
Returns:
a not null list of all Issue IDs with the given component.

findComponentsByIssueGV

public Collection<org.ofbiz.core.entity.GenericValue> findComponentsByIssueGV(Issue issue)
Description copied from interface: ProjectComponentManager
This code used to live directly in the IssueImpl but it has been refactored into the ProjectComponentManager to make things a little cleaner. That's why it is "new in 4.2" but immediately marked as deprecated

Specified by:
findComponentsByIssueGV in interface ProjectComponentManager
Parameters:
issue - find components for this issue
Returns:
collection of generic values representing the components assigned to the issue

getComponentConverter

protected ComponentConverter getComponentConverter()


Copyright © 2002-2015 Atlassian. All Rights Reserved.