Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Plugin project template scheme associations

Artemy Matvienko
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.
March 28, 2018

The official Atlassian tutorial on the subject of creating project template plugins is very shallow. It doesn't really explain how to use the "configure" function in the MyAddProjectHook class to associate all of the schemes to the new project. I've tried looking around through the 7.1.9 API docs and community Q&As, but the answers that I found weren't covering everything I need to do.

Here's what I have so far:

    @Override
public ConfigureResponse configure(final ConfigureData configureData)
{
ConfigureResponse configureResponse = ConfigureResponse.create().setRedirect("/issues/");

IssueTypeSchemeManager issueTypeSchemeManager = ComponentAccessor.getIssueTypeSchemeManager();
WorkflowSchemeManager workflowSchemeManager = ComponentAccessor.getWorkflowSchemeManager();
IssueTypeScreenSchemeManager issueTypeScreenSchemeManager = ComponentAccessor.getIssueTypeScreenSchemeManager();
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager();

Project project = configureData.project();

Scheme workflowScheme = workflowSchemeManager.getSchemeObject(Long.valueOf(10100)); //DEMO: My Project Template Workflow Scheme
IssueTypeScreenScheme issueTypeScreenScheme = issueTypeScreenSchemeManager.getIssueTypeScreenScheme(Long.valueOf(10000)); //Test Issue Type Screen Scheme
FieldConfigScheme fieldConfigScheme = fieldConfigSchemeManager.getFieldConfigScheme(Long.valueOf(10000)); //Test Field Config Scheme

workflowSchemeManager.removeSchemesFromProject(project);
workflowSchemeManager.addSchemeToProject(project, workflowScheme);

issueTypeScreenSchemeManager.addSchemeAssociation(project, issueTypeScreenScheme);

return configureResponse;
}

The workflow and issue type screen schemes apply fine, but I can't seem to find much info on the rest - Issue Type Scheme and Field Config Scheme.

0 answers

Suggest an answer

Log in or Sign up to answer