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

jadex.bdibpmn.task.WaitForSubprocessTask 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.task;

import jadex.bpmn.model.task.ITask;
import jadex.bpmn.model.task.ITaskContext;
import jadex.bpmn.task.info.ParameterMetaInfo;
import jadex.bpmn.task.info.TaskMetaInfo;
import jadex.bridge.IInternalAccess;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;

/**
 *  Wait for the subprocess result.
 */
public class WaitForSubprocessTask	implements ITask
{
	/**
	 *  Execute the task.
	 */
	public IFuture execute(ITaskContext context, IInternalAccess instance)
	{
		// todo: ???
		
		IResultFuture	rf = (IResultFuture)context.getParameterValue("resultfuture");
//		listener.resultAvailable(this, rf.getResults());
		return new Future(rf.getResults());
	}
	
	/**
	 *  Compensate in case the task is canceled.
	 *  @return	To be notified, when the compensation has completed.
	 */
	public IFuture cancel(final IInternalAccess instance)
	{
		return IFuture.DONE;
	}
	
	//-------- static methods --------
	
	/**
	 *  Get the meta information about the agent.
	 */
	public static TaskMetaInfo getMetaInfo()
	{
		String desc = "The wait for subprocess task can be used to wait for an existing subprocess to finish.";
		
		ParameterMetaInfo goalmi = new ParameterMetaInfo(ParameterMetaInfo.DIRECTION_IN, 
			IResultFuture.class, "subprocess", null, "The subprocess parameter identifies the subprocess to be waited for.");

		return new TaskMetaInfo(desc, new ParameterMetaInfo[]{goalmi}); 
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy