Manipulating with JIRA entities from a plugin component

I am creating a plugin which will have a scheduled job inside periodically synchronizing jira database with 3rd party software. So all the routines will be performed in background.

It will be required to perform the following set of tasks:

1) Search for issues / projects / versions / jira users by certain search criteria

2) Create new / Update existing issues / projects /versions / jira users

All the changes performed by the plugin should be visible in "Recent Activity" like it was done directly by users.

Which internal Jira API(s) I need to use within my plugin to achieve the goals? Which is the best practice to perform this task?

10 answers

Well I do not need too detailed explanations. I would like to find out if there is a separate API for Jira DB manipulation and where can I read for this. I.e. which can provide me the interface to access all jira entities.

As for example you mentioned JqlQueryBuilder and IssueService but I don't only need to deal with issues but also with projects, versions and users.

I searched over the docs and questions database but can't find anything suitable.

0 vote

Use OfBizDelegator. You will find all the methods in the Java docs. There is a chapter for working with DB in JIRA Development Cookbook.

0 vote

You're unlikely to get a good answer with such a broad question. Start with JqlQueryBuilder, IssueService, etc etc.

0 vote

In that case, ProjectManager, ProjectVersionManager, and UserManager/UserAccessor. Of course, you can go direct to the DB as well.

Thank you Jamie and Jobin for the hints. The picture is getting clearer now.

So as far as I see I have 2 ways:

1) Use OfBiz Entity Manager to work directly with jira database

2) Use Managers for every kind of JIRA data I need to deal with

Could you, please, highlight the biggest pros and cons of both approaches as I am on crossroads and need to choose the best way or it may cost much if I will discover some restriction in the middle of the road.

But what about Jobin's OfBizDelegator - seems quite competitive alternative.

0 vote

You don't want to be writing to the database directly, so if you need to create <anything> in jira, the managers etc are the only choice you have.

0 vote

By writing to the db I mean using OfBizDelegator to store values directly in the DB. Sometimes it's ok, but for the things you're talking about, it's not. Unless you want to tear your hair out dealing with problems involving the caches and referential integrity. Really, there is only one way to do this.

Thanks Jamie for clarification, this definitely makes sense for me.

0 vote

I agree with Jamie. Use OfBizDelegator only when you know all the DB Entity relations. It is advised to use manager classes if possible and use delegator only if that is not an option.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

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