com.atlassian.jira.mock.project.component
Class MockProjectComponentManager

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

public class MockProjectComponentManager
extends Object
implements ProjectComponentManager


Field Summary
 
Fields inherited from interface com.atlassian.jira.bc.project.component.ProjectComponentManager
NO_COMPONENTS
 
Constructor Summary
MockProjectComponentManager()
           
 
Method Summary
 boolean containsName(String name, Long projectId)
          Implement this method in order to 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.
 ProjectComponent create(String name, String description, String lead, long assigneeType, Long projectId)
          Implement this method to create a new ProjectComponent object associated with the project with the ID specified and with the values given.
 void delete(Long componentId)
          Implement this method to delete the component.
 ProjectComponent find(Long id)
          Implement this method to find the component with the specified ID.
 Collection<ProjectComponent> findAll()
          Implement this method to find all components.
 Collection<ProjectComponent> findAllForProject(Long projectId)
          Implement this method to 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 ProjectComponents - where the lead of each component is the specified user.
 Long findProjectIdForComponent(Long componentId)
          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.
 Collection<Long> getIssueIdsWithComponent(ProjectComponent component)
          Returns a list of all Issue IDs with the given component.
 ProjectComponent update(MutableProjectComponent component)
          Implement this method to 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
 

Constructor Detail

MockProjectComponentManager

public MockProjectComponentManager()
Method Detail

create

public ProjectComponent create(String name,
                               String description,
                               String lead,
                               long assigneeType,
                               Long projectId)
                        throws IllegalArgumentException
Description copied from interface: ProjectComponentManager
Implement this method to create a new ProjectComponent object associated with the project with the ID specified and with the values given. It should also validate the values - store and return the ProjectComponent if validation succeeds. Otherwise, throw ValidationErrorsException.

Specified by:
create in interface ProjectComponentManager
Parameters:
name - name of component
description - description of component
lead - user name associated with component
assigneeType - assignee type
projectId - ID of project that component is associated with
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
Description copied from interface: ProjectComponentManager
Implement this method to 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)
Description copied from interface: ProjectComponentManager
Implement this method to 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
Description copied from interface: ProjectComponentManager
Implement this method to 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
Description copied from interface: ProjectComponentManager
Implement this method to 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)
Description copied from interface: ProjectComponentManager
Implement this method in order to 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 componentId)
                               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:
componentId - component ID
Returns:
project ID
Throws:
EntityNotFoundException - if component with the specified id cannot be found

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)
Description copied from interface: ProjectComponentManager
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)
Description copied from interface: ProjectComponentManager
Retrieve a collection of ProjectComponents - 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


Copyright © 2002-2014 Atlassian. All Rights Reserved.