Class DefaultProjectComponentManager
java.lang.Object
com.atlassian.jira.bc.project.component.DefaultProjectComponentManager
- All Implemented Interfaces:
ProjectComponentManager
Validates project component values and provides methods for accessing and persisting project components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.atlassian.event.api.EventPublisher
protected static final String
lead field nameprotected static final String
name field nameprotected static final String
project ID field nameFields inherited from interface com.atlassian.jira.bc.project.component.ProjectComponentManager
NO_COMPONENTS
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultProjectComponentManager
(ProjectComponentStore store, IssueManager issueManager, com.atlassian.event.api.EventPublisher eventPublisher, UserManager userManager, NodeAssociationStore nodeAssociationStore, DbConnectionManager dbConnectionManager) Creates a new instance of this class and sets the store that will be used for persistence. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 ProjectComponent
Convert the specified MutableProjectComponent to a ProjectComponent object.Create a new ProjectComponent object associated with the project with the ID specified and with the values given.void
Delete the component.void
deleteAllComponents
(Long projectId) Deletes all components in given project.Find the component with the specified IDfindAll()
Implement this method to find all components.findAllActiveForProject
(Long projectId) Returns all active components for given project.findAllArchivedForProject
(Long projectId) Returns all archived components for given project.findAllForProject
(Long projectId) Find all components associated with the project with the ID specifiedfindAllUniqueNamesForProjectObjects
(Collection<Project> projects) Returns all unique names of the components that belong to the passed projects.findAllUniqueNamesForProjects
(Collection<Long> projectIds) Returns all unique names of components associated with all the projects with the ID-s specified.findByComponentName
(Long projectId, String componentName) Finds the ProjectComponent with the given name in the project with the given id.findByComponentNameCaseInSensitive
(String componentName) Finds all ProjectComponents with the given name with comparisons case insenstive.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.findComponentsByLead
(String userName) Retrieve a collection of components - where the lead of each component is the specified user.Implement this method to look up the project ID for the given component ID.protected ComponentConverter
getComponents
(List<Long> ids) Creates a list of ProjectComponent objects from the given list of IDs.getIssueIdsWithComponent
(ProjectComponent component) Returns a list of all Issue IDs with the given component.getProjectComponent
(Long projectComponentId) Returns the component with the given ID or null if not found.int
update
(MutableProjectComponent component) Update the component specified with the values given.updateIssueProjectComponents
(Issue issue, Collection<ProjectComponent> newValue) Updates the list of components in issue
-
Field Details
-
FIELD_PROJECT_ID
project ID field name- See Also:
-
FIELD_NAME
name field name- See Also:
-
FIELD_LEAD
lead field name- See Also:
-
eventPublisher
protected final com.atlassian.event.api.EventPublisher eventPublisher
-
-
Constructor Details
-
DefaultProjectComponentManager
public DefaultProjectComponentManager(ProjectComponentStore store, IssueManager issueManager, com.atlassian.event.api.EventPublisher eventPublisher, UserManager userManager, NodeAssociationStore nodeAssociationStore, DbConnectionManager dbConnectionManager) Creates a new instance of this class and sets the store that will be used for persistence.- Parameters:
store
- persistent storeissueManager
-eventPublisher
-dbConnectionManager
-
-
-
Method Details
-
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 interfaceProjectComponentManager
- Parameters:
name
- name of componentdescription
- description of componentlead
- user name associated with componentprojectId
- ID of project that component is associated withassigneeType
- assignee type- Returns:
- new instance of ProjectComponent with the values specified
- Throws:
IllegalArgumentException
- if one or more arguments have invalid values
-
find
Find the component with the specified ID- Specified by:
find
in interfaceProjectComponentManager
- Parameters:
id
- component ID to search for- Returns:
- ProjectComponent with the specified ID
- Throws:
EntityNotFoundException
- if the component is not found
-
getProjectComponent
Description copied from interface:ProjectComponentManager
Returns the component with the given ID or null if not found.- Specified by:
getProjectComponent
in interfaceProjectComponentManager
- Parameters:
projectComponentId
- component ID- Returns:
- the component with the given ID or null if not found.
-
findAllForProject
Find all components associated with the project with the ID specified- Specified by:
findAllForProject
in interfaceProjectComponentManager
- Parameters:
projectId
- ID of project to search for- Returns:
- collection of ProjectComponent objects associated with the project with the ID specified
-
findAllActiveForProject
Description copied from interface:ProjectComponentManager
Returns all active components for given project.- Specified by:
findAllActiveForProject
in interfaceProjectComponentManager
- Parameters:
projectId
- id of the project- Returns:
- collection of active components.
-
findAllArchivedForProject
Description copied from interface:ProjectComponentManager
Returns all archived components for given project.- Specified by:
findAllArchivedForProject
in interfaceProjectComponentManager
- Parameters:
projectId
- id of the project- Returns:
- collection of archived components.
-
findAllUniqueNamesForProjects
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 interfaceProjectComponentManager
- 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
Description copied from interface:ProjectComponentManager
Implement this method to find all components.- Specified by:
findAll
in interfaceProjectComponentManager
- Returns:
- collection of all ProjectComponent objects
-
getTotalComponentCount
public int getTotalComponentCount()- Specified by:
getTotalComponentCount
in interfaceProjectComponentManager
- Returns:
- count of all components.
-
findAllUniqueNamesForProjectObjects
Description copied from interface:ProjectComponentManager
Returns all unique names of the components that belong to the passed projects.- Specified by:
findAllUniqueNamesForProjectObjects
in interfaceProjectComponentManager
- Parameters:
projects
- projects to search in- Returns:
- collection of unique names of all components.
-
getComponents
Description copied from interface:ProjectComponentManager
Creates a list of ProjectComponent objects from the given list of IDs.- Specified by:
getComponents
in interfaceProjectComponentManager
- 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
Update the component specified with the values given.- Specified by:
update
in interfaceProjectComponentManager
- Parameters:
component
- component to be updated- Returns:
- ProjectComponent with updated values as specified
- Throws:
EntityNotFoundException
- if component is not found
-
updateIssueProjectComponents
public List<ChangeItemBean> updateIssueProjectComponents(Issue issue, Collection<ProjectComponent> newValue) Description copied from interface:ProjectComponentManager
Updates the list of components in issue- Specified by:
updateIssueProjectComponents
in interfaceProjectComponentManager
- Parameters:
issue
- updated issuenewValue
- list of components- Returns:
- list of ChangeItemBean
-
delete
Delete the component.- Specified by:
delete
in interfaceProjectComponentManager
- Parameters:
componentId
- component id- Throws:
EntityNotFoundException
- if the component is not found
-
deleteAllComponents
Description copied from interface:ProjectComponentManager
Deletes all components in given project. Note that this method will not fire a ProjectComponentDeleted upon deletion of a component.- Specified by:
deleteAllComponents
in interfaceProjectComponentManager
- Parameters:
projectId
- id of the project in which components will be deleted.
-
containsName
Check whether component with specified name is stored.- Specified by:
containsName
in interfaceProjectComponentManager
- Parameters:
name
- component name, null will cause IllegalArgumentExceptionprojectId
- project ID- Returns:
- true if new name is stored
-
findProjectIdForComponent
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 interfaceProjectComponentManager
- Parameters:
id
- component ID- Returns:
- project ID
- Throws:
EntityNotFoundException
- if component with the specified id cannot be found
-
convertToProjectComponent
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
-
convertToGenericValue
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 interfaceProjectComponentManager
- 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 interfaceProjectComponentManager
- Parameters:
projectComponents
- a collection of project components- Returns:
- Collection of GenericValues representing the collection of ProjectComponent objects passed in
-
findByComponentName
Description copied from interface:ProjectComponentManager
Finds the ProjectComponent with the given name in the project with the given id.- Specified by:
findByComponentName
in interfaceProjectComponentManager
- Parameters:
projectId
- id of the project.componentName
- name of the component.- Returns:
- the ProjectComponent or null if there is no such ProjectComponent.
-
findByComponentNameCaseInSensitive
Description copied from interface:ProjectComponentManager
Finds all ProjectComponents with the given name with comparisons case insenstive.- Specified by:
findByComponentNameCaseInSensitive
in interfaceProjectComponentManager
- Parameters:
componentName
- name of the component.- Returns:
- all ProjectComponents with the given name or an empty collection if there is no such ProjectComponent.
-
findComponentsByLead
Retrieve a collection of components - where the lead of each component is the specified user.- Specified by:
findComponentsByLead
in interfaceProjectComponentManager
- Parameters:
userName
- the lead user name- Returns:
- collection of components - where the lead of each component is the specified user
-
findComponentsByIssue
- Specified by:
findComponentsByIssue
in interfaceProjectComponentManager
- Parameters:
issue
- find components on this issue- Returns:
- collection of project components associated with this issue
-
getIssueIdsWithComponent
Description copied from interface:ProjectComponentManager
Returns a list of all Issue IDs with the given component.- Specified by:
getIssueIdsWithComponent
in interfaceProjectComponentManager
- Parameters:
component
- the component- Returns:
- a not null list of all Issue IDs with the given component.
-
findComponentsByIssueGV
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 interfaceProjectComponentManager
- Parameters:
issue
- find components for this issue- Returns:
- collection of generic values representing the components assigned to the issue
-
getComponentConverter
-