A searcher for custom field AbstractMultiCFType

codelab expert
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 7, 2013

Hello,

I've developed a custom field which extends AbstractMultiCFType<String> in a v2 plugin. All is working fine! Now I want to add a searcher, but I don't know how to do that. I found that it is not possible to take SelectSearcher or MultiSelectSearcher (https://developer.atlassian.com/static/javadoc/jira/6.0.3/reference/com/atlassian/jira/issue/customfields/searchers/MultiSelectSearcher.html )

Do you have some code snippet or any ideas ? Thank you!

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
codelab expert
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 decided to extend a AbstractSingleSelect. This works for me.
0 votes
MattS
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.
December 5, 2013

You might find the source code in https://bitbucket.org/mdoar/practical-jira-plugins/src/f8c80e3efaa2/multiplevalues/src/main/java/com/mycompany/jira/plugins/multiple/searchers/?at=default useful. This is from one the examples for my O'Reilly book "Practical JIRA Plugins". It was last updated for JIRA 5.2 but the searcher code hasn't changed that much since then IIRC.

MattS
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.
December 5, 2013

Oops, now I read the README again (https://bitbucket.org/mdoar/practical-jira-plugins/src/f8c80e3efaa21f80a7e4e3bac55c9c3ba1e40bca/multiplevalues/README?at=default) I see that the searcher was not ported to 5.2, but it did work in 4.4. I don't recall exactly why it didn't get upgraded.

Alied Perez
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.
April 16, 2014

Hi, Matt I was following your example from "Practical Jira Plugins", until I got stuck with MultipleValuesCustomFieldSearchInputTransformer and MultipleValuesCustomFieldValidator. Even downloaded the sources, but they don't even compile. Do you have an update? I need to implement a searcher for a custom field[1] but I just don't get to make it (and Atlassian documentation just does not help)

[1]https://answers.atlassian.com/questions/285422/usable-complex-custom-field-searcher-example

MattS
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.
April 17, 2014

The sources are for JIRA 5.2 as I noted, and haven't been updated for newer versions of JIRA. As you note, the dev docs for JIRA searchers is pretty minimal. All I can suggest is looking at the source of other add-ons in the marketplace that have searchers for guidance.

Alied Perez
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.
April 17, 2014

Thanks, Matt, for your quick response.

The thing is; I checked the sources and they don't compile:

MultipleValuesCustomFieldSearchInputTransformer and MultipleValuesCustomFieldValidator are missing. Are they part of Atlassian SDK?

This is the error:

------------------------------------------------------------------------

BUILD FAILURE
------------------------------------------------------------------------
Compilation failure

com/mycompany/jira/plugins/multiple/searchers/MultipleValuesSearcher.java:[81,42] error: cannot find symbol

could not parse error message: symbol: class MultipleValuesCustomFieldSearchInputTransformer
location: class MultipleValuesSearcher
C:\Users\AliedP\Downloads\mdoar-practical-jira-plugins-f8c80e3efaa2\mdoar-practical-jira-plugins-f8c80e3efaa2\multiplevalues\src\main\java\com\mycompany\jira\plugins\multiple\searchers\MultipleValuesSearcher.java:88: error: cannot find symbol
this.customFieldSearcherClauseHandler = new SimpleCustomFieldSearcherClauseHandler(new MultipleValuesCustomFieldValidator(),
^


0 votes
SomnathK December 4, 2013

I am in a similar situation.

I have created a Custom Single Select Field, and now wants to create a Searcher for it.

But I cannot use/extend the SelectSearcher as they are designed for V1 plugins and mine is v2 plugin.

Any directions ?

0 votes
Dipti Ranjan Behera
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 8, 2013

@Mathias,

MultiGroupCFType, MultiSelectCFType, MultiUserCFType, VersionCFType customfield types extends AbstractMultiCFType cutomfield type.

Therefore depending on your usage , you extend searcher for above mentioned CF.

Look into system-customfieldtypes-plugin.xml in jira source code for more details

codelab expert
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 8, 2013

Thank you for your answer!

In my question I wrote that I use a v2 plugin. In this case it is NOT possible to import "com.atlassian.jira.issue.customfields.searchers.MultiSelectSearcher"...only in v1 plugins.

Dipti Ranjan Behera
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 9, 2013

@Mathias,

I didnt get the V2 & V1 difference.

Since, you are extending AbstractMultiCFType<String> then you need to write a class similar to com.atlassian.jira.issue.customfields.searchers.MultiSelectSearcher.

And later on extend this class , to have a searcher of your own. again you might have to do some entry in system-customfieldtypes-plugin.xml file (Not sure).

It seems that you might have to do little RnD on it.


codelab expert
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 10, 2013
Do you have some sample code? Remember that 125 karma points are waiting for you :-)
Dipti Ranjan Behera
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 10, 2013

@Mathias ,

I dont have code for first step of searcher. i.e. creating class similar to MultiSelectSearcher

And currently , i cant put my effort on it :(

0 votes
Dipti Ranjan Behera
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 8, 2013
codelab expert
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 8, 2013

In this source the searcher is extended form

ExactTextSearcher

This will not work with a multi value custom field. Jira can not match a single text with an array.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events