@Override public Collection<IssueLinkType> getIssueLinkTypes() { return issueLinkTypeManager.getIssueLinkTypes(); }
private IssueLinkType getIssueLinkTypeByName(final String linkTypeName) { final Collection linkTypes = issueLinkTypeManager.getIssueLinkTypesByName(linkTypeName); if (linkTypes.isEmpty()) { return null; } // Return the first one - there should never be more than one. return (IssueLinkType) linkTypes.iterator().next(); } }
public IssueLinkType getLinkType() { if (linkType == null) { linkType = issueLinkTypeManager.getIssueLinkType(id); } return linkType; }
/** * @param linkDescArg the string which represents either the inward or outward description for a link type * @return the matching IssueLinkTypes found or null, but never empty */ Map<Direction, Collection<IssueLinkType>> getIssueLinkTypesForArg(final String linkDescArg) { final Map<Direction, Collection<IssueLinkType>> result = new HashMap<Direction, Collection<IssueLinkType>>(); final Collection<IssueLinkType> inwardLinkTypes = issueLinkTypeManager.getIssueLinkTypesByInwardDescription(linkDescArg); if (!inwardLinkTypes.isEmpty()) { result.put(Direction.IN, inwardLinkTypes); } final Collection<IssueLinkType> outwardLinkTypes = issueLinkTypeManager.getIssueLinkTypesByOutwardDescription(linkDescArg); if (!outwardLinkTypes.isEmpty()) { result.put(Direction.OUT, outwardLinkTypes); } return result.isEmpty() ? null : result; }
@Override public ServiceOutcome<IssueLinkType> createIssueLinkType(ApplicationUser user, 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.create.no.permission"), ErrorCollection.Reason.FORBIDDEN); } if (!issueLinkTypeManager.getIssueLinkTypesByName(name).isEmpty()) { return ServiceOutcomeImpl.error(i18n.getText("admin.errors.linking.error.create.duplicate")); } // User created link types always have a "style" of null. I don't know what "style" means. issueLinkTypeManager.createIssueLinkType(name, outward, inward, null); Collection<IssueLinkType> issueLinkTypesByName = issueLinkTypeManager.getIssueLinkTypesByName(name); if (issueLinkTypesByName.size() != 1) { return ServiceOutcomeImpl.error(i18n.getText("admin.errors.linking.error.create.failed.mysteriously"), ErrorCollection.Reason.SERVER_ERROR); } else { return ServiceOutcomeImpl.ok(issueLinkTypesByName.iterator().next()); } }
@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); } // Trying to give this link type the same name as an existing link type is not allowed. 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); } }
IssueLinkType issueLinkType = issueLinkTypeManager.getIssueLinkType(Long.parseLong(linkTypeBean.id())); if (issueLinkType == null) Collection<IssueLinkType> linkTypes = issueLinkTypeManager.getIssueLinkTypesByName(linkTypeBean.name()); if (linkTypes == null || linkTypes.isEmpty())
@Override public void enableSubTasks(boolean createDefaultIfMissing) throws CreateException { // Check that the sub-task issue link does not exist final Collection subTaskIssueLinks = getSubTaskIssueLinkTypes(); if (subTaskIssueLinks == null || subTaskIssueLinks.isEmpty()) { // Create default sub-task issue link issueLinkTypeManager.createIssueLinkType(SUB_TASK_LINK_TYPE_NAME, SUB_TASK_LINK_TYPE_OUTWARD_NAME, SUB_TASK_LINK_TYPE_INWARD_NAME, SUB_TASK_LINK_TYPE_STYLE); } // Check if sub-task already exists if (createDefaultIfMissing) { final Collection<IssueType> subTaskIssueTypes = constantsManager.getSubTaskIssueTypeObjects(); if (subTaskIssueTypes == null || subTaskIssueTypes.isEmpty()) { // If not, create default sub-task issue type insertSubTaskIssueType(DEFAULT_SUB_TASK_ISSUE_TYPE_NAME, DEFAULT_SUB_TASK_ISSUE_TYPE_SEQUENCE, DEFAULT_SUB_TASK_ISSUE_TYPE_DESCRIPTION, DEFAULT_SUB_TASK_ISSUE_TYPE_ICON_URL); } } // Update the application property applicationProperties.setOption(APKeys.JIRA_OPTION_ALLOWSUBTASKS, true); }
private Collection getSubTaskIssueLinkTypes() { return issueLinkTypeManager.getIssueLinkTypesByStyle(SUB_TASK_LINK_TYPE_STYLE); }
@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); } }
@RequiresXsrfCheck protected String doExecute() throws Exception { issueLinkTypeManager.updateIssueLinkType(getIssueLinkType(), getName(), getOutward(), getInward()); if (getHasErrorMessages()) return ERROR; else return getRedirect("ViewLinkTypes!default.jspa"); }
@RequiresXsrfCheck protected String doExecute() throws Exception { if (name != null) { // User defined links do not have a style, so set style to null issueLinkTypeManager.createIssueLinkType(getName(), getOutward(), getInward(), null); refreshState(); } return getResult(); }
/** * Get all the listeners in the system. * * @return A collection of GenericValues representing listeners */ public Collection getLinkTypes() { return issueLinkTypeManager.getIssueLinkTypes(); }
private IssueLinkType getIssueLinkTypeByName(final String linkTypeName) { final Collection linkTypes = issueLinkTypeManager.getIssueLinkTypesByName(linkTypeName); if (linkTypes.isEmpty()) { return null; } // Return the first one - there should never be more than one. return (IssueLinkType) linkTypes.iterator().next(); }
private boolean validateIssueLinkType(long linkTypeId) { return issueLinkTypeManager.getIssueLinkType(linkTypeId, false) != null; }
public boolean shouldDisplay(ApplicationUser user, JiraHelper jiraHelper) { final Collection<IssueLinkType> linkTypes = issueLinkTypeManager.getIssueLinkTypes(); return linkTypes != null && !linkTypes.isEmpty(); }
/** * Returns the issue link type specified by the clone link name in the properties file or null for none. * * @return the issue link type specified by the clone link name in the properties file or null for none. */ IssueLinkType getCloneIssueLinkType() { String cloneIssueLinkTypeName = getCloneIssueLinkTypeName(); if (cloneIssueLinkTypeName == null) return null; final Collection<IssueLinkType> cloneIssueLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName(cloneIssueLinkTypeName); if (cloneIssueLinkTypes.isEmpty()) { return null; } else { return cloneIssueLinkTypes.iterator().next(); } }
private IssueLinkType getIssueLinkType() { if (linkType == null) { linkType = issueLinkTypeManager.getIssueLinkType(id); } return linkType; }
public Collection getOtherLinkTypes() { Collection<IssueLinkType> otherTypes = newArrayList(); Collection<IssueLinkType> linkTypes = issueLinkTypeManager.getIssueLinkTypes(); for (IssueLinkType linkType : linkTypes) { if (!linkType.equals(getLinkType())) { otherTypes.add(linkType); } } return otherTypes; } }
/** * Check if IssueLinkType name already exists - if so, get id from this IssueTypeLink name to ensure that selected * IssueLinkType name is being edited. This addresses the situation where an IssueLinkType is renamed to conflict * with a pre-existing IssueLinkType. */ private boolean duplicateLinkName() { // Obtain all existing IssueLinkTypes Collection<IssueLinkType> existingIssueLinkTypes = issueLinkTypeManager.getIssueLinkTypesByName(getName()); if (existingIssueLinkTypes != null) { for (final IssueLinkType issueLinkType : existingIssueLinkTypes) { if (!id.equals(issueLinkType.getId())) { return true; } } } return false; }