//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010 huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/willow
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : willow@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.workflow.event;

import org.huihoo.workflow.server.WorkflowWork;

public final class JoinEventGuard
{
	private Exception event_exception;

	private boolean is_first_workitem;
	private boolean is_last_workitem;

	//汇聚分发准备汇聚的工作项UUID
	private String joinwork_uuid;

	private WorkflowWork to_dispatched_work;

	//本次分发之前活动(WorkflowActivity)触发的分发次数（不包括本次）
	private int activity_dispatch_count = 0;

	public JoinEventGuard(WorkflowWork dispatched_work)
	{
		this.to_dispatched_work = dispatched_work;
	}

	public WorkflowWork getWorkflowWork()
	{
		return to_dispatched_work;
	}

	public void setJoinException(Exception exception)
	{
		this.event_exception = exception;
	}

	public Exception getJoinException()
	{
		return event_exception;
	}

	public void setFirst(boolean first)
	{
		is_first_workitem = first;
	}
	public boolean isFirst()
	{
		return is_first_workitem;
	}

	public void setLast(boolean last)
	{
		is_last_workitem = last;
	}
	public boolean isLast()
	{
		return is_last_workitem;
	}

	public void setJoinWorkUUID(String join_work_id)
	{
		this.joinwork_uuid = join_work_id;
	}
	public String getJoinWorkUUID()
	{
		return joinwork_uuid;
	}

	public int getDispatchCount()
	{
		return activity_dispatch_count;
	}

	public void setDispatchCount(int update_BatchNo)
	{
		this.activity_dispatch_count = update_BatchNo;
	}

	public String toString()
	{
		return "JoinEventGuard@{join_work_uuid="
			+ joinwork_uuid
			+ ",activity_dispatch_counter="
			+ activity_dispatch_count
			+ ",first="
			+ is_first_workitem
			+ ",last="
			+ is_last_workitem
			+ "}";
	}
}
