How to convert Project Id's in groovy

How am I able to spit out this output:

CachedRoleActors[delegate=ProjectRoleActorsImpl[projectId=10100,super=DefaultRoleActorsImpl[projectRoleId=10002,roleActors=[UserRoleActor[id=10202,projectRoleId=10002,projectId=10100,parameter=mike123], GroupRoleActor[id=10200,projectRoleId=10002,projectId=10100,parameter=jira-administrators]]]],optimizedProjectRoleSet=[UserRoleActor[id=10202,projectRoleId=10002,projectId=10100,parameter=mike123], GroupRoleActor[id=10200,projectRoleId=10002,projectId=10100,parameter=jira-administrators]]] 2018-01

into something more readable, and have the actual project ID's (4 letters) rather than the numbers?

I'm iterating over the Project items, and trying to convert them using:

 def roleID = projectRoleManager.getProjectIdsForUserInGroupsBecauseOfRole(4, projectrole, projectRoles, user)

But I'm not sure if this is the right implementation for it.

I would like to do the same for my other id's i.e. groupRoleActor id etc.

Thanks 

1 answer

0 vote
Micky Caritte Community Champion Jan 12, 2018

Hi Daniel,

IDs are number and they are used in the API and database. The thin you want to get is the project key, not all configuration items have keys, sone just have a name and generally you'll need a manager to acces them from their ID.

For project for instance, ProjectManager have a getProjectObj(Long id) method which will return a Project object, from which you can get all informations including its key. (https://docs.atlassian.com/software/jira/docs/api/7.2.2/com/atlassian/jira/project/ProjectManager.html)

You'll need to handle similar things for each configuration item.
Hope this helps!

Cheers

Suggest an answer

Log in or Join to answer
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,308 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