/*
 * 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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import workflow.wfmc.xpdl.WorkflowActivity;
import workflow.wfmc.xpdl.WorkflowProcess;
import workflow.wfmc.xpdl.WorkflowTransition;
import workflow.wfmc.xpdl.activity.ActivityType;
import workflow.wfmc.xpdl.activity.JoinType;
import workflow.wfmc.xpdl.activity.PerformerType;
import workflow.wfmc.xpdl.util.Duration;
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 LiveActivity extends ProcessElement
{
	//store uuid(@link uuid) in list 
	 private List inTransitions=new ArrayList();
	 private List outTransitions=new ArrayList();     
  
	 private PerformerType performerType;
	 private JoinType joinType;
   private ActivityType activityType;
   
	 private Duration  duration; 
  
	 //store uuid(@link uuid) in list 
	 private List      performers=new ArrayList(0);

	 private Map attributes=new HashMap();
	 
	public LiveActivity()
	{
	}
	
	public LiveActivity(WorkflowActivity workflowActivity)
	{
		super(workflowActivity);
		
		WorkflowProcess workflowProcess=workflowActivity.getWorkflowProcess();
		this.packageID=workflowProcess.getWorkflowPackage().getUUID();
		this.processID=workflowProcess.getUUID();
		
		List wfo_inTransitions=workflowActivity.getInTransitions();
		WorkflowTransition transition=null;
		
		for(int i=0;i<wfo_inTransitions.size();++i)
		{
			transition=(WorkflowTransition)wfo_inTransitions.get(i);
			inTransitions.add(transition.getUUID());
		}
	
		List wfo_outTransitions=workflowActivity.getOutTransitions();
		
		for(int i=0;i<wfo_outTransitions.size();++i)
		{
			transition=(WorkflowTransition)wfo_outTransitions.get(i);
			outTransitions.add(transition.getUUID());
		}
			
		this.performerType=workflowActivity.getPerformerType();
		this.joinType=workflowActivity.getJoinType();
		this.activityType=workflowActivity.getActivityType();
		
		this.performers=workflowActivity.getPerformers();
		this.attributes=workflowActivity.getExtendedAttributes();
		
	}
  
	 public Duration getDuration()
	 {
		 return (this.duration);
	 }

	 public void setDuration(String duration_)
	 {
		 this.duration=new Duration(duration_);
	 }

	 public List getInTransitions()
	 {
		 return (this.inTransitions);
	 }

	 public List getOutTransitions()
	 {
		 return (this.outTransitions);
	 }

	 public JoinType getJoinType()
	 {
		 return (this.joinType);
	 }

	public ActivityType getActivityType()
	{
		return (this.activityType);
	}
	
	 public List getPerformers()
	 {
		 return (this.performers);
	 }
  
	 public PerformerType getPerformerType()
	 {
		 return (this.performerType);
	 }

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