Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I associate a new search template to an existing field type in JIRA?

tommy guo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2013

In other words I want to write a new search template and have it be associated with an existing field type on JIRA such as the "select list" field, such that all custom fields that are created of type select list will have the option of using this searcher.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
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.
July 15, 2013

You need to write a "searcher" and implement it as a plugin. This refers to custom fields, but actually covers the searchers as well: https://developer.atlassian.com/display/JIRADEV/Custom+Field+Plugin+Module

The key here is that once you've written a searcher, you use the valid-customfield-type tag to tell Jira "and allow people to select my searcher for these field types". I must admit the only searchers I've ever written have been for my own custom fields, so I've bundled them together and never really tried to say "allow my searcher to be used by standard select lists", but I can't see why it wouldn't work.

tommy guo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2013

So I would need the line:

"<valid-customfield-type

package="com.atlassian.jira.plugin.system.customfieldtypes" key="select" />"
in my plugin-xml file?
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.
July 15, 2013

Yes, that's my understanding (as I said, I've not tried it, but that is exactly what I think the doc means)

tommy guo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2013

Nic thank you for the reply, I've tried implementing this method however when I go to change the search template for select list fields my plugin is automatically disabled by the jira server and hence I can not change the search template to my custom one. The code I used inside the plugin was:

public

class MySelectSearcher extends SelectSearcher {

public MySelectSearcher(ComponentFactory componentFactory,

ComponentLocator componentLocator) {

super(componentFactory, componentLocator);

}

}

What's your best guess as to why it's not working?

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.
July 16, 2013

Hmm, I think it might be struggling with the extension of a core class that might not be intended for much extension. (I'm not a java developer, I'm not going to pretend I fully understand this in detail)

Here's what I've got that seems to work for a field that's a bit like a select list:

public class MySearcher extends AbstractCustomFieldSearcher implements CustomFieldStattable, SortableCustomFieldSearcher

{

private final SelectConverter selectConverter;

public MySearcher(SelectConverter selectConverter, FieldVisibilityBean fieldVisibilityBean)

{

super(fieldVisibilityBean);

this.selectConverter = selectConverter;

}

.....
tommy guo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2013

Hey Nic , it seems that the class AbstractCustomFieldSearcher no longer exists in the current version of Jira. Does AbstractInitializationCustomFieldSearcher work just as well?

tommy guo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2013

I got it to work by using

<font></font>

public

<font></font>

class MySelectSearcher extends SelectSearcher

{

{

super(JiraComponentFactory.getInstance(), new JiraComponentLocator());

}

}

TAGS
AUG Leaders

Atlassian Community Events