@Override
public ServiceOutcome<IssueLinkType> updateIssueLinkType(ApplicationUser user, IssueLinkType linkType, String name, String outward, String inward)
{
final I18nHelper i18n = i18nFactory.getInstance(user);
if (!applicationProperties.getOption(APKeys.JIRA_OPTION_ISSUELINKING))
{
return ServiceOutcomeImpl.error(i18n.getText("admin.issuelinking.status", i18n.getText("admin.common.words.disabled")), ErrorCollection.Reason.NOT_FOUND);
}
if (!permissionManager.hasPermission(Permissions.ADMINISTER, user))
{
return ServiceOutcomeImpl.error(i18n.getText("admin.errors.linking.error.update.no.permission"), ErrorCollection.Reason.FORBIDDEN);
}
if (!Objects.equal(name, linkType.getName()) && !issueLinkTypeManager.getIssueLinkTypesByName(name).isEmpty())
{
return ServiceOutcomeImpl.error(i18n.getText("admin.errors.linking.error.create.duplicate"));
}
issueLinkTypeManager.updateIssueLinkType(linkType,
StringUtils.isEmpty(name) ? linkType.getName() : name,
StringUtils.isEmpty(outward) ? linkType.getOutward() : outward,
StringUtils.isEmpty(inward) ? linkType.getInward() : inward);
return ServiceOutcomeImpl.ok(linkType);
}
}