Hi everyone i created jira custom field plugin. Also i added to custom-field-searcher method by using
class="com.atlassian.jira.issue.customfields.searchers.SelectSearcher".
I fill the custom fields' options by reading values from properties file. Here is everything ok.
My option values are : In Progress, OK, NOK, N/A
when i chosed any option of these and saved the issue.
Problem occurs when i search for issue. JQL is working for three values OK,NOK,N/A
but if i search "In Progress" jql doesnot found any result.
Firstly, I changed "In Progress" into "In-Progress" again didnt work.
However, I changed "In Progress" into "New Test" worked !
i couldnt find the the problem. Is there any specification for In Progress value or smth else ?
Thank You
here my atlassian-plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}"/>
</plugin-info>
<resource type="i18n" name="i18n" location="com.test.plugins.select-custom-fields"/>
<component key="ComponentFactory" class="com.atlassian.jira.util.JiraComponentFactory">
<interface>com.atlassian.jira.util.ComponentFactory</interface>
</component>
<component key="ComponentLocator" class="com.atlassian.jira.util.JiraComponentLocator">
<interface>com.atlassian.jira.util.ComponentLocator</interface>
</component>
<customfield-type name="EMC Test Result" key="emc-test-result-custom-field" class="com.test.plugins.jira.customfields.EmcTestResultCustomField">
<description>Emc Test Result Custom Field Type</description>
<resource name="view" type="velocity" location="templates/view.vm"/>
<resource name="edit" type="velocity" location="templates/emc-test-result-edit.vm"/>
</customfield-type>
<customfield-searcher name="EMC Test Result Searcher" key="emc-test-result-searcher" class="com.atlassian.jira.issue.customfields.searchers.SelectSearcher">
<description>EMC Test Result Searcher Plugin</description>
<valid-customfield-type package="com.test.plugins.select-custom-fields" key="emc-test-result-custom-field"/>
<resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-select.vm"/>
<resource type="velocity" name="view" location="templates/plugins/fields/view-searcher/view-searcher-select.vm"/>
<resource type="velocity" name="label" location="templates/plugins/fields/view-searcher/label-searcher-htmltext.vm"/>
</customfield-searcher>
</atlassian-plugin>
here is my EmcTestResultCustomField.java
package com.test.plugins.jira.customfields;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.customfields.converters.SelectConverter;
import com.atlassian.jira.issue.customfields.converters.StringConverter;
import com.atlassian.jira.issue.customfields.impl.SelectCFType;
import com.atlassian.jira.issue.customfields.manager.GenericConfigManager;
import com.atlassian.jira.issue.customfields.manager.OptionsManager;
import com.atlassian.jira.issue.customfields.option.Option;
import com.atlassian.jira.issue.customfields.option.Options;
import com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.config.FieldConfig;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem;
public class EmcTestResultCustomField extends SelectCFType {
OptionsManager optionsManager;
public static final String filename = "/select-custom-fields.properties";
public EmcTestResultCustomField(CustomFieldValuePersister customFieldValuePersister, StringConverter stringConverter, SelectConverter selectConverter, OptionsManager optionsManager, GenericConfigManager genericConfigManager) {
super(customFieldValuePersister, stringConverter, selectConverter, optionsManager, genericConfigManager);
this.optionsManager = optionsManager;
}
@Override
@SuppressWarnings( { "rawtypes", "unchecked" } )
public Map getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem) {
Map parameters = super.getVelocityParameters(issue, field, fieldLayoutItem);
if(issue == null) { return parameters; }
FieldConfig fieldConfig = field.getRelevantConfig(issue);
Properties prop = new Properties();
try {
prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename));
} catch (FileNotFoundException e) {e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
String[] Info = prop.getProperty("EMC-Test-Result-Type").split(",");
Options options = this.optionsManager.getOptions(fieldConfig);
if (options.isEmpty()) {
for(int i=0;i<Info.length;i++){
this.optionsManager.createOption(fieldConfig, null, new Long(i), Info[i].trim());
}
}
options = this.optionsManager.getOptions(fieldConfig);
Map<Long, String> results = new HashMap<Long, String>();
for (Option option : (Iterable<Option>) options) {
results.put(option.getOptionId(), option.getValue());
}
parameters.put("emc_test_result", results)
return parameters;
}
}
here is my select-custom-fields.properties
EMC-Test-Result-Type = In Progress, N/A, N/R, OK, NOK
Thomas,
I tried but there is no problem for JQL syntax. In addition autocomplete function locates In Progress value but no result is found
Hi Batuhan,
I think "in" might be a reserved word in JQL
Cheers
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.