Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

When building java to configure a workflow function plugin how to get the step during input (not edit)

Jay Jay February 14, 2012

I am building an workflow function plugin and in the configuration of it I'd like to get the step or some handle to the workflow so I can display a list of valid transitions for the current step.

In the edit screen I can do this as I get an ActionDescriptor passed to my code, but in the input function getVelocityParamsForInput(Map velocityParams) I don't get any such information and can't figure out how to get a handle to the workflow that is being currently edited, or the step of the workflow which is being edited.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

It does not seem to be passed in. The only way I have been able to get it is like this:

HttpServletRequest httpServletRequest = ServletActionContext.getRequest();

velocityParams.put("workflowStep", httpServletRequest.getParameter("workflowStep"));
You also have the name, mode and transition, from that you can get a handle to workflow current step and work out the valid transitions.
Jay Jay February 14, 2012

Thanks, that sounds promising.

I can see webwork.ServletActionContext at compile time, but not at runtime. Maybe it is because I changed it while in the debugger? Should this class be on the runtime classpath if I build/install the plugin properly?

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

You get a class not found error at runtime? Try reploying your plugin and restarting jira.

> Should this class be on the runtime classpath if I build/install the plugin properly?

Far as I know, yes. Works for me...

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

You can get he workflow like this:

JiraWorkflow workflow = workflowManager.getWorkflow(issue);

And a step for a status like this:

StepDescriptor step = workflow.getLinkedStep(constantsManager().getStatus(status));

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

But you don't have any issue in the screen he's talking about, ie the one where you can set parameters for a workflow function. Unless I'm completely missing the point of the question.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

Ah I see!. getVelocityParamsForInput - I should have noticed!

TAGS
AUG Leaders

Atlassian Community Events