@Override public void moveUnreleasedToNewVersion(@Nullable ApplicationUser directoryUser, @Nonnull Version currentVersion, @Nonnull Version newVersion) { final List<Issue> issues = getUnresolvedIssues(directoryUser, currentVersion); if (!issues.isEmpty()) { for (final Issue issue : issues) { // Need to look this up from the DB since we have DocumentIssues from the search. final MutableIssue mutableIssue = issueManager.getIssueObject(issue.getId()); final Collection<Version> versions = mutableIssue.getFixVersions(); versions.remove(currentVersion); versions.add(newVersion); mutableIssue.setFixVersions(versions); issueManager.updateIssue(directoryUser, mutableIssue, EventDispatchOption.ISSUE_UPDATED, true); } } }
/** * @return true if there were any issues affected */ private boolean swapOrRemoveVersionsFromIssues(final ApplicationUser user, final Version version, final Option<Version> affectsSwapVersion, final Option<Version> fixSwapVersion) { final Set<Long> issuesIds = getAllAssociatedIssueIds(version); // swap the versions on the affected issues for (final Long issueId : issuesIds) { final MutableIssue newIssue = issueManager.getIssueObject(issueId); newIssue.setAffectedVersions(getNewVersions(version, newIssue.getAffectedVersions(), affectsSwapVersion)); newIssue.setFixVersions(getNewVersions(version, newIssue.getFixVersions(), fixSwapVersion)); final Issue updated = issueManager.updateIssue(user, newIssue, UpdateIssueRequest.builder(). eventDispatchOption(EventDispatchOption.ISSUE_UPDATED). sendMail(false).build()); try { // reindex all the affected issues issueIndexManager.reIndex(updated); } catch (final IndexException e) { log.warn("Could not reindex issue with id '" + issueId + "' after swapping versions", e); } } return issuesIds.size() > 0; }
Collection<Version> fixVersions = issueToCopy.getFixVersions(); List<VersionBean> fixVersionsBean = new ArrayList<VersionBean>(); for (Version fixVersion : fixVersions) {