All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdibpmn.handler.EventIntermediateMessageActivityHandler Maven / Gradle / Ivy

Go to download

The Jadex BDI-BPMN kernel allows to use BPMN workflow descriptions as alternative description for BDI agent plans.

There is a newer version: 2.4
Show newest version
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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy