//----------------------------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.coreImpl.store;

import org.huihoo.workflow.WorkflowException;
import org.huihoo.workflow.server.WorkflowCase;
import org.huihoo.workflow.server.WorkflowWork;
import org.huihoo.workflow.store.WorkflowTemplate;
import org.huihoo.workflow.store.WorkflowUUIDGenerator;
import org.huihoo.workflow.util.ObjectUUID;
import org.huihoo.workflow.xpdl.WorkflowProcess;

public class WorkflowUUIDGeneratorImpl implements WorkflowUUIDGenerator
{
	protected WorkflowTemplate workflowimpl;

	public WorkflowTemplate getWorkflowTemplate()
	{
		return workflowimpl;
	}

	public void setWorkflowTemplate(WorkflowTemplate workflowimpl)
	{
		this.workflowimpl = workflowimpl;
	}

	public WorkflowUUIDGeneratorImpl(WorkflowTemplate workflowimpl)
	{
		setWorkflowTemplate(workflowimpl);
	}

	public String nextCaseUUID(WorkflowProcess workflowprocess) throws WorkflowException
	{
		return new ObjectUUID().toString()+ ":" + WorkflowUUIDGenerator.CASE_UUID;
	}

	public String nextWorkUUID(WorkflowCase workflowCase) throws WorkflowException
	{
		return new ObjectUUID().toString()+ ":" + WorkflowUUIDGenerator.WORK_UUID;
	}

	public String nextPathUUID(WorkflowCase workflowCase) throws WorkflowException
	{
		return new ObjectUUID().toString()+ ":" + WorkflowUUIDGenerator.PATH_UUID;
	}

	public String nextBatchUUID(WorkflowWork workItem) throws WorkflowException
	{
		return new ObjectUUID().toString()+ ":" + WorkflowUUIDGenerator.BATCH_UUID;
	}
}
