@Override public void removeIssueLinkType(Long issueLinkTypeId, IssueLinkType swapLinkType, ApplicationUser remoteUser) { Collection<IssueLink> issueLinks = issueLinkManager.getIssueLinks(issueLinkTypeId); if (swapLinkType == null) { // We do not have a swap issue link type so just remove all the issue links for (final IssueLink issueLink : issueLinks) { // Remove the link of this type issueLinkManager.removeIssueLink(issueLink, remoteUser); } } else { // We were given another issue link type to move all the existing issue links to // So move the links before deleting the issue link type for (final IssueLink issueLink : issueLinks) { // Move all the link if the link type that we are about to delete to a different link type issueLinkManager.changeIssueLinkType(issueLink, swapLinkType, remoteUser); } } issueLinkTypeManager.removeIssueLinkType(issueLinkTypeId); } }