My colleague wanted to set description of issue. He tried this way . But he said it did not work.
public static void setDescription(Issue issue, String message) {
ComponentAccessor.getIssueManager().getIssueObject(issue.getId()).setDescription(message);
}
He argued to do it that way because not every issue may be a MutableIssue. That's why he did not want to do :
((MutableIssue)issue).setDescription(message);
But I said every issue you get from Jira will be mutable, because every issue has fields you can edit. But that is only my opinion.
Your colleague does not understand the internals of Jira. An issue object is a representation of the current issue, it is not an editable issue object like the mutableissue is.
You probably shouldn't be trying to set the description this way either, there's several things your code needs to do to the issue alongside setting a field. It's better to use the issueService to do it, as it'll handle all of it for you and trap and return errors properly.
Originally it is a issue of type DocumentIssueImpl .
That means it is not a MutuableIssue.
To set the description I now tried:
ApplicationUser user = ComponentAccessor.getUserManager().getUserByName("Admin");
IssueService.IssueResult issue1 = ComponentAccessor.getIssueService().getIssue(user, issue.getId());
issue1.getIssue().setDescription("Some description");
But again it was not working !
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.