private boolean swapOrRemoveVersionsFromIssues(final ApplicationUser user, final Version version, final Option<Version> affectsSwapVersion, final Option<Version> fixSwapVersion)
{
final Set<Long> issuesIds = getAllAssociatedIssueIds(version);
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
{
issueIndexManager.reIndex(updated);
}
catch (final IndexException e)
{
log.warn("Could not reindex issue with id '" + issueId + "' after swapping versions", e);
}
}
return issuesIds.size() > 0;
}