You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I've got this piece of code where I'm trying to update the due date field of an issue on IssueEvent
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
Long eventTypeId = issueEvent.getEventTypeId();
MutableIssue issue = (MutableIssue)issueEvent.getIssue();
GregorianCalendar calendar=new GregorianCalendar(2017,7,13,1,13,13);
issue.setDueDate(new Timestamp(calendar.getTimeInMillis()));
IssueService issueService=ComponentAccessor.getIssueService();
if(issueService!=null)
System.out.println("Issue service is not null");
User user=ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser();
if (user!=null)
System.out.println("The logged in user is "+user.getName());
IssueInputParameters inputParameters=issueService.newIssueInputParameters();
inputParameters.setRetainExistingValuesWhenParameterNotProvided(true);
IssueService.UpdateValidationResult validationResult=issueService.validateUpdate(user,issue.getId(),inputParameters);
issueService.update(user,validationResult);
System.out.println("Issue type:"+issue.getIssueTypeObject().getName());
}
For some reason, I get NoSuchMethod exception when execution reaches to the following line:
IssueService.UpdateValidationResult validationResult=issueService.validateUpdate(user,issue.getId(),inputParameters);
I've also tried to use IssueManager to update issue but I get the same exception for "IssueManager.updateIssue" method. What am I doing wrong?
Community moderators have prevented the ability to post new answers.
You are passing the wrong argument to valiDateUpdate. You should be passing an ApplicationUser object instead of the old User object. Try passing ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() instead.
But that validateUpdate method does not accept ApplicationUser argument, it accepts only User. And even if it accepted, what relation can it have to the NoSuchMethod exception?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From what I see, the method only accepts ApplicationUser. Hence the error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's pretty strange, then how can I compile and and upload it to the jira? The two system.out.prints print successfully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe you have a different version in your pom? Or your IDE playing with you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, Jobin, you are absolutely right. In the pom, it is
<jira.version>6.0.4</jira.version>.
In fact I downloaded the sample listener plugin from Bitbucket and tried to run it against 7.2.6 I did this because with my own plugin I was getting "Plugin not in valid state..." error. It seems the spring version needs to be set correctly. In the tutorial, for the spring-framework dependency, it says "use the version used by your UPM". Do you happen to know where I can see what spring-framework version the UPM uses, and where I can find that version. Thanks a lot ahead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.