/** * @return the directional name. */ public String getLinkName() { return direction == Direction.OUT ? linkType.getOutward() : linkType.getInward(); }
@Override public boolean apply(IssueLinkType input) { Preconditions.checkNotNull(input); return issueLinkType.equals(input.getInward()) || issueLinkType.equals(input.getOutward()); } });
private IssueLinkType matchToIssueLinkType(String linkName) { Collection<IssueLinkType> linkTypes = issueLinkTypeManager.getIssueLinkTypes(); for (IssueLinkType linkType : linkTypes) { if (linkName.equals(linkType.getOutward()) || linkName.equals(linkType.getInward())) { return linkType; } } return null; } }
private IssueLinkType getIssueLinkType() { if (issueLinkType == null) { for (IssueLinkType linkType : issueLinkTypeManager.getIssueLinkTypes()) { if (linkDesc.equals(linkType.getOutward()) || linkDesc.equals(linkType.getInward())) { issueLinkType = linkType; break; } } } return issueLinkType; }
private IssueLinkType getIssueLinkType() { if (issueLinkType == null) { for (IssueLinkType linkType : issueLinkTypeManager.getIssueLinkTypes()) { if (linkDesc.equals(linkType.getOutward()) || linkDesc.equals(linkType.getInward())) { issueLinkType = linkType; break; } } } return issueLinkType; }
public SimplifiedIssueLinkType(IssueLinkType issueLinkType) { this.outward = issueLinkType.getOutward(); this.inward = issueLinkType.getInward(); this.id = issueLinkType.getId(); }
private String getReciprocalLinkDesc() { final IssueLinkType linkType = getIssueLinkType(); if (linkType == null) { return null; } if (linkDesc.equals(linkType.getOutward())) { return linkType.getInward(); } return linkType.getOutward(); }
@Override public boolean apply(IssueLink input) { Preconditions.checkNotNull(input); return !(issueLinkType.getInward().equals(input.getIssueLinkType().getInward()) && issueLinkType.getOutward().equals(input.getIssueLinkType().getOutward())); } };
linkTypeDesc.add(linkType.getInward());
ChangeItemBean getChangeItemBean(final String issueLinkTypeId, final String linkedIssueKey, final boolean isSource) { // Get the issue link for the type we are creating final IssueLinkType issueLinkType = issueLinkTypeManager.getIssueLinkType(new Long(issueLinkTypeId)); final ChangeItemBean changeItem; if (isSource) { changeItem = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", null, null, linkedIssueKey, "This issue " + issueLinkType.getOutward() + " " + linkedIssueKey); } else { changeItem = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", null, null, linkedIssueKey, "This issue " + issueLinkType.getInward() + " " + linkedIssueKey); } return changeItem; }
public static IssueLinkTypeJsonBean create(IssueLinkType issueLinkType, URI self) { return new IssueLinkTypeJsonBean(issueLinkType.getId(), issueLinkType.getName(), issueLinkType.getInward(), issueLinkType.getOutward(), self); }
public IssueLinkTypeJsonBean apply(@Nullable IssueLinkType from) { final URI uri = restUrlBuilder.getURI(restUrlBuilder.getUrlFor(contextUriInfo.getBaseUri(), IssueLinkTypeResource.class).getIssueLinkType(from.getId().toString())); return new IssueLinkTypeJsonBean(from.getId(), from.getName(), from.getInward(), from.getOutward(), uri); } });
public String getDirectionName() throws GenericEntityException { if (destId != null) { return getLink().getIssueLinkType().getOutward(); } else if (sourceId != null) { return getLink().getIssueLinkType().getInward(); } return null; }
@Override public AddIssueLinkValidationResult validateAddIssueLinks(ApplicationUser user, Issue issue, String linkName, Collection<String> linkKeys) { IssueLinkType linkType = matchToIssueLinkType(linkName); if (null == linkType) { ErrorCollection errors = new SimpleErrorCollection(); errors.addErrorMessage(beanFactory.getInstance(user).getText("issuelinking.service.error.invalid.link.name", linkName)); return new AddIssueLinkValidationResult(user, errors, null, null, null, null); } Direction direction = linkName.equals(linkType.getInward()) ? Direction.IN : Direction.OUT; return validateAddIssueLinks(user, issue, linkType, direction, linkKeys, true); }
public String doDefault() throws Exception { name = getIssueLinkType().getName(); outward = getIssueLinkType().getOutward(); inward = getIssueLinkType().getInward(); return super.doDefault(); }
@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); } }
paramsMap.put(ISSUE_LINKS, new String[] { TRUE.toString() }); paramsMap.put(PARAMS_ISCREATEISSUE, new String[] { FALSE.toString() }); paramsMap.put(PARAMS_LINK_TYPE, new String[] { outwardIssue != null ? linkType.getOutward() : linkType.getInward() }); paramsMap.put(PARAMS_ISSUE_KEYS, new String[] { outwardIssue != null ? outwardIssue.getKey() : inwardIssue.getKey() });
private void createCreateIssueLinkChangeItems(IssueLink issueLink, IssueLinkType issueLinkType, ApplicationUser remoteUser) { final Issue source = issueLink.getSourceObject(); final Issue destination = issueLink.getDestinationObject(); // Create change item for source issue ChangeItemBean cib = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", null, null, destination.getKey(), "This issue " + issueLinkType.getOutward() + " " + destination.getKey()); createChangeItem(source, cib, remoteUser); // Create change item for destination issue cib = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", null, null, source.getKey(), "This issue " + issueLinkType.getInward() + " " + source.getKey()); createChangeItem(destination, cib, remoteUser); }
private void createRemoveIssueLinkChangeItems(IssueLink issueLink, IssueLinkType issueLinkType, ApplicationUser remoteUser) { final Issue source = issueLink.getSourceObject(); final Issue destination = issueLink.getDestinationObject(); // Create change item for source issue ChangeItemBean cib = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", destination.getKey(), "This issue " + issueLinkType.getOutward() + " " + destination.getKey(), null, null); createChangeItem(source, cib, remoteUser); // Create change item for destination issue cib = new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Link", source.getKey(), "This issue " + issueLinkType.getInward() + " " + source.getKey(), null, null); createChangeItem(destination, cib, remoteUser); }