private void swapComponentForAffectedIssues(final JiraServiceContext context, final ProjectComponent component, final ProjectComponent swapComponent) { // Get all issues that reference the component we are going to delete Collection<Long> affectedIssues = projectComponentManager.getIssueIdsWithComponent(component); for (final Long issueId : affectedIssues) { MutableIssue issue = issueManager.getIssueObject(issueId); Collection<ProjectComponent> newComponents = getNewComponents(issue, component, swapComponent); issue.setComponent(newComponents); // Use the backend issue update action to update the issue issueManager.updateIssue(context.getLoggedInUser(), issue, EventDispatchOption.ISSUE_UPDATED, false); } // publish project component merged event if necessary if (!affectedIssues.isEmpty() && swapComponent != null) { eventPublisher.publish(new ProjectComponentMergedEvent(swapComponent, component)); } }
Collection<Long> issues = projectComponentManager.getIssueIdsWithComponent(component); return Response.ok(componentIssueCountsBeanFactory.createComponentBean( component, issues.size())).cacheControl(never()).build();