/*
 * Created on 2004-2-15
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package workflow.wfmc.xpdl.activity;

import workflow.WorkflowInterface;

/**
 * @author zosatapo
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public final class PerformerType implements WorkflowInterface
{
	/**
	 * no human performer . computer performs work automatically
	 */
	public final static PerformerType PERFORMER_AUTOMATION        = new PerformerType("PERFORMER_AUTOMATION");
	
	public final static PerformerType PERFORMER_PARTICIPANT_BASED = new PerformerType("PERFORMER_PARTICIPANT_BASED");
	public final static PerformerType PERFORMER_DEPARTMENT_BASED  = new PerformerType("PERFORMER_DEPARTMENT_BASED");
	public final static PerformerType PERFORMER_RANK_BASED        = new PerformerType("PERFORMER_RANK_BASED");
	public final static PerformerType PERFORMER_CATEGORY_BASED    = new PerformerType("PERFORMER_CATEGORY_BASED");
	public final static PerformerType PERFORMER_GROUP_BASED       = new PerformerType("PERFORMER_GROUP_BASED");
	public final static PerformerType PERFORMER_ROLE_BASED        = new PerformerType("PERFORMER_ROLE_BASED");
	public final static PerformerType PERFORMER_SELECTOR_BASED    = new PerformerType("PERFORMER_SELECTOR_BASED");
	
	private String type;

	private PerformerType(String type)
	{
		this.type = type;
	}

	public String getType()
	{
		return type;
	}

	public static PerformerType parse(String type)
	{	
		if ("PERFORMER_AUTOMATION".equals(type))
		{
			return PERFORMER_AUTOMATION;
		}
		else if ("PERFORMER_PARTICIPANT_BASED".equals(type))
		{
			return PERFORMER_PARTICIPANT_BASED;
		}
		else if ("PERFORMER_DEPARTMENT_BASED".equals(type))
		{
			return PERFORMER_DEPARTMENT_BASED;
		}
		else if ("PERFORMER_RANK_BASED".equals(type))
		{
			return PERFORMER_RANK_BASED;
		}
		else if ("PERFORMER_CATEGORY_BASED".equals(type))
		{
			return PERFORMER_CATEGORY_BASED;
		}
		else if ("PERFORMER_GROUP_BASED".equals(type))
		{
			return PERFORMER_GROUP_BASED;
		}
		else if ("PERFORMER_ROLE_BASED".equals(type))
		{
			return PERFORMER_ROLE_BASED;
		}
		else if ("PERFORMER_SELECTOR_BASED".equals(type))
		{
			return PERFORMER_SELECTOR_BASED;
		}		
		//default value is PERFORMER_AUTOMATION

		return PERFORMER_AUTOMATION;
	}

	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}

		if (obj instanceof PerformerType)
		{
			PerformerType anotherPT = (PerformerType) obj;

			if (anotherPT.getType().equals(type))
			{
				return true;
			}
		}

		return false;
	}

	public String toString()
	{
		return "PerformerType@" + type;
	}
}
