Package org.huihoo.workflow.impl.store.spi

Source Code of org.huihoo.workflow.impl.store.spi.SpiCaseDatabaseImpl

//----------------------------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.impl.store.spi;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import org.huihoo.workflow.WorkflowException;
import org.huihoo.workflow.store.persistent.PrimaryKey;
import org.huihoo.workflow.store.persistent.UserTransaction;
import org.huihoo.workflow.store.security.WorkflowCaseValidator;
import org.huihoo.workflow.store.security.WorkflowWorkValidator;
import org.huihoo.workflow.store.spi.AbstractSpiDatabase;
import org.huihoo.workflow.store.spi.SpiCaseDatabase;
import org.huihoo.workflow.store.spi.SpiCaseIdGenerator;
import org.huihoo.workflow.store.spi.SpiWorkflowDispatcher;
import org.huihoo.workflow.usermodel.WorkflowParticipant;
import org.huihoo.workflow.runtime.Constants;
import org.huihoo.workflow.runtime.WorkflowCase;
import org.huihoo.workflow.runtime.WorkflowPath;
import org.huihoo.workflow.runtime.WorkflowWork;
import org.huihoo.workflow.xpdl.WorkflowActivity;
import org.huihoo.workflow.xpdl.WorkflowParameter;
import org.huihoo.workflow.xpdl.WorkflowProcess;

import org.huihoo.workflow.impl.store.UserTransactionImpl;
import org.huihoo.workflow.impl.store.security.DefaultCaseValidator;
import org.huihoo.workflow.impl.store.security.DefaultWorkValidator;
import com.zosatapo.commons.store.ConnUtils;
/**
* @author zosatapo
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class SpiCaseDatabaseImpl extends AbstractSpiDatabase implements SpiCaseDatabase
{
 
  private InternalCaseDatabase gCaseDBImpl;
 
  private WorkflowCaseValidator caseValidator;
  private WorkflowWorkValidator workValidator;
 
  private SpiCaseIdGenerator caseIdGenerator;
  private SpiWorkflowDispatcher dispatcher;
 
  public SpiCaseDatabaseImpl()
  { 
    this.gCaseDBImpl = new InternalCaseDatabase();
   
    this.caseValidator=new DefaultCaseValidator();
    this.workValidator=new DefaultWorkValidator();
   
    this.caseIdGenerator=new SpiCaseIdGeneratorImpl();
    this.dispatcher=new SpiWorkflowDispatcherImpl();
   
  }
 
  public SpiWorkflowDispatcher getWorkflowDispatcher()
  {
    return this.dispatcher;
  }
  public void  setWorkflowDispatcher(SpiWorkflowDispatcher dispatcher)
  {
    this.dispatcher=dispatcher;
  }
 
  public WorkflowCaseValidator getWorkflowCaseValidator()
  {
    return caseValidator;
  }
  public void setWorkflowCaseValidator(WorkflowCaseValidator caseValidator)
  {
    this.caseValidator=caseValidator;
  }
  public WorkflowWorkValidator getWorkflowWorkValidator()
  {
    return this.workValidator;
  }
  public void setWorkflowWorkValidator(WorkflowWorkValidator workValidator)
  {
    this.workValidator=workValidator;
  }
 
  public SpiCaseIdGenerator getCaseIdGenerator()
  {
    return caseIdGenerator;
  }

  public void setCaseIdGenerator(SpiCaseIdGenerator caseIdGenerator_)
  {
    this.caseIdGenerator = caseIdGenerator_;
  }

  //=======================================================================
  //=======================================================================

  public String createWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant creator, Date creationTime, String primaryKey)
    throws WorkflowException
  {
    return createWorkflowCase(workflowProcess,creator, creationTime, primaryKey, "", "");
  }
  public String createWorkflowCase(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowParticipant creator,
    Date creationTime,
    String primaryKey)
    throws WorkflowException
  {
    return createWorkflowCase(workflowProcess,userTransaction, creator, creationTime, primaryKey, "", "");
  }

  public String createWorkflowCase(WorkflowProcess workflowProcess,
    WorkflowParticipant creator,
    Date creationTime,
    String primaryKey,
    String name)
    throws WorkflowException
  {
    return createWorkflowCase(workflowProcess,creator, creationTime, primaryKey, name, "");
  }

  public String createWorkflowCase(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowParticipant creator,
    Date creationTime,
    String primaryKey,
    String name)
    throws WorkflowException
  {
    return createWorkflowCase(workflowProcess,userTransaction, creator, creationTime, primaryKey, name, "");
  }
  public String createWorkflowCase(WorkflowProcess workflowProcess,
    WorkflowParticipant creator,
    Date creationTime,
    String primaryKey,
    String name,
    String description)
    throws WorkflowException
  {   
    Connection conn = null;
    String caseId = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      caseId =
        gCaseDBImpl.createCase_impl(
        this,workflowProcess,
          conn,
          true,
          creator,
          creationTime,
          primaryKey,
          name,
          description);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
   
    return caseId;
  }
  public String createWorkflowCase(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowParticipant creator,
    Date creationTime,
    String primaryKey,
    String name,
    String description)
    throws WorkflowException
  {
    Connection conn = null;
    String caseId = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    caseId =
      gCaseDBImpl.createCase_impl(
      this,workflowProcess,
        conn,
        false,
        creator,
        creationTime,
        primaryKey,
        name,
        description);
    return caseId;
  }

  public WorkflowCase findWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,String caseId) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.findCase_impl(this,workflowProcess,operator,conn, true, caseId, false);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public WorkflowCase findWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,PrimaryKey primaryKey) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.findCase_impl(this,workflowProcess,operator,conn, true, primaryKey.getUUID(), true);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public List getWorkflowCaseList(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowParticipant creator) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.getCaseList_impl(this,workflowProcess,operator,conn, true, creator);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public WorkflowCase findWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, String caseId)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.findCase_impl(this,workflowProcess,operator,conn, false, caseId, false);
  }
  public WorkflowCase findWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, PrimaryKey primaryKey)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.findCase_impl(this,workflowProcess,operator,conn, false, primaryKey.getUUID(), true);
  }
  public List getWorkflowCaseList(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowParticipant creator)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.getCaseList_impl(this,workflowProcess,operator,conn, false, creator);
  }

  public void updateWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.updateCase_impl(this,workflowProcess,operator,conn, true, workflowCase);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void updateWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.updateCase_impl(this,workflowProcess,operator,conn, false, workflowCase);
  }

  public void deleteWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.deleteCase_impl(this,workflowProcess,operator,conn, true, workflowCase);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void deleteWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.deleteCase_impl(this,workflowProcess,operator,conn, false, workflowCase);
  }

  public void cancelWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, true, workflowCase, Constants.CASE_STATUS_CANCELED);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void cancelWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, false, workflowCase, Constants.CASE_STATUS_CANCELED);
  }
  public void closeWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, true, workflowCase, Constants.CASE_STATUS_CLOSED);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public void closeWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, false, workflowCase, Constants.CASE_STATUS_CLOSED);
  }
  public void suspendWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, true, workflowCase, Constants.CASE_STATUS_SUSPENDED);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void suspendWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, false, workflowCase, Constants.CASE_STATUS_SUSPENDED);
  }
  public void resumeWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, true, workflowCase, Constants.CASE_STATUS_RUNNING);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void resumeWorkflowCase(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowCase workflowCase)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.changeCase_impl(this,workflowProcess,operator,conn, false, workflowCase, Constants.CASE_STATUS_RUNNING);
  }

  public String createWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    WorkflowCase workflowCase,
    WorkflowActivity activity,
    WorkflowParticipant performer,
    Date arriveTime)
    throws WorkflowException
  {
    Connection conn = null;
    String workId = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      workId =
        gCaseDBImpl.createWork_impl(this,workflowProcess,operator,conn, true, workflowCase, activity, performer, arriveTime);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
    return workId;
  }
  public String createWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowActivity activity,
    WorkflowParticipant performer,
    Date arriveTime)
    throws WorkflowException
  {
    Connection conn = null;
    String workId = null;

    conn = (Connection) userTransaction.getStoreConnection().get();
    workId =
      gCaseDBImpl.createWork_impl(this,workflowProcess,operator,conn, false, workflowCase, activity, performer, arriveTime);

    return workId;
  }

  public String createWorkflowSubWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    WorkflowCase workflowCase,
    WorkflowActivity activity,
    WorkflowWork parentWork,
    WorkflowParticipant performer,
    java.util.Date arriveTime)
    throws WorkflowException
  {
    Connection conn = null;
    String workId = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      workId =
        gCaseDBImpl.createSubWork_impl(this,workflowProcess,operator,
          conn,
          true,
          workflowCase,
          activity,
          parentWork,
          performer,
          arriveTime);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
    return workId;
  }
  public String createWorkflowSubWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowActivity activity,
    WorkflowWork parentWork,
    WorkflowParticipant performer,
    java.util.Date arriveTime)
    throws WorkflowException
  {
    Connection conn = null;
    String workId = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    workId =
      gCaseDBImpl.createSubWork_impl(this,workflowProcess,operator,
        conn,
        false,
        workflowCase,
        activity,
        parentWork,
        performer,
        arriveTime);
    return workId;
  }
  public void updateWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowWork workflowWork) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.updateWork_impl(this,workflowProcess,operator,conn, true, workflowWork);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void updateWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowWork workflowWork)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.updateWork_impl(this,workflowProcess,operator,conn, false, workflowWork);
  }

  public void deleteWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowWork workflowWork) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.deleteWork_impl(this,workflowProcess,operator,conn, true, workflowWork);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void deleteWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowWork workflowWork)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.deleteWork_impl(this,workflowProcess,operator,conn, false, workflowWork);
  }
  public WorkflowWork findWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase, String workId)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.findWork_impl(this,workflowProcess,operator,conn, true, workflowCase, workId);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }

  }
  public List getWorkflowWorkList(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowParticipant performer, int itemStatus) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.getWorkList_impl(this,workflowProcess,operator,conn, true, performer, itemStatus);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }

  }
  public List getWorkflowWorkList(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    WorkflowCase workflowCase,
    WorkflowParticipant performer,
    int itemStatus)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.getWorkList_impl(this,workflowProcess,operator,conn, true, workflowCase, performer, itemStatus);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public WorkflowWork findWorkflowWork(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    String workId)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.findWork_impl(this,workflowProcess,operator,conn, false, workflowCase, workId);
  }
  public List getWorkflowWorkList(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowParticipant performer,
    int itemStatus)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.getWorkList_impl(this,workflowProcess,operator,conn, false, performer, itemStatus);
  }
  public List getWorkflowWorkList(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowParticipant performer,
    int itemStatus)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.getWorkList_impl(this,workflowProcess,operator,conn, false, workflowCase, performer, itemStatus);
  }

  public String createWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    WorkflowCase workflowCase,
    WorkflowWork fromWork,
    WorkflowWork toWork,
    String batchNo,
    int eventType)
    throws WorkflowException
  {
    Connection conn = null;
    String pathId = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      pathId =
        gCaseDBImpl.createPath_impl(this,workflowProcess,operator,conn, true, workflowCase, fromWork, toWork, batchNo, eventType);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
    return pathId;
  }
  public String createWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowWork fromWork,
    WorkflowWork toWork,
    String batchNo,
    int eventType)
    throws WorkflowException
  {
    Connection conn = null;
    String pathId = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    pathId =
      gCaseDBImpl.createPath_impl(this,workflowProcess,operator,conn, false, workflowCase, fromWork, toWork, batchNo, eventType);
    return pathId;
  }

  public WorkflowPath findWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase, String pathId)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.findPath_impl(this,workflowProcess,operator,conn, true, workflowCase, pathId);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public List getWorkflowPathList(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowWork workflowWork, boolean isInPath)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      return gCaseDBImpl.getPathList_impl(this,workflowProcess,operator,conn, true, workflowWork, isInPath);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public WorkflowPath findWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    String pathId)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.findPath_impl(this,workflowProcess,operator,conn, false, workflowCase, pathId);
  }

  public List getWorkflowPathList(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowWork workflowWork,
    boolean isInPath)
    throws WorkflowException
  {
    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    return gCaseDBImpl.getPathList_impl(this,workflowProcess,operator,conn, false, workflowWork, isInPath);
  }

  public void deleteWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowPath workflowPath) throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.deletePath_impl(this,workflowProcess,operator,conn, true, workflowPath);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public void deleteWorkflowPath(WorkflowProcess workflowProcess,WorkflowParticipant operator,UserTransaction userTransaction, WorkflowPath workflowPath)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.deletePath_impl(this,workflowProcess,operator,conn, false, workflowPath);
  }

  public void createWorkflowCaseEvent(WorkflowProcess workflowProcess,
    WorkflowCase workflowCase,
    WorkflowParticipant operator,
    Date opTime,
    int eventType)
    throws WorkflowException
  {
    createWorkflowCaseEvent(workflowProcess,workflowCase, operator, opTime, eventType, "");
  }
  public void createWorkflowCaseEvent(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowParticipant operator,
    Date opTime,
    int eventType)
    throws WorkflowException
  {
    createWorkflowCaseEvent(workflowProcess,userTransaction, workflowCase, operator, opTime, eventType, "");
  }
  public void createWorkflowCaseEvent(WorkflowProcess workflowProcess,
    WorkflowCase workflowCase,
    WorkflowParticipant operator,
    Date opTime,
    int eventType,
    String description)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.createCaseEvent_impl(this,workflowProcess,
        conn,
        true,
        workflowCase,
        operator,
        opTime,
        eventType,
        description);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void createWorkflowCaseEvent(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowParticipant operator,
    Date opTime,
    int eventType,
    String description)
    throws WorkflowException
  {
    Connection conn = null;

    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.createCaseEvent_impl(this,workflowProcess,
      conn,
      false,
      workflowCase,
      operator,
      opTime,
      eventType,
      description);
  }
  public void createWorkflowWorkEvent(WorkflowProcess workflowProcess,
    WorkflowWork workflowWork,
    WorkflowParticipant operator,
    Date opTime,
    int eventType)
    throws WorkflowException
  {
    createWorkflowWorkEvent(workflowProcess,workflowWork, operator, opTime, eventType, "");
  }
  public void createWorkflowWorkEvent(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowWork workflowWork,
    WorkflowParticipant operator,
    Date opTime,
    int eventType)
    throws WorkflowException
  {
    createWorkflowWorkEvent(workflowProcess,userTransaction, workflowWork, operator, opTime, eventType, "");
  }
  public void createWorkflowWorkEvent(WorkflowProcess workflowProcess,
    WorkflowWork workflowWork,
    WorkflowParticipant operator,
    Date opTime,
    int eventType,
    String description)
    throws WorkflowException
  {
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.createWorkEvent_impl(this,workflowProcess,
        conn,
        false,
        workflowWork,
        operator,
        opTime,
        eventType,
        description);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void createWorkflowWorkEvent(WorkflowProcess workflowProcess,
    UserTransaction userTransaction,
    WorkflowWork workflowWork,
    WorkflowParticipant operator,
    Date opTime,
    int eventType,
    String description)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.createWorkEvent_impl(this,workflowProcess,
      conn,
      false,
      workflowWork,
      operator,
      opTime,
      eventType,
      description);
  }
  public void createWorkflowParameter(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase, WorkflowParameter parameter)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.createCaseParameter_impl(this,workflowProcess,operator,conn, false, workflowCase, parameter);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }

  public void createWorkflowParameter(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowParameter parameter)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.createCaseParameter_impl(this,workflowProcess,operator,conn, false, workflowCase, parameter);
  }
  public void updateWorkflowParameter(WorkflowProcess workflowProcess,WorkflowParticipant operator,WorkflowCase workflowCase, WorkflowParameter parameter)
    throws WorkflowException
  {
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      gCaseDBImpl.updateCaseParameter_impl(this,workflowProcess,operator,conn, true, workflowCase, parameter);
    }
    catch (SQLException sqlex)
    {
      throw new WorkflowException(sqlex);
    }
  }
  public void updateWorkflowParameter(WorkflowProcess workflowProcess,WorkflowParticipant operator,
    UserTransaction userTransaction,
    WorkflowCase workflowCase,
    WorkflowParameter parameter)
    throws WorkflowException
  {
    Connection conn = null;
    conn = (Connection) userTransaction.getStoreConnection().get();
    gCaseDBImpl.updateCaseParameter_impl(this,workflowProcess,operator,conn, false, workflowCase, parameter);
  }

  public UserTransaction getUserTransaction() throws WorkflowException
  {
    UserTransaction userTransaction = null;
    Connection conn = null;
    try
    {
      conn = ConnUtils.getConnection(getStore());
      conn.setAutoCommit(false);
      //conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
      userTransaction = new UserTransactionImpl(this, conn);
    }
    catch (SQLException sqlex)
    {
      ConnUtils.cleanupNoThrow(conn);
      throw new WorkflowException(sqlex);
    }
    return userTransaction;
  }
 
//------------------------------------------------------------------
//------------------------------------------------------------------ 
  public Object clone() throws CloneNotSupportedException
  {
    SpiCaseDatabaseImpl impl=(SpiCaseDatabaseImpl)super.clone();
   
    if(caseIdGenerator!=null)
    {
      impl.caseIdGenerator=(SpiCaseIdGenerator)caseIdGenerator.clone();
    }
   
    if(caseValidator!=null)
    {
      impl.caseValidator=(WorkflowCaseValidator)caseValidator.clone();
    }
   
    if(workValidator!=null)
    {
      impl.workValidator=(WorkflowWorkValidator)workValidator.clone();
    }
   
    if(dispatcher!=null)
    {
      impl.dispatcher=(SpiWorkflowDispatcher)dispatcher.clone();     
     
      // very important code (fix cloneable implementation limit)
      impl.dispatcher.setCaseDatabase(impl);
    }
    return impl;
  }
}
TOP

Related Classes of org.huihoo.workflow.impl.store.spi.SpiCaseDatabaseImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.