/** * Get an issue's subtasks. * * @return A collection of {@link Issue}s. */ @Override public Collection<Issue> getSubTaskObjects(Issue parentIssue) { Collection<Issue> subTaskIssues = new LinkedList<>(); for (final IssueLink issueLink : getSubTaskIssueLinks(parentIssue.getId())) { subTaskIssues.add(issueLink.getDestinationObject()); } return subTaskIssues; }
public Collection getSubTasks(GenericValue issue) { List<GenericValue> subTaskIssues = new LinkedList<GenericValue>(); for (IssueLink issueLink : subTaskManager.getSubTaskIssueLinks(issue.getLong("id"))) { subTaskIssues.add(issueLink.getDestinationObject().getGenericValue()); } return subTaskIssues; } }
protected void reindexLinkedIssues(IssueLink issueLink) { try { issueIndexManager.reIndex(issueLink.getSourceObject()); issueIndexManager.reIndex(issueLink.getDestinationObject()); } catch (IndexException e) { throw new RuntimeException(e); } }
protected void removeSubTasks(ApplicationUser user, Issue parentIssue, EventDispatchOption eventDispatchOption, boolean sendMail) throws RemoveException { for (IssueLink subTaskIssueLink : subTaskManager.getSubTaskIssueLinks(parentIssue.getId())) { Issue subTaskIssue = subTaskIssueLink.getDestinationObject(); log.debug("Deleting sub-task issue with key: " + subTaskIssue.getKey()); deleteIssue(user, subTaskIssue, eventDispatchOption, sendMail); log.debug("Deleted sub-task issue with key: " + subTaskIssue.getKey()); } }
public void copyLocalIssueLinks(final Issue localIssue, final String copiedIssueKey, final Long copiedIssueId) { //we throw out all subtask and cloner links before copying final Predicate<IssueLink> isNotSubtaskAndClonedLink = Predicates.and(isNotSubtaskIssueLink, isNotSpecifiedLinkType(clonerIssueLinkType)); final Iterable<IssueLink> inwardLinks = Iterables.filter(issueLinkManager.getInwardLinks(localIssue.getId()), isNotSubtaskAndClonedLink); for (final IssueLink inwardLink : inwardLinks) { final IssueLinkType type = inwardLink.getIssueLinkType(); remoteJira.copyLocalIssueLink(inwardLink.getSourceObject(), copiedIssueKey, copiedIssueId, type, JiraProxy.LinkCreationDirection.OUTWARD, JiraProxy.LinkCreationDirection.INWARD); } final Iterable<IssueLink> outwardLinks = Iterables.filter(issueLinkManager.getOutwardLinks(localIssue.getId()), isNotSubtaskAndClonedLink); for (final IssueLink outwardLink : outwardLinks) { final IssueLinkType type = outwardLink.getIssueLinkType(); remoteJira.copyLocalIssueLink(outwardLink.getDestinationObject(), copiedIssueKey, copiedIssueId, type, JiraProxy.LinkCreationDirection.INWARD, JiraProxy.LinkCreationDirection.OUTWARD); } } }
@Override public SubTaskBean getSubTaskBean(Issue issue, ApplicationUser remoteUser) { SubTaskBeanImpl subTaskBean = new SubTaskBeanImpl(); final Collection<IssueLink> subTaskIssueLinks = getSubTaskIssueLinks(issue.getId()); for (final IssueLink subTaskIssueLink : subTaskIssueLinks) { Issue subTaskIssue = subTaskIssueLink.getDestinationObject(); // Check that the remote user has the permissions to actually see the sub-task due to issue level security. // Even though we keep the issue security level the same on sub-tasks and parent issues // due to things like 'assignee' and 'reporter' permissions, it is possible to have // a situation where a user can see the parent issue but not its sub task, or vice versa if (permissionManager.hasPermission(Permissions.BROWSE, subTaskIssue, remoteUser)) { subTaskBean.addSubTask(subTaskIssueLink.getSequence(), subTaskIssue, issue); } } return subTaskBean; }
Issue linkedIssue = issueLink.getDestinationObject(); storeInLinkMap(outwardLinkMap, issueLinkType.getName(), linkedIssue);
@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()); }
Issue linkedIssue = issueLink.getDestinationObject(); storeInLinkMap(outwardLinkMap, issueLinkType.getName(), linkedIssue);
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); }