Hi All,
I am trying hard to find the all the issue link types first, so i am using a method but its noe working, so can anybody help me out with this.
//method
Collection<IssueLinkType> issueLinkTypes= issueLinkTypeManager.getIssueLinkTypesByName()
now here the String parameter i am passing is Relates to but its still not taking, So any suggestions
I am getting error as
"The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.link.DefaultIssueLinkManager."
you are trying to print object so it will show like that only
itreate the linktypess collection as
for (IssueLinkType linktype : issueLinkTypes) { String name=linktype.getName(); String id=linktype.getId(); }
Thanks , So my final code should be like this
Collection<IssueLinkType> issueLinkTypes1 = ((IssueLinkTypeManager) ComponentManager.getComponentInstanceOfType(IssueLinkTypeManager.class)).getIssueLinkType();
for (IssueLinkType linktype : issueLinkTypes) {
String name=linktype.getName();
String id=linktype.getId();
}
log.warn("Issue Link Types : " + IssueLinkType)
But when i check in log i am getting this output instead of names:
2013-07-25 14:00:10,988 http-8080-6 WARN addteq 840x26167x1 1dglm65 10.1.1.125 /secure/CommentAssignIssue.jspa [onresolve.jira.groovy.FinalTRMGroovy] Issue Link names : interface com.atlassian.jira.issue.link.IssueLinkType
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you want to print linktype name then use this
for (IssueLinkType linktype : issueLinkTypes) { String name=linktype.getName(); log.warn("Issue Link Type Name : " + name); String id=linktype.getId(); log.warn("Issue Link Type Id : " + id); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
cool.. Glad to hear it worked!!!
Cheers..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
one last thing Rambanam:
I have two Mutable issues namely:
a) issue
b) opt
now after executing above code now i want to create a link between these two issue types, So how can it be possible.
I have figured out this way,
linkManager.createIssueLink(issue.getId(),opt.getId(),issueLinkTypes.getAt(1),1,currentUser)
but this show incompatility issues.
Any comments?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use following code to get link types
Collection<IssueLinkType> issueLinkTypes = ((IssueLinkTypeManager) ComponentManager .getComponentInstanceOfType(IssueLinkTypeManager.class)).getIssueLinkTypes(); (or) Collection<IssueLinkType> issueLinkTypes=ComponentAccessor.getComponentOfType(IssueLinkTypeManager.class).getIssueLinkTypes();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but when i do log.warn, i am getting output at the log file as
Issue Link Types : [com.atlassian.jira.issue.link.IssueLinkTypeImpl@ffffffca, com.atlassian.jira.issue.link.IssueLinkTypeImpl@fffffe53, com.atlassian.jira.issue.link.IssueLinkTypeImpl@fe53fbd1]
So how can i get the name or ID?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam Prasad,
I went through almost so many of the Atlassian Answers, which talks about mainly on "clone an issue and create issue links" since from 2 days. But the code posted here to create issue link helped me so quickly to create the needed Issue links in my workflow. So Really thank you very much for this Answer posted here.
But one clarification needed, by using the above code it's establishing by default "clones" (i,e Outward Description) and but I would like to create a issue link type of "is cloned by" (i,e Inward Description). Please suggest how to do this.
I am using the below script posted to clone issues and create Issue links in my workflow post function.
Issue Links:
clones
INT-1744 CLONE - Testing Auto clone issue latest-clone with linking on 13th Jan ENGINEERING SUPPORT
INT-1745 CLONE - Testing Auto clone issue latest-clone with linking on 13th Jan ENGINEERING SUPPORT
selectedComponents?.each { LazyLoadedOption it -> def issueFactory = ComponentAccessor.getIssueFactory() def issueManager = ComponentAccessor.getIssueManager() def newIssue = issueFactory.cloneIssue(issue) newIssue.setSummary("CLONE - $issue.summary") newIssue.setProjectId(issue.projectId) newIssue.setDescription(issue.description) newIssue.setAssigneeId("Unassigned") Map<String,Object> newIssueParams = ["issue":newIssue] as Map<String,Object> issueManager.createIssueObject(currentUser, newIssueParams) IssueLinkManager linkManager = ComponentManager.getInstance().getIssueLinkManager() Collection<IssueLinkType> issueLinkTypes1=ComponentAccessor.getComponentOfType(IssueLinkTypeManager.class).getIssueLinkTypes(); String linkID=null; for (IssueLinkType linktype : issueLinkTypes1) { String name=linktype.getName(); log.warn("Issue Link Type Name : " + name); String id=linktype.getId(); log.warn("Issue Link Type Id : " + id); if(name.equals("Cloners")){// change link name here linkID=linktype.getId(); break; } }//for end log.warn("Issue Link Types : " + IssueLinkType) linkManager.createIssueLink(issue.getId(), newIssue.getId(), Long.parseLong(linkID),Long.valueOf(0), currentUser); }//each end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try with the following code
Collection<IssueLinkType> issueLinkTypes = ((IssueLinkTypeManager) ComponentManager .getComponentInstanceOfType(IssueLinkTypeManager.class)).getIssueLinkTypes(); String linkID=null; for (IssueLinkType linktype : issueLinkTypes) { String name=linktype.getName(); if(name.equals("Clone")){// change link name here linkID=linktype.getId(); break; } } linkManager.createIssueLink(issue.getId(), opt.getId(), Long.parseLong(linkID),Long.valueOf(0), currentUser);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And if i have to delink then i should use the delete option rgt?
Man you are genius, I got all the thinks in right shoes now. Many Many thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you want to remove use the following code
issueLink = issueLinkManager.getIssueLink(sourceId, destId, linkType); issueLinkManager.removeIssueLink(issueLink , remoteuser);
Thanks,
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.