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

import workflow.wfmc.pm.Participant;
import workflow.wfmc.rtm.WorkflowCase;
import workflow.wfmc.rtm.WorkflowWork;
import workflow.wfmc.xpdl.WorkflowActivity;
import workflow.wfmc.xpdl.WorkflowProcess;
import workflow.wfmc.xpdl.activity.Implementation;
import workflow.wfmc.xpdl.activity.PageImplementation;
import workflow.live.CaseElement;

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class LiveWork extends CaseElement
{
	private String activityProcessID;
	private String activityID;
	
	private String performerID;
  
	private java.util.Date arriveTime;
	private java.util.Date acceptTime;
	private java.util.Date dispatchTime;
  
	private String entityID;  
  private String pageURL;
  
	public LiveWork(WorkflowWork workflowWork)
	{
		super(workflowWork);
		
		WorkflowCase workflowCase=workflowWork.getWorkflowCase();
		WorkflowProcess workflowProcess=workflowCase.getWorkflowProcess();
		this.caseID=workflowCase.getUUID();
		this.packageID=workflowProcess.getWorkflowPackage().getUUID();
		this.processID=workflowProcess.getUUID();
		
		WorkflowActivity workflowActivity=workflowWork.getWorkflowActivity();
		this.activityProcessID=workflowActivity.getWorkflowProcess().getUUID();
		this.activityID=workflowActivity.getUUID();
		
		Participant participant=workflowWork.getPerformer();	
		this.performerID=(participant==null?null:participant.getUUID());
			
		this.arriveTime=workflowWork.getArriveTime();
		this.acceptTime=workflowWork.getAcceptTime();
		this.dispatchTime=workflowWork.getDispatchTime();
		
		Implementation impl=workflowActivity.getImplementation();
		if(impl instanceof PageImplementation)
		{
			this.pageURL=((PageImplementation)impl).getPageURL();
		}
	}
	
	public String  getActivityProcessID()
	{
		return activityProcessID;
	}
	
	public String  getActivityID()
	{
		return activityID;
	}
	
	public String getPerformerID()
	{
		return performerID;
	}
  
	public java.util.Date       getArriveTime()
	{
		return this.arriveTime;
	}

	public java.util.Date       getAcceptTime()  
	{
		return this.acceptTime;
	}

	public java.util.Date       getDispatchTime()
	{
		return this.dispatchTime;
	}
  
	public String               getEntityID()
	{
		return entityID;
	}
	
	public String    getPageURL()
	{
		return pageURL;
	}
}
