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 java.lang.Object
implements ProjectComponentManager

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


Field Summary
protected static java.lang.String FIELD_LEAD
          lead field name
protected static java.lang.String FIELD_NAME
          name field name
protected static java.lang.String FIELD_PROJECT_ID
          project ID field name
 
Constructor Summary
DefaultProjectComponentManager(ProjectComponentStore store, IssueManager issueManager)
          Creates a new instance of this class and sets the store that will be used for persistence.
 
Method Summary
 boolean containsName(java.lang.String name, java.lang.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.
 java.util.Collection<org.ofbiz.core.entity.GenericValue> convertToGenericValues(java.util.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(java.lang.String name, java.lang.String description, java.lang.String lead, long assigneeType, java.lang.Long projectId)
          Create a new ProjectComponent object associated with the project with the ID specified and with the values given.
 void delete(java.lang.Long componentId)
          Delete the component.
 ProjectComponent find(java.lang.Long id)
          Find the component with the specified ID
 java.util.Collection<ProjectComponent> findAll()
          Implement this method to find all components.
 java.util.Collection<ProjectComponent> findAllForProject(java.lang.Long projectId)
          Find all components associated with the project with the ID specified
 ProjectComponent findByComponentName(java.lang.Long projectId, java.lang.String componentName)
          Finds the ProjectComponent with the given name in the project with the given id.
 java.util.Collection<ProjectComponent> findByComponentNameCaseInSensitive(java.lang.String componentName)
          Finds all ProjectComponents with the given name with comparisons case insenstive.
 java.util.Collection<ProjectComponent> findComponentsByIssue(Issue issue)
           
 java.util.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.
 java.util.Collection<ProjectComponent> findComponentsByLead(java.lang.String userName)
          Retrieve a collection of components - where the lead of each component is the specified user.
 java.lang.Long findProjectIdForComponent(java.lang.Long id)
          Implement this method to look up the project ID for the given component ID.
protected  ComponentConverter getComponentConverter()
           
 java.util.List<ProjectComponent> getComponents(java.util.List<java.lang.Long> ids)
          Creates a list of ProjectComponent objects from the given list of IDs.
 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 java.lang.String FIELD_PROJECT_ID
project ID field name

See Also:
Constant Field Values

FIELD_NAME

protected static final java.lang.String FIELD_NAME
name field name

See Also:
Constant Field Values

FIELD_LEAD

protected static final java.lang.String FIELD_LEAD
lead field name

See Also:
Constant Field Values
Constructor Detail

DefaultProjectComponentManager

public DefaultProjectComponentManager(ProjectComponentStore store,
                                      IssueManager issueManager)
Creates a new instance of this class and sets the store that will be used for persistence.

Parameters:
store - persistent store
issueManager -
Method Detail

create

public ProjectComponent create(java.lang.String name,
                               java.lang.String description,
                               java.lang.String lead,
                               long assigneeType,
                               java.lang.Long projectId)
                        throws java.lang.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:
java.lang.IllegalArgumentException - if one or more arguments have invalid values

find

public ProjectComponent find(java.lang.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 java.util.Collection<ProjectComponent> findAllForProject(java.lang.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

findAll

public java.util.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

getComponents

public java.util.List<ProjectComponent> getComponents(java.util.List<java.lang.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(java.lang.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(java.lang.String name,
                            java.lang.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 java.lang.Long findProjectIdForComponent(java.lang.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 java.util.Collection<org.ofbiz.core.entity.GenericValue> convertToGenericValues(java.util.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(java.lang.Long projectId,
                                            java.lang.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 java.util.Collection<ProjectComponent> findByComponentNameCaseInSensitive(java.lang.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 java.util.Collection<ProjectComponent> findComponentsByLead(java.lang.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 java.util.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

findComponentsByIssueGV

public java.util.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-2011 Atlassian. All Rights Reserved.