//----------------------------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;

public abstract class WorkflowSimpleComponent  implements WorkflowComponent
{
	protected String uuid;
	protected String name;
	protected String description;

	/** 
	 * Construct a new WorkflowComponenet.
	 */
	protected WorkflowSimpleComponent()
	{
		this(null,null);
	}
	
	/** 
	 * Construct a new WorkflowComponenet.
	 *
	 * @param uuid_ The element ID
	 * @param name The element name
	 */
	protected WorkflowSimpleComponent(String uuid, String name)
	{
		this(uuid, name, null);
	}

	/** 
	 * Construct a new WorkflowComponenet.
	 *
	 * @param uuid        The element ID
	 * @param name        The element name
	 * @param description The element description
	 */
	protected WorkflowSimpleComponent(String uuid, String name, String description)
	{
		this.uuid = uuid;
		this.name = name;
		this.description = description;
	}
	/** Get the org.huihoo.workflow element's ID.
	
		@return The ID
	*/

	public String getUUID()
	{
		return uuid;
	}

	/** set the element's unique ID.
	
		@param uuid The new unique ID
	*/

	public void setUUID(String uuid)
	{
		if (uuid == null)
		{
			throw new IllegalArgumentException(" ID cannot be null {"+getClass()+"}");
		}
		this.uuid = uuid;
	}

	/** Get the  element's name.
	 *  @return The name
	 */

	public String getName()
	{
		return name;
	}

	/** Set the org.huihoo.workflow element's name.
	
		@param name The new name
	*/

	public void setName(String name)
	{
		this.name = name;
	}

	/** Get the org.huihoo.workflow element's description.
	
		@return The description
	*/

	public String getDescription()
	{
		return description;
	}

	/** Set the org.huihoo.workflow element's description.
	
		@param description The new description
	*/

	public void setDescription(String description)
	{
		this.description = description;
	}
	
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}

		if (obj instanceof WorkflowSimpleComponent)
		{
			WorkflowSimpleComponent anotherSC = (WorkflowSimpleComponent) obj;

			if (uuid!=null && uuid.equals(anotherSC.getUUID()))
			{
				return true;
			}
		}

		return false;
	}
}
