jadex.bpmn.runtime.handler.AbstractEventIntermediateTimerActivityHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-kernel-bpmn Show documentation
Show all versions of jadex-kernel-bpmn Show documentation
The Jadex BPMN kernel provides a workflow kernel for the standardized business process modeling notation. The kernel relies on annotated BPMN diagrams, which include detailed execution information.
package jadex.bpmn.runtime.handler;
import jadex.bpmn.model.MActivity;
import jadex.bpmn.runtime.ProcessThread;
import jadex.bridge.IInternalAccess;
import jadex.commons.IFilter;
/**
* Abstract handler for timing events.
* Can be subclassed by platform-specific implementations.
*/
public abstract class AbstractEventIntermediateTimerActivityHandler extends DefaultActivityHandler
{
public static final int TICK_TIMER = -2;
public static final String TIMER_EVENT = "timer-event";
/**
* Execute an activity.
* @param activity The activity to execute.
* @param instance The process instance.
* @param thread The process thread.
*/
public void execute(MActivity activity, IInternalAccess instance, ProcessThread thread)
{
// Number dur = (Number)getPropertyValue(activity, instance, thread, "duration");
Object d = thread.getPropertyValue("duration", activity); // does not wait if initial cron time pattern was specified "* * * * *"
Number dur = d instanceof Number? (Number)d: null;
Boolean tmp = (Boolean)thread.getPropertyValue("tick", activity);
boolean tick = tmp!=null? tmp.booleanValue(): false;
long duration = dur==null? tick? TICK_TIMER: -1: dur.longValue();
// thread.setWaitingState(ProcessThread.WAITING_FOR_TIME);
thread.setWaiting(true);
thread.setWaitFilter(new IFilter