Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,951
Community Members
 
Community Events
168
Community Groups

Since release 8.x, JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class) is deprecated.

Hi,

Since release 8.x, JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class) is deprecated. It is giving warning.

Can u please suggest what should I use.

 

Thanks & Regards,

Pratiksha.

1 answer

0 votes

Hi,

Why do you need WorkflowTransitionUtil? Could you share your code, please?

Hi,

to make the transition through post function I need it.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Category
import com.atlassian.jira.bc.issue.IssueService


def Category log = Category.getInstance("com.PostFunction.PostFunction_BSS_MoveAOPProjectToArchitectureWhenFeatureArchitecture”.groovy")
log.setLevel(org.apache.log4j.Level.INFO)

IssueManager issueManager = ComponentAccessor.getIssueManager()
def userManager=ComponentAccessor.getUserManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
MutableIssue AOPissue
//MutableIssue issue = issueManager.getIssueObject("DE-49333")
def count = 0
def IssueLinkManager = ComponentAccessor.getIssueLinkManager()
IssueService issueService = ComponentAccessor.getIssueService()
IssueLinkManager.getInwardLinks(issue.getId()).each{ issueLink ->
if(issueLink.issueLinkType.name =="Project-Feature Link")
{
AOPissue = issueLink.getSourceObject() as MutableIssue
log.error(AOPissue)
count++
}
}
if((count == 1) && (AOPissue.issueType.getName() == "AOP Project"))
{
if (AOPissue.getProjectObject()?.getProjectCategory()?.getName()=='BSS')
{
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService)
def query = jqlQueryParser.parseQuery('issuekey = "'+ AOPissue.key +'" AND status was in ("Architecture")')
def results = searchService.search( currentUser, query,PagerFilter.getUnlimitedFilter())
if(results.total == 0)
{
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
workflowTransitionUtil.setIssue(AOPissue as MutableIssue);
workflowTransitionUtil.setUserkey(currentUser.key);
workflowTransitionUtil.setAction(171);
workflowTransitionUtil.validate();
log.error("Validated")
workflowTransitionUtil.progress();
log.error("Success")
}
}
}

 

Thanks & Regards,

Pratiksha.

You have to rewrite your WorkflowTransitionUtil part to use TransitionOptions and IssueService like it's described here.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

179 views 1 6
Read article

Atlassian Community Events