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

import java.util.HashMap;
import java.util.Map;

import workflow.wfmc.xpdl.WorkflowActivity;
import workflow.wfmc.xpdl.WorkflowProcess;
import workflow.wfmc.xpdl.WorkflowTransition;
import workflow.live.ProcessElement;

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class LiveTransition extends ProcessElement
{
	public final static int DIRECTION_FORWARD   = 1;
	public final static int DIRECTION_BACKWARD  = DIRECTION_FORWARD+1; 
	
		private String fromActivityID;
		private String toActivityID;
  
		private int direction;
		private String condition;
		private Map    attributes=new HashMap();
  
  	public LiveTransition(){}
  	
  	public LiveTransition(WorkflowTransition workflowTransition)
  	{
  		super(workflowTransition);
  		
  		WorkflowProcess workflowProcess=workflowTransition.getWorkflowProcess();
  		this.packageID=workflowProcess.getWorkflowPackage().getUUID();
  		this.processID=workflowProcess.getUUID();
  		
  		WorkflowActivity tempActivity=workflowTransition.getFromWorkflowActivity();
			fromActivityID=(tempActivity==null?null:tempActivity.getUUID());
			
			tempActivity=workflowTransition.getToWorkflowActivity();
			toActivityID=(tempActivity==null?null:tempActivity.getUUID());
			
			this.direction=workflowTransition.getDirection();
			this.condition=workflowTransition.getScriptFileName();
			this.attributes=workflowTransition.getExtendedAttributes();
			
  	}
  	
		public int getDirection()
		{
			return (this.direction);
		}

		public String getFromActivityID()
		{
			return (this.fromActivityID);
		}

		public String getToActivityID()
		{
			return (this.toActivityID);
		}

		public String getScriptFileName()
		{
			return (this.condition);    
		}


		public Map getExtendedAttributes()
		{
			return (this.attributes);
		}
}
