I'm new to JIRA, I'm having trouble creating a webwork action, could someone help me? I'm following the documentation but I still can not perform the action.
Have some video that talks about webwork action in JIRA?
Who can help, I will be very grateful.
att: Thiago Oliveira.
So, I'm studying the book (Packtpub JIRA Development Cookbook), I am following the steps as the tutorial explains but in the end nothing works. I am forwarding a PDF file so you can better understand my problem.
Thanks for the help.
Where exactly are you stuck? @mdoar has a good example here: https://bitbucket.org/mdoar/webwork-sample
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, I'm studying the book (Packtpub JIRA Development Cookbook), I am following the steps as explained, but in the end nothing works. I'm posting the PDF file at this link:
http://www.4shared.com/office/PkhcBjYI/jira_action_webwork.html?
So you will have a better view of my problem.
Thanks for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will have to explain it better. What is not working? What is the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Summarizing gives this error:
WebworkConfigurationNotFoundException{class=class webwork.config.XMLActionConfiguration, message='No such view mapping', name='DemoAction.actionInfo'}
Steps I did – 1ª part
1 - Insert these tags in my Atlassian-plugin.xml
<webwork1 key="demoaction" name="JTricks Demo Action" class="java.lang.Object">
<actions>
<action name="com.jtricks.DemoAction" alias="DemoAction">
<view name="input">/templates/input.vm</view>
<view name="success ">/templates/joy.vm</view>
<view name="error">/templates/tears.vm</view>
</action>
</actions>
</webwork1>
2 - Inside my package (com.jtricks.mypackage) I created a class called (DemoAction extends com.atlassian.jira.action.JiraActionSupport {).
I used this method (getLoggedInUser public User ()) because I'm giving the error when I extends Com.atlassian.jira.action.JiraActionSupport
3 - I created this tag (html) into Notepad:
Name: <input type="text" name="userName">
I saved with extension (input.vm).
saved in this directory.
C:\basis\demoplugin\target\jira\webapp\includes\jira\field\templates
with the extension (input.vm)
4 - Inside my class (DemoAction) created this variable: private String userName;
with setter method:
public void setUserName (String userName) {
this.userName = userName;
}
5 - Identify the parameter that needs to be printed in the output page. In our case, we
will print modifiedName in the output page.
I did so: private String modifiedName;
6 - Create getter methods for the parameters to be printed. Velocity or JSPs will invoke
the getter methods to retrieve the value from the Action class.
I did so: public String getModifiedName() {
return modifiedName;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
() The link I put in the previous answer describes every step by step. I made the pdf file for you to have a better view of the creation of action. to help me.
Apparently I do everything right, but when I write the URL: http://basis-pc:2990/jira/secure/DemoAction!default.jspa
gives this error:
WebworkConfigurationNotFoundException {class = class webwork.config.XMLActionConfiguration, message = 'No such view mapping', name = 'DemoAction.actionInfo'}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you are having trouble downloading the file from the link.
Give me your email, I will send you the file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Way I did:
Part 1º
1. Add the new webwork action module into your atlassian-plugin.xml. Let us say,
we add the same aforementioned snippet.
<webwork1 key="demoaction" name="JTricks Demo Action" class="java.
lang.Object">
<actions>
<action name="com.jtricks.DemoAction" alias="DemoAction">
<view name="input">/templates/input.vm</view>
<view name="success ">/templates/joy.vm</view>
<view name="error">/templates/tears.vm</view>
</action>
</actions>
</webwork1>
2. Create the action class DemoAction under the package com.jtricks. The class
must extend com.atlassian.jira.action.JiraActionSupport.
publicclass DemoAction extends com.atlassian.jira.action.JiraActionSupport{
privatestaticfinallongserialVersionUID = 1L; private String userName;
3. Identify the parameters that you need to receive from the user. Create private
variables for them with the name exactly similar to that of the related HTML tag.
In our example, we need to take a user input. Let us say, it is the name of the user.
The HTML code in the input view (in our case,/templates/input.vm) will be
as follows: Name: <input type="text" name="userName">
So, we need to create a String variable of the name userName in our action class.
I open Notepad, copied: Name: <input type="text" name="userName">
saved in this directory.
C:\basis\demoplugin\target\jira\webapp\includes\jira\field\templates
with the extension (input.vm)
4. Create setter methods for the variables that are used to get values from the
input view. In our example, we retrieve the userName from the input view and process it in the
action class. So we need to create a setter method for that which will look like this.
public void setUserName(String userName) { this.userName = userName;}
publicclass DemoAction extends com.atlassian.jira.action.JiraActionSupport{
privatestaticfinallongserialVersionUID = 1L; private String userName;
publicvoid setUserName(String userName) { this.userName = userName; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Part 2º
5. Identify the parameter that needs to be printed in the output page. In our case, we
will print modifiedName in the output page.
publicclass DemoAction extends com.atlassian.jira.action.JiraActionSupport{
privatestaticfinallongserialVersionUID = 1L;
private String modifiedName;
6. Create getter methods for the parameters to be printed. Velocity or JSPs will invoke
the getter methods to retrieve the value from the Action class. For our example,
we have a getter method for modifiedName, which looks as follows:
public String getModifiedName() {return modifiedName; }
publicclass DemoAction extends com.atlassian.jira.action.JiraActionSupport{
privatestaticfinallongserialVersionUID = 1L;
private String userName; private String modifiedName;
publicvoid setUserName(String userName) { this.userName = userName; }
public String getModifiedName(){ returnmodifiedName; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Parte 2 º
8.Create the Velocity template for the input view. The 'input' view, in our example, uses
the template: /templates/input.vm. Add the HTML code of the input text within a
form whose action invokes DemoAction:
<h2>My Input Form</h2><br><br>
<form method="POST" action="/secure/DemoAction.jspa">
Name: <input type="text" name="userName"><br>
<input type="submit">
</form>
I copied and pasted the same old file (Input.vm)
9. Create the success view to print the modifiedName in /templates/joy.vm: The
output: $modifiedName
I open Notepad, copied: The output: $modifiedName
saved in this directory.
C:\basis\demoplugin\target\jira\webapp\includes\jira\field\templates
with the extension (joy.vm)
10. Create the error view in /templates/error.vm: Oh No, Error!
I open Notepad, copied: Oh No, Error!
saved in this directory.
C:\basis\demoplugin\target\jira\webapp\includes\jira\field\templates
with the extension (error.vm)
11. Package
I opened the (cmd) in the directory: C: \> cd basis \ demoplugin> atlas-run
12. Point your browser to ${jira_base_url}/secure/DemoAction!default.
jspa. Enter some name and submit the form to see it in action!
URL in my browser typed this command:
http://Thiago-pc:2990/jira/secure/DemoAction!default.jspa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
7. Override the methods of interest. This is where the actual logic will fit it. It is entirely up to the plugin developer to determine which methods to be overridden. It totally depends on the logic of the plugin. The three main methods of interest are the following. But you can completely omit these methods and write your own commands and related methods:
* doValidation: This is the method where the input validation happens. Plugin developers can override this method and add our own bits of custom validations.
* doExecute: This is where the action execution happens. When the input form is submitted, the doExecute method is called if there are no validation errors. All the business logic is done here and the appropriate 'view' name is returned, based on the execution result. In our example, we use this method to modify the input String: this.modifiedName = "Hi,"+userName; return "success";
* doDefault: This method is invoked when the 'default' command is used. In our example, DemoAction!default.jspa will invoke the doDefault method. In our example, we use this method to redirect the user to the input page: return "input";
public class DemoAction extends com.atlassian.jira.action.JiraActionSupport{
private static final long serialVersionUID = 1L;
private String userName;
private String modifiedName;
public void setUserName(String userName) { this.userName = userName; }
public String getModifiedName(){ return modifiedName; }
@Override
public String doExecute(){ this.modifiedName = "Hi"+userName; return "sucess"; }
@Override
public String doDefault(){ return "input"; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What you have done seems correct. There must be some silly mistake somewhere. Can you upload your plugin source somewhere?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
11. Package the plugin and deploy it.
Then I initialize the plugin at (Command Prompt (cmd)).
use the command: atlas-run to deploy it.
The implementation is done in this directory.
C: \ basis \ demoplugin> ATLAS-RUN
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.