i am writting an Groovy Script for post function, My question is: I have created a issue link, now on certian transition i want that link to get De-Link, So for it My approach is to grab that issue link and then do the de-link for both the issues. But i don't know how to grab the Issue Link ID.
Can any of thee geniouses out there can help me out?
to get the issue link id's bi-directionally as follows
to get OUward links
List<IssueLink> allOutIssueLink = issueLinkManager.getOutwardLinks(sourceIssue.getId()); for (Iterator<IssueLink> outIterator = allOutIssueLink.iterator(); outIterator.hasNext();) { IssueLink issueLink = (IssueLink) outIterator.next(); System.out.println(issueLink.getIssueLinkType().getId()); }
same way to get inword issueLink's
List<IssueLink> allInIssueLink = issueLinkManager.getInwardLinks(sourceIssue.getId()); for (Iterator<IssueLink> inIterator = allInIssueLink.iterator(); inIterator.hasNext();) { IssueLink issueLink = (IssueLink) inIterator.next(); System.out.println(issueLink.getIssueLinkType().getId());
if (issueLink.getIssueLinkType().getId() == 10) {
Issue destinationIssue = issueLink.getDestinationObject();
}
}
I have tried using Inward issue, I am getting the Inward issue name and ID but i want an issue which is linked to it, So any thoughts on it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to use following code to get linked issues
Issue issue=issueLink.getDestinationObject();
check my answer i have update the inword issuelink code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have already given code to delink right?
issueLink = issueLinkManager.getIssueLink(sourceId, destId, linkType); issueLinkManager.removeIssueLink(issueLink , remoteuser);
is it not worked?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rambanam: Yes, I know and have implemented it and its working perfectly fine, since i have used Customfield plugin on 1 issue type through whcih i used to gather that custom field and make it as mutable issue and perform operations, But this plugin was implemented only on 1 issue type but i am trying to write a groovy script for other issue type, such that Bi-Directional functionality works,
So now since i have created a links between 2 issues, I want to grab issue link ID and then perform operations like setting Status and delinking.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So my motive is:
1) Gather the linked issue
2) Gather the current status of the issue
3) Look about the other linked status of the issue
4) Replace the issue's status from the current to the newest status (that you are looking to place)
5) update the issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you are asking about delink or move status?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to use the inward link but still its giving me the link name and ID of itself,
my code goes like this:
log.warn("Current Issue is : " + issue)
List<IssueLink> allInIssueLink = linkManager.getInwardLinks(issue.getId());
for (Iterator<IssueLink> inIterator = allInIssueLink.iterator(); inIterator.hasNext();) {
IssueLink issueLink = (IssueLink) inIterator.next();
log.warn("Issue Link Type is : " +issueLink.getIssueLinkType().getId());
log.warn("Issue Link Name : " + issueLink.getIssueLinkType().getName())
Issue issue1= issueLink.getDestinationObject()
}
Collection<IssueLinkType> issueLinkTypes = ((IssueLinkTypeManager) ComponentManager
.getComponentInstanceOfType(IssueLinkTypeManager.class)).getIssueLinkTypes();
String linkID=null;
for (IssueLinkType linktype : issueLinkTypes) {
String name=linktype.getName();
if(name.equals("Open Position - Candidate Ticket")){
linkID=linktype.getId();
break;
}
}
}
OpenPositionFinalVersion(issue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you print issue1 object?
try somethink like this
List<IssueLink> allInIssueLink = linkManager.getInwardLinks(issue.getId()); for (Iterator<IssueLink> inIterator = allInIssueLink.iterator(); inIterator.hasNext();) { IssueLink issueLink = (IssueLink) inIterator.next(); log.warn("Issue Link Type is : " +issueLink.getIssueLinkType().getId()); log.warn("Issue Link Name : " + issueLink.getIssueLinkType().getName()); Issue issue1= issueLink.getDestinationObject(); log.warn("issue1 : " + issue1); if(issue1!=null){ log.warn("issue1 Key: " + issue1.getKey()); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.