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

import org.huihoo.workflow.WorkflowComplexComponent;
import org.huihoo.workflow.xpdl.activity.SubFlowImplementation;
import org.huihoo.workflow.xpdl.activity.ToolImplementation;

public class XPDLScope
{
	public static String extractScope(WorkflowComplexComponent comp)
	{
		String scope = XPDLSchema.SCOPE_PACKAGE;
		if (comp instanceof WorkflowPackage)
		{
			scope = XPDLSchema.SCOPE_PACKAGE;
		}
		else if (comp instanceof WorkflowProcess)
		{
			scope = XPDLSchema.SCOPE_PROCESS;
		}
		else if (comp instanceof WorkflowApplication)
		{
			scope = XPDLSchema.SCOPE_APPLICATION;
		}
		else if (comp instanceof WorkflowActivity)
		{
			scope = XPDLSchema.SCOPE_ACTIVITY;
		}
		else if (comp instanceof WorkflowTransition)
		{
			scope = XPDLSchema.SCOPE_TRANSITION;
		}
		else if (comp instanceof SubFlowImplementation)
		{
			scope = XPDLSchema.SCOPE_SUBFLOW;
		}
		else if (comp instanceof ToolImplementation)
		{
			scope = XPDLSchema.SCOPE_TOOL;
		}
		else if (comp instanceof WorkflowParameter)
		{
			scope = XPDLSchema.SCOPE_DATAFIELD;
		}

		return scope;
	}
}
