Programming new Plugin connection to Jira Database

dkatko October 21, 2016

Hello all,

Imnew to Atlassian Developing and for a Project we have to develop a plug in that connects to the JIRA Database.
Im at a loss after scouring the Internet, I cannot seem to find a fitting solution.
Can you give me some ideas which classes to use in the JIRA rest API?

Thanks! 

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2016

Possibly.

First, we need to know what type of coding you are doing.  The options are broadly:

  1. Hacking the core of JIRA (To be avoided.  It leaves you unsupported and hard to upgrade, maintain, debug or change)
  2. Writing a type-2 plugin, which will be installed into a JIRA system and has direct access to the internal java APIs (JIRA Server only)
  3. Writing a Connect add-on, which will be installed into a JIRA system, but uses REST to do the work (JIRA Cloud only)
  4. Writing an external thing that runs outside JIRA and uses REST to do the work

I'm guessing you mean 2 or 3, but they make a bit less sense if we don't explain the full range.

Also, don't say "database" - you don't want to code for access to the database, it's not sane.  Always go through the APIs.

dkatko October 26, 2016

Hello Nic,

Thank you for your Answer. I think my Plugin would fall under number 2 of your description.

How would I go about it through the API?
I searched on google but could not find a fitting answer.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 26, 2016

Do what?  You haven't explained what your add-on is going to do.  You've just said "connect to the database" which is, quite simply, the wrong way to approach doing things in JIRA.

Could you describe what your add-on is aiming to do, in terms of what the users might see or get?

dkatko October 26, 2016

The goal is to connect to the db, pull two numbers out, and create the sum and average value of these two numbers and then export the results to txt and pdf.
My job in this is only to realize the db connection to access the numbers.
This Project is part of a group project in which we are practicing Scrum, and creating a plugin for Jira.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 26, 2016

Right.

Do not do it with a database connection.  It is the wrong approach.  Use the API.

What are these numbers?

dkatko October 27, 2016

These numbers are just dummy variables. The goal is to program a plugin that gathers information from the JIRA db about issues, progress, etc. and enable the user to generate reports.
My job is to implement the link between the report generation and the JIRA db.
How could I realize this with the API? All examples I found so far do not work because the imports cannot be resolved.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2016

If your imports aren't resolving, then the code is broken (although I know getting the imports right are a pain when writing add-ons for Atlassian stuff).  It's worth going into a bit more detail I think.

Also, you probably need to define the questions you're looking to answer. 

If you really want totally open-ended reporting, then I'd lean toward moving to a database tool instead of trying to read the JIRA database in the application.  It's not built for reporting, but it can be used, especially if you use a product that understands the JIRA database would be best.  (I tend to avoid open-ended reporting - it usually leads to users coming to you to "explain why this report tells me X" and you spend hours working out that their reporting was built by the clueless and it's nonsense!)

If you want this reporting inside JIRA though, then definitely need to fix your imports!  Even if you weren't working with the API much, you'll still have problems.

dkatko October 27, 2016

How would I go about fixing the imports?
For example:
import com.atlassian.jira.rest.client.api.JiraRestClientFactory;
isn't resolving. (As are a bunch of other ones).

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2016

Well, that's no surprise.  JRJC is for coding something that runs outside JIRA, it can't be imported into an add-on because it's external (and add-ons simply don't need it - they already have access to the API)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events