Description

ลักษณะ

Code Sample

ตัวอย่างโค้ด

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

Utility method to retrieve the ApplicationContext of the system

วิธีการ Utility เพื่อดึง 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)

Method to retrieve the final plugin properties value by passing the configured properties to override the default plugin properties in an App

วิธีการดึงค่าคุณสมบัติปลั๊กอินสุดท้ายโดยส่งผ่านคุณสมบัติที่กำหนดค่าเพื่อแทนที่คุณสมบัติปลั๊กอินเริ่มต้นในแอพ

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)

Method to retrieve the final plugin properties value by passing the configured properties to override the default plugin properties in an App.

Options to pass in WorkflowAssignment object for Hash Variable parsing.

วิธีการดึงค่าคุณสมบัติปลั๊กอินสุดท้ายโดยส่งผ่านคุณสมบัติที่กำหนดค่าเพื่อแทนที่คุณสมบัติปลั๊กอินเริ่มต้นในแอพ

ตัวเลือกที่จะผ่านในวัตถุ WorkflowAssignment สำหรับการแยกตัวแปร Hash

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)

Method to retrieve the final plugin properties value by passing the configured properties to override the default plugin properties in an App.

Options to pass in WorkflowAssignment object for Hash Variable parsing.

วิธีการดึงค่าคุณสมบัติปลั๊กอินสุดท้ายโดยส่งผ่านคุณสมบัติที่กำหนดค่าเพื่อแทนที่คุณสมบัติปลั๊กอินเริ่มต้นในแอพ

ตัวเลือกที่จะผ่านในวัตถุ WorkflowAssignment สำหรับการแยกตัวแปร Hash

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

Method to get a message from a plugin messages bundle

วิธีการรับข้อความจากชุดรวมข้อความปลั๊กอิน