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 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
 
Constructor Summary
DefaultProjectComponentManager(ProjectComponentStore store)
          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
 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> 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.
 List<ProjectComponent> getComponents(List<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 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
Constructor Detail

DefaultProjectComponentManager

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

Parameters:
store - persistent store
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

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

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


Copyright © 2002-2009 Atlassian. All Rights Reserved.