How can I get the source code for the "all comments" plugin?

Will Sheppard January 22, 2014

We're using the "all comments custom field type" plugin to migrate comments from Jira 4 to Jira 6.

There are some problems with the plugin, but the last update was in August 2012.

I've emailed the developer, but if they're not responsive then how can I get the source code of the plugin out of jira to modify it to fix the bugs myself?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
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.
January 22, 2014

"You can't" is the short answer. If the developer won't provide you with the code, then you're stuck, because the distributed plugin files do not contain the source for it.

However...

If you unzip the .jar file (they're stored in a .zip like format), you'll find most of what you need to recreate the plugin - .vm and .xml files are doing a lot of the work, and they're not compiled objects, so what you see in them IS their code. You'll be missing code for the .class files, but it's actually not too hard to work backwards from the .vm files to work out what the code should do (and there are java de-compilers if you are desperate)

0 votes
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2014

Hi Will,

Nic has already explained everything you can do, but I still have 2 questions for you:

Why do you need this plugin for you migration?

Will this not introduce more problems and work then simply doing a basic migration?

Just wondering.

Best regards,

Peter

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.
January 22, 2014

Mmm, good point, I should have asked "why", as there are much better ways of migrating than some form of export/import-via-fields

Will Sheppard January 22, 2014

We've settled on a .csv import as previously discussed.

The few things that were missing from that were:

  • Attachments - we plan to copy over the directory and use Jelly to connect files to issues (Thanks Nic)
  • Comments - which we're using the that plugin to export, except it puts extra <p> tags and not very good formatting.
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.
January 22, 2014

Ahh, that makes sense, I remember that now :-)

I rarely post code, as I find it stops people learning to do it for themselves (so they keep coming back for more spoon-feeding), but this might help with the java. It's the most important bit of a "derived custom field" class - the bit that actually fetches the data from the database for display.

This snippet fetchs the last comment on the issue and spits it out along with the writer and date stamp. I'm sure you can see how to adapt it - iterate over the "comments" List and do more appropriate formatting.

public Object getValueFromIssue(CustomField field, Issue issue)

{

User remoteUser = authenticationContext.getUser();

List<Comment> comments = commentManager.getComments(issue);

if (comments.isEmpty()) {

return "";

}

Comment lastComment = comments.get(comments.size() - 1);

return lastComment.getAuthorFullName() + " at " + lastComment.getCreated();

}

TAGS
AUG Leaders

Atlassian Community Events