Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

RemoteIssueLinkCreateEvent doesn't have id when custom jira listener catches it Edited

Hi Community,

Could you please help with issue below? Did you face this problem?

Now we are implementing custom listener for our system, listener must catch moments when user create/delete remote issue links on local server and noticed that object of RemoteIssueLinkCreateEvent doesn't have id when listener catches it. We suppose this is a bug, but we didn't find bug ticket for this.

Also we noticed that jira has another such event RemoteIssueLinkUICreateEvent and it's working well, because RemoteIssueLinkCreateEvent has id and we can work with this. But we cannot use it because it works just in case user creates remote link by jira UI, so such way cannot catch moment when user creates remote links by rest api http://localhost:8080/rest/api/latest/issue/TEST-1018/remotelink .

We use JIRA server with version: 8.2.1

Below you can find an example how we test of catching such events:

public class RemoteIssueLinksListener extends AbstractIssueEventListener
{

private final RemoteIssueLinkManager remoteIssueLinkManager;

public RemoteIssueLinksListener(RemoteIssueLinkManager remoteIssueLinkManager, JiraAuthenticationContext jiraAuthenticationContext)
{
this.remoteIssueLinkManager = remoteIssueLinkManager;
this.jiraAuthenticationContext = jiraAuthenticationContext;
}

@EventListener
public void onCreateRemoteIssueLinkEvent(RemoteIssueLinkCreateEvent remoteIssueLinkCreateEvent)
{
LOG.error("Create - TEST");
LOG.error("Create -: "+ remoteIssueLinkCreateEvent.getRemoteIssueLinkId());
LOG.error("Create -: "+ remoteIssueLinkCreateEvent.getGlobalId());

LOG.error("TEST: "+ (remoteIssueLinkManager == null));
Long id = remoteIssueLinkCreateEvent.getRemoteIssueLinkId();
LOG.error("id: "+ id);

RemoteIssueLink remoteIssueLink = remoteIssueLinkManager.getRemoteIssueLink(id);
LOG.error("Link: "+ (remoteIssueLink == null));
}

@EventListener
public void onCreateUiRemoteIssueLinkEvent(RemoteIssueLinkUICreateEvent remoteIssueLinkUiCreateEvent) {
LOG.error("Create UI - TEST");
LOG.error("Create UI -: "+ remoteIssueLinkUiCreateEvent.getRemoteIssueLinkId());
LOG.error("Create UI-: "+ remoteIssueLinkUiCreateEvent.getGlobalId());

LOG.error("TEST: UI"+ (remoteIssueLinkManager == null));
Long id = remoteIssueLinkUiCreateEvent.getRemoteIssueLinkId();
LOG.error("id: "+ id);

RemoteIssueLink remoteIssueLink = remoteIssueLinkManager.getRemoteIssueLink(id);
LOG.error("Link: "+ (remoteIssueLink == null));

}
}

4 answers

i'm too looking solve this problem....

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.link.RemoteIssueLinkCreateEvent
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.RemoteIssueLink
import com.atlassian.jira.issue.link.RemoteIssueLinkManager

if(event instanceof RemoteIssueLinkCreateEvent) {
RemoteIssueLinkManager rm = ComponentAccessor.getComponent(RemoteIssueLinkManager.class)
IssueManager im = ComponentAccessor.getIssueManager()

RemoteIssueLinkCreateEvent event = (RemoteIssueLinkCreateEvent) event

List<RemoteIssueLink> links = rm.findRemoteIssueLinksByGlobalIds([event.globalId])

for (RemoteIssueLink link : links) {
Issue issue = im.getIssueObject(557230)
log.error(issue.key)
}
}






Like that you get issue object

@Vladimir Kibe , Hi, we thought about the solution you have suggested, but we investigated this issue and got root cause of issue is a bug in DefaultRemoteIssueLinkManager in Jira sources (8,2.1) in function createRemoteIssueLink. 

...
eventPublisher
.publish(new RemoteIssueLinkCreateEvent(remoteIssueLink)) 
... 

 "remoteIssueLink" is temporary object that used for creating remote link in DB of Jira and it also doesn't contain id of remote link.

We got from Atlassian Support answer, that they don't support support such developing request from clients, so we was forced to fix bug ourself. Below you can find we fixed this issue in soruces

...
eventPublisher
.publish(new RemoteIssueLinkCreateEvent(created));
...

 "created" is object that was generated after creating new remote link in jira db.

Also if you like this fix and you have access to jira sources, you can find below article from Atlassian How to compile jira sources

https://developer.atlassian.com/server/jira/platform/building-jira-from-source/

Hi,

is there a "workaround" for web links also?

I understand Atlassian is not willing to fix https://jira.atlassian.com/browse/JRASERVER-45989. However, I would have to implement a listener that fires when an external web link is added to an issue. So I thought the "RemoteIssueLinkCreateEvent" would be the way to go - however, all the properties are empty/null:

[c.o.scriptrunner.runner.ScriptBindingsManager] <com.atlassian.jira.event.issue.link.RemoteIssueLinkCreateEvent@7591499 applicationType=null remoteIssueLinkId=null globalId=null>

I'm kind of stuck here... :-(

 

PS: sorry, obviously this is not an answer but I didn't want to start another topic for the same problem.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Jira issue check and more advanced commit verifications for Bitbucket DC

Pre-receive hooks that verify the Git commit message, the modified files, and implement similar code change controls used to be requirements of large enterprises working in regulated industries only....

31 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you