Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
You should get "BUILD SUCCESS" message shown in your terminal and a "beanshell_hash_variable" folder created in "plugins" folder.
Open the maven project with your favour IDE. I will be using NetBeans.
Create a "BeanShellHashVariable" class under "org.joget.tutorial" package.
Then, based on Hash Variable Plugin document, we will have to extends org.joget.apps.app.model.DefaultHashVariablePlugin abstract class.
Let implement all the abstract methods. We will using AppPluginUtil.getMessage method to support i18n and using constant variable MESSAGE_PATH for message resource bundle directory.
Code Block | ||||
---|---|---|---|---|
| ||||
package org.joget.tutorial;
import org.joget.apps.app.model.DefaultHashVariablePlugin;
import org.joget.apps.app.service.AppPluginUtil;
public class BeanShellHashVariable extends DefaultHashVariablePlugin {
private final static String MESSAGE_PATH = "message/BeanShellHashVariable";
public String getName() {
return "BeanShellHashVariable";
}
public String getVersion() {
return "5.0.0";
}
public String getClassName() {
return getClass().getName();
}
public String getLabel() {
//support i18n
return AppPluginUtil.getMessage("org.joget.tutorial.BeanShellHashVariable.pluginLabel", getClassName(), MESSAGE_PATH);
}
public String getDescription() {
//support i18n
return AppPluginUtil.getMessage("org.joget.tutorial.BeanShellHashVariable.pluginDesc", getClassName(), MESSAGE_PATH);
}
public String getPropertyOptions() {
//Hash variable plugin do not support property options
return "";
}
public String getPrefix() {
return "beanshell";
}
public String processHashVariable(String variableKey) {
throw new UnsupportedOperationException("Not supported yet.");
}
} |
Now, let focus on the main method of our Hash Variable plugin which is processHashVariable.