Tabnine Logo
IssueLinkManager
Code IndexAdd Tabnine to your IDE (free)

How to use
IssueLinkManager
in
com.atlassian.jira.issue.link

Best Java code snippets using com.atlassian.jira.issue.link.IssueLinkManager (Showing top 20 results out of 315)

origin: com.atlassian.jira/jira-core

@Override
public IssueLink getIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId)
{
  return issueLinkManager.getIssueLink(sourceId, destinationId, issueLinkTypeId);
}
origin: com.atlassian.cpji/cpji-jira-plugin

public boolean isIssueWithLinks() {
  final MutableIssue issue = getMutableIssue();
  if (issueLinkManager.isLinkingEnabled()) {
    //checking if there are any not-subtask issue links (inward or outward)
    return Iterables.any(issueLinkManager.getOutwardLinks(issue.getId()), IssueLinkCopier.isNotSubtaskIssueLink)
        || Iterables.any(issueLinkManager.getInwardLinks(issue.getId()), IssueLinkCopier.isNotSubtaskIssueLink)
        || !remoteIssueLinkManager.getRemoteIssueLinksForIssue(issue).isEmpty();
  }
  return false;
}
origin: com.atlassian.jira/jira-core

public LinkCollection getLinkCollection(final Issue issue, final ApplicationUser user)
{
  return issueLinkManager.getLinkCollection(issue, user);
}
origin: com.atlassian.jira/jira-core

  @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);
  }
}
origin: com.atlassian.jira/jira-core

/**
 * We index the links in 3 ways. First, we index just the link type, so queries can be done like see if something is
 * a duplicate of another issue. Second, we index the link type with a direction flag which enables queries of all
 * issues that are blockers of other issues. Third, we link the link type plus direction plus the OTHER issue id so
 * that we can do a search like "all cloners of this issue" (or all cloners of other issues!).
 *
 * @param doc the lucene document that should be modified by adding relevant fields to.
 * @param issue the issue that contains the data that will be indexed and which can be used to determine the
 * project/issue type context that will allow you to determine if we should add the value as searchable
 */
public void addIndex(Document doc, Issue issue)
{
  Long issueId = issue.getId();
  addFieldsToDoc(doc, issueLinkManager.getInwardLinks(issueId), IN);
  addFieldsToDoc(doc, issueLinkManager.getOutwardLinks(issueId), OUT);
}
origin: com.atlassian.jira/jira-core

@Override
public void createSubTaskIssueLink(Issue parentIssue, Issue subTaskIssue, ApplicationUser remoteUser) throws CreateException
{
  if (parentIssue == null)
  {
    throw new IllegalArgumentException("Parent Issue cannot be null.");
  }
  else if (subTaskIssue == null)
  {
    throw new IllegalArgumentException("Sub-Task Issue cannot be null.");
  }
  // Determine the next sequence of the issue
  final Collection subTaskIssueLinks = getSubTaskIssueLinks(parentIssue.getId());
  // Determine the sequence of the new sub-task link
  final long sequence = subTaskIssueLinks == null ? 0 : subTaskIssueLinks.size();
  issueLinkManager.createIssueLink(parentIssue.getId(), subTaskIssue.getId(), getSubTaskIssueLinkType().getId(), sequence, remoteUser);
}
origin: com.atlassian.jira/jira-core

if (!issueLinkManager.isLinkingEnabled())
origin: com.atlassian.jira/jira-rest-plugin

try
  issueLinkManager.createIssueLink(inwardIssue.getId(), outwardIssue.getId(), linkType.getId(), null, authContext.getUser());
  issueLinkId = issueLinkManager.getIssueLink(inwardIssue.getId(), outwardIssue.getId(), linkType.getId()).getId();
origin: com.atlassian.jira/jira-api

LinkCollection linkCollection = issueLinkManager.getLinkCollection(issue, authContext.getUser());
Set<IssueLinkType> linkTypes = linkCollection.getLinkTypes();
if (linkTypes != null)
        IssueLink issueLink = issueLinkManager.getIssueLink(issue.getId(), outwardIssue.getId(), issueLinkType.getId());
        linkBeans.add(buildLink(issueLinkType, outwardIssue, true, issueLink.getId().toString()));
        IssueLink issueLink = issueLinkManager.getIssueLink(inwardIssue.getId(), issue.getId(), issueLinkType.getId());
        linkBeans.add(buildLink(issueLinkType, inwardIssue, false, issueLink.getId().toString()));
origin: com.atlassian.jira/jira-core

@Override
public void delete(DeleteIssueLinkValidationResult validationResult)
{
  notNull("validationResult", validationResult);
  if (!validationResult.isValid())
  {
    throw new IllegalStateException("You cannot delete an issue link with an invalid validation result.");
  }
  final IssueLink issueLink = validationResult.getIssueLink();
  final Long sourceId = issueLink.getSourceObject().getId();
  final Long destinationId = issueLink.getDestinationObject().getId();
  final Long issueLinkTypeId = issueLink.getIssueLinkType().getId();
  issueLinkManager.removeIssueLink(issueLinkManager.getIssueLink(sourceId, destinationId, issueLinkTypeId),
                   validationResult.getUser());
}
origin: com.atlassian.jira/jira-core

/**
 * Removes the parent link and adds change item.
 *
 * @param context jira service context
 */
public void preStoreUpdates(JiraServiceContext context, IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue)
{
  Collection<IssueLink> inwardLinks = issueLinkManager.getInwardLinks(currentIssue.getId());
  for (final IssueLink issueLink : inwardLinks)
  {
    if (issueLink.getIssueLinkType().isSubTaskLinkType())
    {
      issueLinkManager.removeIssueLink(issueLink, context.getLoggedInUser());
    }
  }
  // need to reorder sequence.
  subTaskManager.resetSequences(currentIssue.getParentObject());
  final Issue parentIssue = currentIssue.getParentObject();
  changeHolder.addChangeItem(new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Parent", parentIssue.getId().toString(), parentIssue.getKey(), null, null));
}
origin: com.atlassian.jira/jira-core

private void removeLinkFromParent(final MutableIssue issue, final ApplicationUser applicationUser)
{
  if (issue.getParentId() != null)
  {
    List<IssueLink> parentLinks = issueLinkManager.getOutwardLinks(issue.getParentId());
    parentLinks.stream().filter(link -> link.getIssueLinkType().isSubTaskLinkType() && link.getDestinationId().equals(issue.getId())).forEach(
        link -> issueLinkManager.removeIssueLink(link, applicationUser)
    );
  }
}
origin: com.atlassian.jira/jira-core

    issueLinkManager.getLinkCollectionOverrideSecurity(issue)
    : issueLinkManager.getLinkCollection(issue, searcher);
linkCollections.add(collection);
origin: com.atlassian.jira/jira-core

@Override
public List<IssueLink> getSubTaskIssueLinks(final Long issueId)
{
  List<IssueLink> subTasks = new ArrayList<IssueLink>();
  for (IssueLink link : issueLinkManager.getOutwardLinks(issueId))
  {
    if (link.getIssueLinkType().isSubTaskLinkType())
    {
      subTasks.add(link);
    }
  }
  // Sort the sub-task issue links on sequence
  Collections.sort(subTasks, new SequenceIssueLinkComparator());
  return subTasks;
}
origin: com.atlassian.jira/jira-core

@Override
@Nullable
public Long getParentIssueId(Long issueId)
{
  if (issueId == null) return null;
  // Check if we have any incoming sub-task issue links
  final List<IssueLink> inwardLinks = issueLinkManager.getInwardLinks(issueId);
  for (final IssueLink inwardLink : inwardLinks)
  {
    if (inwardLink.getIssueLinkType().isSubTaskLinkType())
    {
      return inwardLink.getSourceId();
    }
  }
  return null;
}
origin: com.atlassian.cpji/cpji-jira-plugin

@Override
public Either<NegativeResponseStatus, SuccessfulResponse> copyLocalIssueLink(Issue localIssue, String remoteIssueKey, Long remoteIssueId, SimplifiedIssueLinkType issueLinkType, LinkCreationDirection localDirection, LinkCreationDirection remoteDirection) {
  try {
    //In contrary to remote links, local are always created in both directions so is is not possible to create only one-way local link.
    //So here we care only local direction (ie creating link from source issue)
    if (localDirection == LinkCreationDirection.OUTWARD) {
      issueLinkManager.createIssueLink(localIssue.getId(), remoteIssueId, issueLinkType.getId(), null, jiraAuthenticationContext.getLoggedInUser());
    } else if (localDirection == LinkCreationDirection.INWARD) {
      issueLinkManager.createIssueLink(remoteIssueId, localIssue.getId(), issueLinkType.getId(), null, jiraAuthenticationContext.getLoggedInUser());
    }
    return SuccessfulResponse.buildEither(jiraLocation);
  } catch (CreateException e) {
    return Either.left(NegativeResponseStatus.errorOccured(jiraLocation, e.getMessage()));
  }
}
origin: com.atlassian.jira/jira-core

private void validateLinkingEnabled(final I18nHelper i18n, final ErrorCollection errors)
{
  if (!issueLinkManager.isLinkingEnabled())
  {
    errors.addErrorMessage(i18n.getText("admin.issuelinking.status", i18n.getText("admin.common.words.disabled")), Reason.FORBIDDEN);
  }
}
origin: com.atlassian.jira/jira-core

private boolean givenIssueHasAnyCopyableLink(Issue issue)
{
  Collection<IssueLink> inwardLinks = issueLinkManager.getInwardLinks(issue.getId());
  if (hasAnyCopyableLinkInGivenLinks(inwardLinks))
  {
    return true;
  }
  Collection<IssueLink> outwardLinks = issueLinkManager.getOutwardLinks(issue.getId());
  if (hasAnyCopyableLinkInGivenLinks(outwardLinks))
  {
    return true;
  }
  return false;
}
origin: com.atlassian.jira/jira-core

Collection<IssueLink> inwardLinks = issueLinkManager.getInwardLinks(subTask.getId());
for (final IssueLink issueLink : inwardLinks)
    issueLinkManager.removeIssueLink(issueLink, currentUser);
origin: com.atlassian.jira/jira-core

  public void addIndex(Document doc, Issue issue)
  {
    // This accesses the link manager directly (instead of issue.getSubtasks()) so that we only pull out the ids.
    // This has a performance improvement
    final List<IssueLink> outwardLinks = issueLinkManager.getOutwardLinks(issue.getId());

    for (final IssueLink outwardLink : outwardLinks)
    {
      if (outwardLink.getIssueLinkType().isSubTaskLinkType())
      {
        doc.add(new Field(getDocumentFieldId(), outwardLink.getDestinationId().toString(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
      }
    }
  }
}
com.atlassian.jira.issue.linkIssueLinkManager

Javadoc

The implementations of this class are used to manage IssueLinkType and IssueLink.

Most used methods

  • createIssueLink
    Constructs a new issuelink from the sourceIssueId to the destinationId and persists it. This operati
  • getIssueLink
    Retrieves an issue link given a source, destination and a link type.
  • isLinkingEnabled
    Returns whether Issue Linking is currently enabled in JIRA. Issue Linking can be enabled or disabled
  • getInwardLinks
    Get links to an issue.
  • getLinkCollection
    Constructs a LinkCollection for a given issue.
  • getOutwardLinks
    Get links from an issue.
  • changeIssueLinkType
    Changes the type of an issue link.NOTE: It is not possible to convert a system link type to a non-sy
  • clearCache
    Clears the Issue Link cache used by the Issue Link Manager.
  • getIssueLinks
    Returns a collection of all IssueLinks for a particular issue link type
  • getLinkCollectionOverrideSecurity
    Constructs a LinkCollection for a given issue, ignoring security.
  • moveIssueLink
    Moves an issue link to a different position in the list of issuelink.NOTE: This is currently only us
  • removeIssueLink
    Removes a single issue link We do not check for permission here. It should be done before this metho
  • moveIssueLink,
  • removeIssueLink,
  • removeIssueLinksNoChangeItems,
  • resetSequences

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now