Upgrading Custom Field Types in JIRA 3.4.1

Upgrading Custom Field Types in JIRA 3.4.1

valuesEquals method addition

If you have implemented a CustomFieldType by directly implementing the com.atlassian.jira.issue.customfields.CustomFieldType interface instead of extending one of the Abstract classes that ship with JIRA, you will need to add the following method to your implementation:

/**
 * Used to compare old field value to the new field value when the issue is being updated
 * and work out whether a change item should be generated.
 * @param v1 current value
 * @param v2 new value
 * @return true if the change item should be generated, false otherwise
 */
boolean valuesEqual(Object v1, Object v2);

This means that you will need to implement this method and recompile your class before deploying it into JIRA 3.4.1.

The method has been introduced to resolve bug JRA-8480 and allows the CustomFieldType to have control over change items that JIRA generates when an issue is updated.

The com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType implements the method as follows:

if (v1 == v2)
{
    return true;
}

if (v1 == null || v2 == null)
{
    return false;
}

return v1.equals(v2);

which is compatible with the behaviour of previous JIRA releases. Therefore if your CustomFieldType extends AbstractCustomFieldType, or any of its subclasses, you do not need to add this method, unless you would like to take advantage of it.

CustomFieldSearchers - AbstractCustomFieldSearcher constructor change

If you have implemented any CustomFieldSearchers that extend the com.atlassian.jira.issue.customfields.searchers.AbstractCustomFieldSearcher class then you will have to modify your CustomFieldSearcher. The constructor of the AbstractCustomFieldSearcher class has changed from being a no-arg constructor to taking an instance of com.atlassian.jira.web.bean.FieldVisibilityBean. You must pass the FieldVisibilityBean to the super classes constructor. You will need to include code that will look something like this:

public MultiProjectSearcher(FieldVisibilityBean fieldVisibilityBean)
{
   super(fieldVisibilityBean);
}

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport