jadex.bdibpmn.handler.EventIntermediateMessageActivityHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-kernel-bdibpmn Show documentation
Show all versions of jadex-kernel-bdibpmn Show documentation
The Jadex BDI-BPMN kernel allows to use BPMN
workflow descriptions as alternative
description for BDI agent plans.
package jadex.bdibpmn.handler;
import jadex.bdi.model.OAVBDIMetaModel;
import jadex.bdi.runtime.IMessageEvent;
import jadex.bdi.runtime.impl.flyweights.MessageEventFlyweight;
import jadex.bdi.runtime.interpreter.OAVBDIRuntimeModel;
import jadex.bdibpmn.BpmnPlanBodyInstance;
import jadex.bpmn.model.MActivity;
import jadex.bpmn.runtime.BpmnInterpreter;
import jadex.bpmn.runtime.ProcessThread;
import jadex.bpmn.runtime.handler.DefaultActivityHandler;
import jadex.commons.IFilter;
import jadex.rules.state.IOAVState;
/**
* Handler for message events.
*/
public class EventIntermediateMessageActivityHandler extends DefaultActivityHandler
{
//-------- constants --------
/** The isThrowing property name (distinguishes send/receive events). */
public static final String PROPERTY_THROWING = "isThrowing";
//-------- methods --------
/**
* Execute an activity.
* @param activity The activity to execute.
* @param instance The process instance.
* @param thread The process thread.
*/
public void execute(final MActivity activity, final BpmnInterpreter instance, final ProcessThread thread)
{
boolean send = thread.hasPropertyValue(PROPERTY_THROWING)? ((Boolean)thread.getPropertyValue(PROPERTY_THROWING)).booleanValue() : false;
// System.out.println("message: "+instance+", "+send+", "+activity);
if(send)
{
String type = (String)thread.getPropertyValue("type", activity);
BpmnPlanBodyInstance inst = (BpmnPlanBodyInstance)instance;
IMessageEvent me = inst.createMessageEvent(type);
String[] params = me.getMessageType().getParameterNames();
for(int i=0; params!=null && i