Wrote a plugin to auto create several tasks linked to an Epic. Now trying to assign these created tasks to the Epic (I also link them but assigning them to the Epic makes it easier to use). I can see the "Epic Link" and "Epic Name" custom field values and noticed that Greenhopper is using IssueImp for the Epic Link custom field: XX-1234 (toString) class com.atlassian.jira.issue.IssueImpl (getCLass.toString)
I am using IssueInputParameters to create my tasks. Just using addCustomFieldValue on "Epic Link" to add the Epic Issue (Issue class) to indicate that these created tasks are in the Epic does not work. Using a MutableIssue of the Issue as data to store does not work either: error: no suitable method found for addCustomFieldValue(String, MutableIssue / Issue / Object
What is the right way to store a complex object like IssueImp or Issue as a custom field? I personally would store a key as link in a custom field but because this needs to work with Greenhopper I need to store it in the same format so I can't change that approach. Thanks!
Edit:
Examples were asked:
IssueInputParameters issueIP = this.issueService.newIssueInputParameters();
issueIP.setProjectId(projectID);
......
issueIP.setFixVersionIds(fixVersionId);
issueIP.setApplyDefaultValuesWhenParameterNotProvided(true);
issueIP.addCustomFieldValue("Epic Link", (Object) issueManager.getIssueObject("XX-1234"));
IssueService.CreateValidationResult issueinput = issueService.validateCreate(user, issueIP);
Compile error:
error: no suitable method found for addCustomFieldValue(String,Object)
Trying Issue:
issueIP.addCustomFieldValue("Epic Link", Issue);
will result in
error: no suitable method found for addCustomFieldValue(String,Issue)
Similar for MutableIssue
The epic link is not an issueimpl.
You can use EpicLinkManager.associateIssuesWithEpic( <epic>, <list of issues> ) to associate the issue with the Epic.
Thanks Nic! I was looking for storing more Objects than just the example for Epic above but I would definitely prefer to use that API for the Epic linking. I am surprised you mentioned that it is not a IssueImp as thats what I got back from a getClass.toString().
Any advice you can give in regards to storing any other complex objects or is the addCustomField pretty much only accepting String input?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Most custom fields need objects that represent their content. For numbers, that's easy - int, long and doubles can all go in. Text fields expect strings, dates expect Timestamps, and so-on. The Jira specific types are ones like users and "options" (for most fields that are selects or radio or checkmarks). Field with multiple values need arrays of those objects. So a select list expects one option, and a multi-select expects an array of options
Although I have a nagging doubt that some of them changed slightly recently - select lists may be expecting singleton objects containing one option. I need to dig that code out...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Nic, that explains a lot and will help with my other items for the auto created tasks!
Concerning greenhopper, I can add jira-greenhopper-plugin to my pom.xml however com.atlassian.greenhopper.manager is not in that jar and cannot be imported 5.6.2 from https://maven.atlassian.com/repository/public/greenhopper/jira-greenhopper-plugin/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The greenhopper stuff is really very old, and you should be importing Jira Software stuff really (Although it's not been refactored in full, so there are references to GH and Agile in it still)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I cannot find the EpicLinkManager in any other package, am I missing an obvious newer version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Never mind, copy paste mistake:
<dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>6.7.4</version>
<scope>provided</scope>
</dependency>
took care of it
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have been trying to complete this call but I have reached a dead end. I am unable to inject the EpicLinkManager or the EpicLinkManagerImpl class. At this point I simply create a EpicLinkManagerImpl and then call a getEpic of that new class. That crashes though even if the issue has an epic link:
[INFO] [talledLocalContainer] 2017-11-29 18:59:51,763 http-nio-2990-exec-3 ERROR [o.a.c.c.C.[.[localhost].[/jira].[action]] Servlet.service() for servlet [action] in context with path [/jira] threw exception [java.lang.NullPointerException] with root cause
[INFO] [talledLocalContainer] java.lang.NullPointerException
[INFO] [talledLocalContainer] at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpicLinkType(EpicLinkManagerImpl.java:484)
[INFO] [talledLocalContainer] at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpic(EpicLinkManagerImpl.java:79)
What am I doing wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If you provided a script which does not work, it would be simpler to answer and if the script was straight to the point, it would be even simpler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just added the snippets in question, with a very straight to the point code sample
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
issueIP.addCustomFieldValue("Epic Link", issueManager.getIssueObject("XX-1234").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.