Jira Workflow on Java API

Hi guys,
I’m trying to build a plugin and one step of the plugin is to build workflows. I’ve been searching and trying to understand why, but couldn’t find a solution. I’m currently using Jira 9.4.21, but in this case, plugin and code in base on Jira 10.0.1 (don’t think that different versions matters in this case).
Trying to instantiate a “JiraWorkflow” object through a “ConfigurableJiraWorkflow” I’m getting the compile error “cannot find symbol”. Can anyone help on this? Or if I’m also doing other things wrong, feel free to point them.
Error on console:

[ERROR] /C:/Users/pcampos/Documents/plugins/testes/workflowCreation/src/main/java/com/pcampos/plugins/rest/WorkflowCreation.java:[299,41] cannot find symbol
[ERROR]   symbol:   class ConfigurableJiraWorkflow
[ERROR]   location: class com.pcampos.plugins.rest.WorkflowCreation

My method so far:

    public void createWorkFlow(String workflowName) {
        WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();

        DescriptorFactory descriptorFactory = new DescriptorFactory();
        WorkflowDescriptor workflowDescriptor = descriptorFactory.createWorkflowDescriptor();
        workflowDescriptor.setName(workflowName);

        //Create "Open" step
        StepDescriptor openStep = descriptorFactory.createStepDescriptor();
        openStep.setName("Open");
        openStep.setId(1);
        workflowDescriptor.addStep(openStep);

        //Create "In Progress" step
        StepDescriptor inProgressStep = descriptorFactory.createStepDescriptor();
        inProgressStep.setName("In Progress");
        inProgressStep.setId(2);
        workflowDescriptor.addStep(inProgressStep);

        // Create a transition between steps
        ActionDescriptor openToInProgressAction = descriptorFactory.createActionDescriptor();
        openToInProgressAction.setName("Start Progress");
        openToInProgressAction.setId(1);

        //Set destination
        ResultDescriptor destinationInProgress = descriptorFactory.createResultDescriptor();
        destinationInProgress.setStep(2);
        openToInProgressAction.setUnconditionalResult(destinationInProgress);

        openStep.getActions().add(openToInProgressAction);
        workflowDescriptor.getGlobalActions().add(openToInProgressAction);

        // Register the workflow
        JiraWorkflow jiraWorkflow = new ConfigurableJiraWorkflow(workflowDescriptor.getName(), workflowDescriptor, ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser());
        workflowManager.createWorkflow(
                ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(),
                jiraWorkflow);
    }

Properties on POM file:

<properties>
        <jira.version>10.0.1</jira.version>
        <amps.version>9.1.1</amps.version>
        <plugin.testrunner.version>2.0.4</plugin.testrunner.version>
                <!--<atlassian.spring.scanner.version>2.2.4</atlassian.spring.scanner.version>-->
        <atlassian.spring.scanner.version>3.0.3</atlassian.spring.scanner.version>
        <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <!-- TestKit version 6.x for JIRA 6.x -->
        <testkit.version>6.3.11</testkit.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>16</maven.compiler.source>
        <maven.compiler.target>16</maven.compiler.target>
</properties>

Many thanks,
Pedro Campos

1 Like