Hello.
I need to get the project key (or keys) programmatically.
The only alternative to retrieve the project keys I found was the content on this page:
There it says:
com.atlassian.jira.project.ProjectManager#getAllProjectKeys
What I need is to retrieve the key(s) by project id. Is there an easy way to do this? How can I know which key correspond to which project id?
I'm using Jira version 6.4.3 and Atlassian Plugin SDK version 5.0.13.
I am using the SAL Services. If someone have a better option, I'll be very grateful.
Thank's.
Community moderators have prevented the ability to post new answers.
Well, your post already contains the answer to your question: Use com.atlassian.jira.project.ProjectManager#getAllProjectKeys
Is there any reason to not use that method? Or do you want to achieve something different?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I guess I don't get it. From the description in your initial post I still think that that method does exactly what you want, which is as I understood it: Given a project id, find all keys which are or were in use for the project with that id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andreas, I'm working with Andrey on this... Actually, you are right! We couldn't find this method before because we were using the "com.atlassian.sal.api.ProjectManager" class that, in spite of having the same name, doesn't have such method. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried getting it via the JIRA Database or JIRA REST API per project?.
https://developer.atlassian.com/jiradev/jira-architecture/database-schema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't believe I'll be able to get this info from the database. I can only access my plugin stuff, I guess. And the REST API does not apply to this case because I'm in the back end. In the front-end I can get it for sure. Another suggestion?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In case somebody comes in after this. Don't go through the database layer from inside a jira plugin. You'll get hurt (caching, database connections etc). Stay in the java jira api and you'd be good (I'm also not a fan of the web making rest calls out and into itself - it's as security issue waiting to happen).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.