Joget DX Beta Available for Download

Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.

Page tree
Skip to end of metadata
Go to start of metadata

描述

  • org.joget.apps.app.service.AppPluginUtil
  • 在wflow-core模块下
  • 检索插件属性值和i18n消息的实用类 

样例代码

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);

方法

getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()

检索系统的 ApplicationContext 对象

getDefaultProperties
public static java.util.Map getDefaultProperties(org.joget.plugin.base.Plugin plugin, java.lang.String properties, org.joget.apps.app.model.AppDefinition appDef)

通过传递配置的属性来覆盖应用程序中的默认插件属性来检索最终插件属性值的方法

getDefaultProperties
public static java.util.Map getDefaultProperties(org.joget.plugin.base.Plugin plugin, java.lang.String properties, org.joget.apps.app.model.AppDefinition appDef, org.joget.workflow.model.WorkflowAssignment assignment)

通过传递配置的属性来覆盖应用程序中的默认插件属性来检索最终插件属性值的方法。

传递用于HASH变量解析的WorkflowAssignment对象的选项。

getDefaultProperties
public static java.util.Map getDefaultProperties(org.joget.plugin.base.Plugin plugin, java.util.Map propertyMap, org.joget.apps.app.model.AppDefinition appDef, org.joget.workflow.model.WorkflowAssignment assignment)

通过传递配置的属性来覆盖应用程序中的默认插件属性来检索最终插件属性值的方法。

传递用于HASH变量解析的WorkflowAssignment对象的选项。

getMessage
public static java.lang.String getMessage(java.lang.String key, java.lang.String pluginName, java.lang.String translationPath)

获取插件信息的方法

  • No labels