adding issue type using plugin

I am trying to add issue type using plugin i am very much new to jira plugin development could not get much support from online
This is my java class

import com.atlassian.jira.config.IssueTypeManager;
import com.atlassian.jira.issue.issuetype.IssueType;
import com.atlassian.plugin.spring.scanner.annotation.export.ExportAsService;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.sal.api.ApplicationProperties;
import com.testcase.plugin.api.MyPluginComponent;

import javax.inject.Inject;
import javax.inject.Named;

@ExportAsService ({MyPluginComponent.class})
@Named ("myPluginComponent")
public class MyPluginComponentImpl implements MyPluginComponent
{
IssueTypeManager issueTypeManager;
@ComponentImport
private final ApplicationProperties applicationProperties;
// Create issue type:
IssueType myIssueType = this.issueTypeManager.createIssueType("Test Case", "Test case managment issue type", (long)1);

@Inject
public MyPluginComponentImpl(final ApplicationProperties applicationProperties)
{
this.applicationProperties = applicationProperties;
}

public String getName()
{
if(null != applicationProperties)
{
return "myComponent:" + applicationProperties.getDisplayName();
}

return "myComponent";
}
}


and an entry in plugin.xml

<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

do we need to configure the java class "MyPluginComponentImpl " entry in plugin.xml ?

Please help me to address this issue

1 comment

before asnswering your question, would like to understand,

why you want create issue type using api?  why can't you create manually?

when you want to create new issue type using api?

I am planning to develop test case managment plugin as part of this i want to create issue type+screens+ work flows 

i dont want to do customizations in jira prefred to develop plugin 

Comment

Log in or Join to comment
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,334 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot