Hello, Community!
I’m working on an Jira DC/Server plugin for tracking user activity. I’m collecting data about some activities using com.atlassian.event.api.EventListener.
I’ve managed to collect data for some events, but I need Issue Viewed.
The listener for the IssueViewEvent doesn’t work and Atlassian doesn’t offer any documentation about it. This is my code:
@EventListener
public void onIssueViewEvent(IssueViewEvent viewEvent) {
String eventString = createEventString(
"IV",
viewEvent.getId(),
getCurrentUserId(),
viewEvent.getTime()
);
ao.setActivityData(eventString);
}
in com.atlassian.jira.event.issue.IssueEventListener api class i found these methods:
issueCreated, issueUpdated, issueAssigned, issueResolved, issueClosed,
issueCommented, issueReopened, issueDeleted, issueMoved, issueWorkLogged,
issueStarted, issueStopped, issueGenericEvent, workflowEvent and customEvent.
There is no issueRead event, and be careful counting reads, it may slow down the application.
One way to count issue reads is by implementing a filter-plugin
public class IssueReadCounterFilter extends AbstractHttpFilter
protected void doFilter(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain)
String uri = request.getRequestURI();
counter++;
chain.doFilter( request, response );
<servlet-filter name="IssueReadCounter" key="IssueReadCounter"
class="com.your-company.jira.IssueReadCounterFilter"
location="before-dispatch" weight="1"
>
<url-pattern>/browse/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</servlet-filter>
Hi, @VersicherungskammerB, danke for the reply! I actually managed to implement it by adding a script that sends a http request as a view on the issue, kind of like a webhook, but these approaches only work for the browse full screen view. Do you think its possible to detect opening an issue from the quick view?
try to expand the url-pattern parameter
<url-pattern>/browse/*</url-pattern>
<url-pattern>/projects/*/issues/*</url-pattern>