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.EventPublisherprotected static final Stringlead field nameprotected static final Stringname field nameprotected static final Stringproject 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 TypeMethodDescriptionbooleancontainsName(String name, Long projectId) Check whether component with specified name is stored.org.ofbiz.core.entity.GenericValueconvertToGenericValue(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 ProjectComponentConvert 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.voidDelete the component.voiddeleteAllComponents(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 ComponentConvertergetComponents(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.intupdate(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:
createin 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:
findin 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:ProjectComponentManagerReturns the component with the given ID or null if not found.- Specified by:
getProjectComponentin 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:
findAllForProjectin 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:ProjectComponentManagerReturns all active components for given project.- Specified by:
findAllActiveForProjectin interfaceProjectComponentManager- Parameters:
projectId- id of the project- Returns:
- collection of active components.
-
findAllArchivedForProject
Description copied from interface:ProjectComponentManagerReturns all archived components for given project.- Specified by:
findAllArchivedForProjectin interfaceProjectComponentManager- Parameters:
projectId- id of the project- Returns:
- collection of archived components.
-
findAllUniqueNamesForProjects
Description copied from interface:ProjectComponentManagerReturns all unique names of components associated with all the projects with the ID-s specified.- Specified by:
findAllUniqueNamesForProjectsin 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:ProjectComponentManagerImplement this method to find all components.- Specified by:
findAllin interfaceProjectComponentManager- Returns:
- collection of all ProjectComponent objects
-
getTotalComponentCount
public int getTotalComponentCount()- Specified by:
getTotalComponentCountin interfaceProjectComponentManager- Returns:
- count of all components.
-
findAllUniqueNamesForProjectObjects
Description copied from interface:ProjectComponentManagerReturns all unique names of the components that belong to the passed projects.- Specified by:
findAllUniqueNamesForProjectObjectsin interfaceProjectComponentManager- Parameters:
projects- projects to search in- Returns:
- collection of unique names of all components.
-
getComponents
Description copied from interface:ProjectComponentManagerCreates a list of ProjectComponent objects from the given list of IDs.- Specified by:
getComponentsin 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:
updatein 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:ProjectComponentManagerUpdates the list of components in issue- Specified by:
updateIssueProjectComponentsin interfaceProjectComponentManager- Parameters:
issue- updated issuenewValue- list of components- Returns:
- list of ChangeItemBean
-
delete
Delete the component.- Specified by:
deletein interfaceProjectComponentManager- Parameters:
componentId- component id- Throws:
EntityNotFoundException- if the component is not found
-
deleteAllComponents
Description copied from interface:ProjectComponentManagerDeletes all components in given project. Note that this method will not fire a ProjectComponentDeleted upon deletion of a component.- Specified by:
deleteAllComponentsin interfaceProjectComponentManager- Parameters:
projectId- id of the project in which components will be deleted.
-
containsName
Check whether component with specified name is stored.- Specified by:
containsNamein interfaceProjectComponentManager- Parameters:
name- component name, null will cause IllegalArgumentExceptionprojectId- project ID- Returns:
- true if new name is stored
-
findProjectIdForComponent
Description copied from interface:ProjectComponentManagerImplement this method to look up the project ID for the given component ID. If project is not found, throws EntityNotFoundException.- Specified by:
findProjectIdForComponentin 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:ProjectComponentManagerConverts the ProjectComponent to GenericValue form, provided as a transitional measure until GenericValue is eradicated from the front end.- Specified by:
convertToGenericValuein 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:
convertToGenericValuesin 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:ProjectComponentManagerFinds the ProjectComponent with the given name in the project with the given id.- Specified by:
findByComponentNamein 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:ProjectComponentManagerFinds all ProjectComponents with the given name with comparisons case insenstive.- Specified by:
findByComponentNameCaseInSensitivein 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:
findComponentsByLeadin interfaceProjectComponentManager- Parameters:
userName- the lead user name- Returns:
- collection of components - where the lead of each component is the specified user
-
findComponentsByIssue
- Specified by:
findComponentsByIssuein interfaceProjectComponentManager- Parameters:
issue- find components on this issue- Returns:
- collection of project components associated with this issue
-
getIssueIdsWithComponent
Description copied from interface:ProjectComponentManagerReturns a list of all Issue IDs with the given component.- Specified by:
getIssueIdsWithComponentin interfaceProjectComponentManager- Parameters:
component- the component- Returns:
- a not null list of all Issue IDs with the given component.
-
findComponentsByIssueGV
Description copied from interface:ProjectComponentManagerThis 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:
findComponentsByIssueGVin interfaceProjectComponentManager- Parameters:
issue- find components for this issue- Returns:
- collection of generic values representing the components assigned to the issue
-
getComponentConverter
-