Searchable custom field type

Viktor Mirzoyan November 3, 2011

I have a plugin that implements a multi-select custom field type. I want to make this custom field searchable. I've referred to this and this but i'm still having an issue with unresolved dependency. Plugin is version 2. This is what I have:

atlassian-plugin.xml:

<customfield-searcher key="multiselectsearcher" name="Multi Select Searcher" i18n-name-key="admin.customfield.searcher.multiselectsearcher.name"

class="org.cmp.jira.plugin.MSSearcher">

<description key="admin.customfield.searcher.multiselectsearcher.desc">Search for multiple values using a single select list.</description>

<resource type="velocity" name="search" location="templates/search-multiselect.vm"/>

<resource type="velocity" name="view" location="templates/view-searcher-multioption.vm"/>

<resource type="velocity" name="label" location="templates/label-searcher-basictext.vm"/>

<valid-customfield-type package="org.cmp.jira.plugin.crm" key="my-clients"/>

</customfield-searcher>

MSSearcher:

public class MSSearcher extends MultiSelectSearcher{

public MSSearcher(ComponentLocator componentLocator, ComponentFactory componentFactory) {

super(componentLocator, componentFactory) ;

}

}

Any tips?

4 answers

2 votes
brainicorn
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 3, 2011

The above answer has syntax errors. The proper constructor is:

public MSSearcher()
{
    super(new JiraComponentLocator(),JiraComponentFactory.getInstance());
}

Also, please be aware that this is a workaround for a known issue: https://jira.atlassian.com/browse/JRA-20403

1 vote
Jobin Kuruvilla [Adaptavist]
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.
November 3, 2011

Modify your searcher constructor like this:

public MSSearcher(){
super(new JiraComponentLocator(), JiraComponentFactory.getInstance()) ;

}

Viktor Mirzoyan November 3, 2011

Thanks Jobin!

0 votes
brainicorn
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 3, 2011

What is the exact error? e.g. which dependency is it having a problem with?

0 votes
Viktor Mirzoyan November 3, 2011

Error:

com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.cmp.jira.plugin.MSSearcher': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.jira.util.ComponentLocator]: : No unique bean of type [com.atlassian.jira.util.ComponentLocator] is defined: Unsatisfied dependency of type [interface com.atlassian.jira.util.ComponentLocator]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.jira.util.ComponentLocator] is defined: Unsatisfied dependency of type [interface com.atlassian.jira.util.ComponentLocator]: expected at least 1 matching bean

Suggest an answer

Log in or Sign up to answer