Some examples of the “resyntax” conversion in Groovy with explicit option. See the entire API changes list here


JIRA 6

subTask = issueMgr.createIssue(currentUserObj, newissue)

JIRA 7

Issue subTask = issueMgr.createIssueObject(currentUserObj, newissue)

JIRA 6

ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()

JIRA 7

//ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

JIRA 6

issues = searchResult.issues.collect {issueManager.getIssueObject(it.id)}

JIRA 7

issues = searchResult.issues.collect { (Issue) issueManager.getIssueObject(it.id)}

JIRA 6

leaveDate = issue.getCustomFieldValue(cf_suspendDate).format('dd/MM/yyyy') 

JIRA 7

def leaveDate = ((Date) issue.getCustomFieldValue(cf_suspendDate)).format('dd/MM/yyyy')

JIRA 6

def user = userManager.getUserByKey("user")?.directoryUser

JIRA 7

def user = userManager.getUserByName("user")

JIRA 6

def user = userManager.getUserByKey("user")?.directoryUser

JIRA 7

def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserByName("user")

JIRA 6

workflowTransitionUtil.setUsername(adminUserName);

JIRA 7

workflowTransitionUtil.setUserkey(adminUserName);

JIRA 6

issue.issueTypeObject.name

JIRA 7

issue.getIssueType().getName()

JIRA 6

def issueLinkManager = componentManager.getIssueLinkManager()

JIRA 7

def issueLinkManager = ComponentAccessor.getIssueLinkManager()

JIRA 6

issueFactory = ComponentManager.getInstance().getIssueFactory()

JIRA 7

def issueFactory = ComponentAccessor.getIssueFactory()

JIRA 6

SearchService.ParseResult parseResult =  searchService.parseQuery(user2.getDirectoryUser(), jqlSearch)

JIRA 7

SearchService.ParseResult parseResult =  searchService.parseQuery(user2, jqlSearch)

JIRA 6

issueobtained = issueManager.getIssueObject(issue.getKey());
ManagerFactory.getIndexManager().reIndex(issueobtained.getGenericValue());

JIRA 7

import com.atlassian.jira.issue.index.*;
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
issueIndexingService.reIndex(issueobtained);

JIRA 6

Key = subTask.get("key")

JIRA 7

def Key = subTask.getKey()

JIRA 6

newissue.setProject (projectMgr.getProjectByName(projectName))

JIRA 7

newissue.setProjectObject (projectMgr.getProjectByCurrentKey(projectName))

JIRA 6

WatcherManager watcherManager = componentManager.getWatcherManager()
watcherManager.startWatching(project.getLeadUser(), newissue)

JIRA 7

WatcherManager watcherManager = ComponentAccessor.getWatcherManager()
watcherManager.startWatching(project.getProjectLead(), newissue)
Posted by:.

One thought on “Migrating Groovy scripts from JIRA 6 to JIRA 7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s