Hi,
I wrote a calculated custom field that displays list of Versions. It is calculated (extends CalculatedCFType) and read-only (view screen only, no edit).
It works as expected, except for the searcher functionality.
I added the "customfield-searcher" and "component-import" to atlassian-plugin.xml
Still when I try to enable the plugin it fails:
ERROR admin /rest/plugin/1.0/<my-plugin-class>-key [plugin.osgi.factory.OsgiPlugin] Never resolved service '&versionSearcher' for plugin '<my-plugin-class>' with filter (objectClass=com.atlassian.jira.issue.customfields.searchers.VersionSearcher)
What is the proper way to make my custom field type searchable?
UPDATE:
I tried to override the searcher with a dummy custom searcher. here is the code:
public class PenVersionSearcher extends VersionSearcher { public PenVersionSearcher(VersionManager versionManager, FieldVisibilityManager fieldVisibilityManager, VersionResolver versionResolver, JqlOperandResolver operandResolver, FieldFlagOperandRegistry fieldFlagOperandRegistry, VersionClauseContextFactory versionClauseContextFactory, PermissionManager permissionManager, ContextSetUtil contextSetUtil, FieldConfigSchemeClauseContextUtil clauseContextUtil, MultiClauseDecoratorContextFactory.Factory multiFactory, CustomFieldInputHelper customFieldInputHelper) { super(versionManager, fieldVisibilityManager, versionResolver, operandResolver, fieldFlagOperandRegistry, versionClauseContextFactory, permissionManager, contextSetUtil, clauseContextUtil, multiFactory, customFieldInputHelper); } }
And referrenced it in my atlassain-plugin.xml:
<customfield-searcher key="pen-versions-searcher" name="Versions Searcher" class="com.mydomain.plugins.fields.searchers.PenVersionSearcher"> <description key="admin.customfield.searcher.versionsearcher.desc">Allow to search for calculated fields' versions using a dropdown list.</description> <resource type="velocity" name="search" location="templates/customfields/view-searcher/edit-version.vm"/> <resource type="velocity" name="view" location="templates/customfields/view-searcher/view-searcher-version.vm"/> <resource type="velocity" name="label" location="templates/customfields/view-searcher/label-searcher-version.vm"/> <valid-customfield-type package="com.mydomain.plugins.fields" key="pen-fix"/> </customfield-searcher>
This doesn't work!
Anyone has a clue what is the problem?
I can go on and add my custom-fileds to the system-customfield-types.xml file, but I don't like it, if I can make the custom searcher to work it will be best solution.
Thanks.
Community moderators have prevented the ability to post new answers.
This was solved eventually only by adding my custom field to the system-customfieldtypes-plugin.xml, like this:
<customfield-searcher key="versionsearcher" name="Version Dropdown Searcher" <!--the rest of the data goes here--> <valid-customfield-type package="com.mydomain.plugins.fields" key="pen-fix"/> </customfield-searcher>
Not the most elegant solution, though.
Hi there,
I'm triing to use number range searcher within my numeric field. I'm a little bit lost. Here what I have:
1) I have fully functional numeric field, I can set values to it, here is what I have in plugin descriptor
<customfield-type name="Story Health Custom Field" i18n-name-key="story-health-custom-field.name" key="story-health-custom-field" class="com.komtesa.jira.customfields.StoryHealthCustomField"> <description key="story-health-custom-field.description">The Story Health Custom Field Plugin</description> <resource type="velocity" name="view" location="templates/view-storypointshealthfield.vm"/> <resource type="velocity" name="edit" location="templates/edit-storypointshealthfield.vm"/> <resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-basictext.vm"/> </customfield-type>
2) have created custom searcher with dummy class, here is the code:
<customfield-searcher name="Number Range Searcher" i18n-name-key="number-range-searcher.name" key="number-range-searcher" class="com.komtesa.jira.customfields.StoryHealthSearcher"> <description key="number-range-searcher.description">The Number Range Searcher Plugin</description> <resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-basictext.vm"/> <resource type="velocity" name="view" location="templates/plugins/fields/view-searcher/view-searcher-basictext.vm"/> <valid-customfield-type package="com.komtesa.jira.customfields" key="story-health-custom-field"/> </customfield-searcher>
and the class itself
public class StoryHealthSearcher extends NumberRangeSearcher { public StoryHealthSearcher( JqlOperandResolver jqlOperandResolver, DoubleConverter doubleConverter, CustomFieldInputHelper customFieldInputHelper, I18nHelper.BeanFactory beanFactory, FieldVisibilityManager fieldVisibilityManager) { super(jqlOperandResolver, doubleConverter, customFieldInputHelper, beanFactory, fieldVisibilityManager); } }
But I still get message Field 'Story Health' is not searchable, it is only sortable.
Thank you very much for help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Omg, I have wasted some time :-)
For others: Don't forget to configure field to use searcher in field edit screen if you add searcher to plugin after you create the field itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In jira 5.0.7 .
Below code will work.
public class CustomVersionSearcher extends VersionSearcher {
public CustomVersionSearcher(VersionManager versionManager,
FieldVisibilityManager fieldVisibilityManager,
JqlOperandResolver operandResolver,
PermissionManager permissionManager, CustomFieldInputHelper customFieldInputHelper) {
super(versionManager, fieldVisibilityManager, new VersionResolver(versionManager), operandResolver,
new DefaultFieldFlagOperandRegistry() , new VersionClauseContextFactory(operandResolver, new VersionResolver(versionManager), permissionManager) ,
permissionManager, ContextSetUtil.getInstance(), ComponentAccessor.getComponent(FieldConfigSchemeClauseContextUtil.class) , new MultiClauseDecoratorContextFactory.Factory( new DefaultOperatorUsageValidator(operandResolver, ComponentAccessor.getI18nHelperFactory()) , operandResolver, ContextSetUtil.getInstance()),
customFieldInputHelper);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I created another calculated custom field, this time it's even simpler. The return value is collection of strings. So my search is using the MultiSelectSearcher.
When I come to edit the custom field (and add the search template), I get the following exception in the log file:
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
This my custom searcher:
public class FamilySearcher extends MultiSelectSearcher { public FamilySearcher(ComponentLocator componentLocator, ComponentFactory componentFactory) { super(componentLocator, componentFactory); } }
Any idea, anyone?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Refer this tutorial, as it gives the exact approach of writing the customfield searcher. Hope you find it useful.
http://www.j-tricks.com/1/post/2010/09/custom-field-searchers.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The thing is that I tried the way j-tricks suggests. Including creating a dummy custom Searcherclass. Maybe I shouldn't use VersionSaercher class?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you try using the TextSearcher or ExactTextSearcher. Hope that should work!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. it works, but I can't use it because the custom-filed values are Version names, not text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.