This document is intended to JMCF add-on users that are migrating from 1.x to 2.x. JMCF has moved from BeanShell Scripting to Groovy from 2.x. It also has a vast number of advanced features and new custom fields to offer. Though the migration is pretty straightforward there are certain things that should be taken care of after migration.
On this page:
During the migration from 1.x to 2.x
An upgrade task is run to copy
- Transition names or IDs provided under
@Transition Id
or@TransitionName
tags toTransition(s) to look for
field of the custom field configuration - Transition execution details provided under
@Execution
toTransition Execution
field of the custom field configuration - Format provided under the
@@Format tag
toDate Format
field of the custom field configuration - Format provided under the
@@ColFormat
tag toDate Column Format
field of the custom field configuration - Field name provided under
@@Field
tag to theField to look for
field of the custom field configuration
and all the above-mentioned tags are commented with a warning and are ignored in 2.x.
Post-migration from 1.x to 2.x
It is suggested to perform a non-regression testing before starting to take advantage of the new features in the add-on.
The calculated fields with BeanShell scripts inside the field's Description use the legacy script as long as you don't save the new configuration. To save the new configuration;
- Locate the custom field on the Custom Fields administration page.
- Click on the cog wheel and click on
Configure
- Click on
Edit Groovy Formula/Edit Format Expression.
- The Formula under the
@@Formula
tag will be copied to theGroovy formula.
- Click on
Save.
When you save the Groovy formula
or Format Expression
:
- The script will be converted to Groovy language and will be stored, upon saving, outside of the field's Description.
- The BeanShell scripts are commented with a warning and ignored in 2.x.
While Groovy is generally compatible with the BeanShell language, some scripts might need to be adjusted. Here are a few syntaxes of BeanShell scripts that you might want to modify to make them Groovy compatible. We strongly encourage you to test your script before saving, using the "Test groovy script" button at the top of the editor.
Description | Example | Replace with |
---|---|---|
You can define a method implicitly in BeanShell. But the Groovy interpreter considers it as a Closure. | For example: add( int a, int b ) { return a + b; } foo = add(1, 2); return foo; // 3 returns a compilation error | You need to define the method explicitly as: def add( int a, int b ) { return a + b; } foo = add(1, 2); return foo; returns 3 |
Unsupported commands - unset(), invoke() | int a; a == void; // true a=5; unset("a"); // note the quotes a == void; returns a def invoke( String methodName, Object [] arguments ) { "You invoked the method: "+ methodName; } //invoke() will be called to handle noSuchMethod() noSuchMethod("foo"); returns a |