package com.company.plugin.test; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import org.joget.commons.util.LogUtil; import org.joget.directory.model.User; import org.joget.plugin.base.ApplicationPlugin; import org.joget.plugin.base.DefaultPlugin; import org.joget.plugin.base.PluginException; import org.joget.plugin.base.PluginManager; import org.joget.plugin.base.PluginProperty; import org.joget.workflow.model.WorkflowAssignment; import org.joget.workflow.model.WorkflowProcess; import org.joget.workflow.model.service.WorkflowManager; import org.joget.workflow.util.WorkflowUtil; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; public class MyPlugin extends DefaultPlugin implements ApplicationPlugin { public String getName() { return "MyPlugin"; } public String getDescription() { return "Plugin Development Testing..."; } public String getVersion() { return "1.0.0"; } public PluginProperty[] getPluginProperties() { PluginProperty[] properties = new PluginProperty[] { /*new PluginProperty("username", "SMTP Username", PluginProperty.TYPE_TEXTFIELD, null, null), new PluginProperty("password", "SMTP Password", PluginProperty.TYPE_PASSWORD, null, null)*/ new PluginProperty("reqdetail", "Enter Request details", PluginProperty.TYPE_TEXTFIELD, null, null) }; return properties; } public Object execute(Map properties) { Object result = null; PluginManager pluginManager = (PluginManager) properties.get("pluginManager"); WorkflowAssignment wfAssignment = (WorkflowAssignment) properties.get("workflowAssignment"); try { System.out.println("********************************************************"); System.out.println("********************************************************"); System.out.println("Testing the sample plugin...."); int x=100, y=10; int z=x+y; String reqDetail = (String) properties.get("reqdetail"); System.out.println("Value of Z from plugin : "+z); String a="Test ",b="Plugin"; String c=a+b; System.out.println("Value of C from plugin : "+c); System.out.println("Input value from plugin : "+reqDetail); /*Getting Process details*/ String processDefId=wfAssignment.getProcessDefId(); String processId=wfAssignment.getProcessId(); String activityDefId=wfAssignment.getActivityDefId(); String activityId=wfAssignment.getActivityId(); System.out.println("processDefId : "+processDefId); System.out.println("processId : "+processId); System.out.println("activityDefId : "+activityDefId); System.out.println("activityId : "+activityId); System.out.println("End of Testing the sample plugin...."); System.out.println("********************************************************"); System.out.println("********************************************************"); return result; } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.WARNING, "Error executing plugin", e); return null; } } }