- org.joget.apps.app.service.AppPluginUtil
- Under wflow-core module
- Utility class to retrieve plugin propertise value and i18n message
...
Code Block |
---|
import java.util.Map;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import org.joget.apps.app.service.AppUtil;
import org.joget.plugin.base.Plugin;
import org.joget.plugin.base.PluginManager;
import org.joget.workflow.util.WorkflowUtil;
PluginManager pluginManager = (PluginManager) AppUtil.getApplicationContext().getBean("pluginManager");
String pluginName = "org.joget.apps.app.lib.EmailTool";
Plugin plugin = pluginManager.getPlugin(pluginName);
AppDefinition appDef = AppUtil.getCurrentAppDefinition();
Map propertiesMap = new HashMap();
propertiesMap.put("pluginManager", pluginManager);
propertiesMap.put("appDef", appDef);
// add HttpServletRequest into the property map
try {
HttpServletRequest request = WorkflowUtil.getHttpServletRequest();
if (request != null) {
propertiesMap.put("request", request);
}
} catch (Throwable e) {
// ignore if class is not found
}
//Email tool properties
propertiesMap.put("to", "sample@joget.org");
propertiesMap.put("subject", "Test Email");
propertiesMap.put("message", "This is just a test email");
propertiesMap = AppPluginUtil.getDefaultProperties(plugin, propertiesMap, appDef, null);
if (plugin instanceof PropertyEditable) {
((PropertyEditable) plugin).setProperties(propertiesMap);
}
//send email
plugin.execute(propertiesMap); |
Methods
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()
...