How to make a simple webwork action class?

Hello,

I’m trying to make a custom dialog that opens on a webitem click.

This is the relevant part in my atlassian-plugin.xml:

	<web-resource key="issue-dialog-resources" name="DataGalaxy Issue Dialog Resources">
		<resource type="download" name="issue_dialog.js" location="/js/issue_dialog.js" />
		<context>atl.general</context>
	</web-resource>

	<webwork1 key="dg-issue-button-action" name="Link DG Objects" class="java.lang.Object">
		<actions>
			<action name="com.datagalaxy.app.webwork.LinkObjects" alias="LinkObjects">
				<view name="input">/templates/issue_dialog.vm</view>
			</action>
		</actions>
	</webwork1>

	<web-section key="dg-issue-button-section" location="opsbar-operations" weight="900">
		<label key="datagalaxy.issue.section.label" />
	</web-section>

	<web-item key="dg-issue-button" section="dg-issue-button-section" weight="10">
		<label key="datagalaxy.issue.button.label" />
		<tooltip key="datagalaxy.issue.button.tooltip" />
		<link linkId="dg-issue-dialog-link">/secure/LinkObjects!default.jspa?id=${issue.id}</link>
		<styleClass>trigger-dialog</styleClass>
	</web-item>

And there is my action class:

package com.datagalaxy.app.webwork;

import com.atlassian.jira.web.action.issue.AbstractIssueSelectAction;

public class LinkObjects extends AbstractIssueSelectAction
{
	public LinkObjects()
	{
	}
}

However, this is what maven tells me:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/bazin_q/rendu/Work/DataGalaxy/src/main/java/com/datagalaxy/app/webwork/LinkObjects.java:[5,43] cannot find symbol
  symbol:   class AbstractIssueSelectAction
  location: package com.atlassian.jira.web.action.issue
[ERROR] /home/bazin_q/rendu/Work/DataGalaxy/src/main/java/com/datagalaxy/app/webwork/LinkObjects.java:[11,34] cannot find symbol
  symbol: class AbstractIssueSelectAction
[INFO] 2 errors

I don’t really understand this error since this class is used everywhere, so I checked into jira-api.jar:

com/atlassian/jira/web/action/issue/bulkedit/WorkflowTransitionKey.class
com/atlassian/jira/web/action/issue/IssueSearchLimits.class
com/atlassian/jira/web/action/issue/SearchResultsInfo.class
com/atlassian/jira/web/action/issue/TemporaryAttachmentsMonitor$1.class
com/atlassian/jira/web/action/issue/TemporaryAttachmentsMonitor.class
com/atlassian/jira/web/action/issue/IssueCreationHelperBean.class
com/atlassian/jira/web/action/issue/IssueNavigatorSearchResultsHelper.class

As expected, there isn’t a class named “AbstractIssueSelectAction”.

Is the documentation deprecated?
Could you please give me an example on how to make a simple webwork action class?

Thanks in advance,
Quentin Bazin

Hello,
For a simple Jira webwork action you should extend JiraWebActionSupport.
This class extends webwork.action.ActionSupport with a lot of Jira specific functionality.

Could you point to the documentation using AbstractIssueSelectAction?
Let me know if it helps,
Best regards

Hello @tjoy,

Thanks for your quick answer.

It works with JiraWebActionSupport, but how am I supposed to access the current issue then?
I’m a bit lost and the documentation doesn’t make things easier.

I found AbstractIssueSelectionAction here: https://developer.atlassian.com/server/jira/platform/displaying-content-in-a-dialog-in-jira/

It seemed deprecated but this the only resource I found about displaying a dialog in Jira, and I got there from this page: https://developer.atlassian.com/server/jira/platform/tutorials_and_guides/

Thanks in advance

Hi,
I’m not sure what you’re trying to achieve.

If you define an id property with getter and setter in the webwork action it’ll be automatically populated with the value of query string ?id=${issue.id} when the action is invoked.

Then you can use Java API such as IssueService (injected into the action) to access the issue object by id.
You can use it to render content in issue_dialog.vm and it should be displayed as a dialog due to trigger-dialog class of the link

Hi,

I’ve made another topic here: Displaying a custom dialog in Jira

This new topic explains what I’m trying to achieve, and how I tried (without success) to do it.

Maybe the webwork isn’t the best way to do what I want, I don’t know.

Thanks,
Quentin Bazin