工作流引擎开发系列三类设计

前面两章讲解了工作流的整体设计和数据库设计,从这章开始就讲类的设计。整体来说我们分为4个部分:数据库访问部分,Activity活动部分,业务接口部分,引擎核心部分和生成待办部分。

一. 数据库访问部分设计. 也就是工作流的底层访问部分。这部分主要是用来操作工作流数据库的,功能点上主要包括:工作流模板信息,工作流活动信息,工作流活动角色信息,工作流活动条件信息,工作流实例信息,工作流实例节点信息,工作流实例节点角色信息,工作流实例条件信息和审批日志。下面是具体接口的代码:

1. 工作流模板.

    public interface IWorkflowTemplateService
    {
        /// <summary>
        /// Get the entity of WorkflowTemplate by entity id
        /// </summary>
        /// <param name="workflow">entity id which is from XML and ready it by Foundation service</param>
        /// <returns>return the WorkflowTemplate result which only one</returns>
        WorkflowTemplateResult ReadByWorkflow(string workflow);

        /// <summary>
        /// Get the entity of WorkflowTemplate by template id
        /// </summary>
        /// <param name="workflow">the primary key which belongs to WorkflowTemplate</param>
        /// <returns>return the WorkflowTemplate result which only one</returns>
        WorkflowTemplateResult ReadByTemplateID(Guid templateID);

        /// <summary>
        /// Save the entity of WorkflowTemplate
        /// </summary>
        /// <param name="data">the entity of WorkflowTemplate</param>
        /// <returns>operation result which true or false</returns>
        [OperationContract]
        bool Save(WorkflowTemplateParameter data);

        /// <summary>
        /// Delete the entity of WorkflowTemplate
        /// </summary>
        /// <param name="templateID">The entity of primary key</param>
        /// <returns>return operation result which true or false</returns>
        bool Delete(Guid templateID);

        /// <summary>
        /// Update the entity of WorkflowTemplate
        /// </summary>
        /// <param name="data">the newer entity of WorkTemplate</param>
        /// <returns>return operation result which true or false</returns>
        bool Update(WorkflowTemplateParameter data);
    }

2. Activity活动

 public interface IWorkflowTemplateFlowService
    {
        /// <summary>
        /// Get the entity of WorkflowTemplateFlow by Flow id
        /// </summary>
        /// <param name="FlowID">the primary key of WorkflowTemplateFlow</param>
        /// <returns>return the WorkflowTemplateFlow result which only one</returns>
        WorkflowTemplateFlowResult ReadByFlowID(Guid FlowID);

        /// <summary>
        /// Get the entity of WorkflowTemplateFlow by workflow template id
        /// </summary>
        /// <param name="templateID">workflow template id which belongs to WorkflowTemplateFlowResult</param>
        /// <returns>return the WorkflowTemplateFlow array</returns>
        List<WorkflowTemplateFlowResult> ReadByTemplateID(Guid templateID);

        /// <summary>
        /// Get the first entity of WorkflowTemplateFlow by entity id
        /// </summary>
        /// <param name="templateID">workflow template id which belongs to WorkflowTemplate</param>
        /// <returns>return the first WorkflowTemplateFlow which only one</returns>
        [OperationContract]
        WorkflowTemplateFlowResult ReadFirstByTemplateID(Guid templateID);

        /// <summary>
        /// Get the closed entity of WorkflowTemplateFlow by Flow id
        /// </summary>
        /// <param name="FlowID">workflow template id which belongs to WorkflowTemplate</param>
        /// <returns>return the WorkflowTemplateFlow array</returns>
        List<WorkflowTemplateFlowResult> ReadNextByFlowID(Guid flowID);

        /// <summary>
        /// Get the entity of WorkflowTemplateFlowResult which is container by entity id
        /// </summary>
        /// <param name="templateID">the parent Flow id</param>
        /// <returns>return the WorkflowTemplateFlowResult result which only one</returns>
        WorkflowTemplateFlowResult ReadNoContainerNextByFlowID(Guid flowID);

        /// <summary>
        /// Get the entity of WorkflowTemplateFlowResult by entity id
        /// </summary>
        /// <param name="templateID">entity id which is from XML and ready it by Foundation service</param>
        /// <returns>return the WorkflowTemplateFlow array which contains the Flow's child</returns>
        List<WorkflowTemplateFlowResult> ReadContainerNextByFlowID(Guid flowID);

        /// <summary>
        /// Save the entity of WorkflowTemplateFlow
        /// </summary>
        /// <param name="data">the entity of WorkflowTemplateFlow</param>
        /// <returns>operation result which true or false</returns>
        Guid Save(WorkflowTemplateFlowParameter data);

        /// <summary>
        /// Delete the entity of WorkflowTemplateFlow
        /// </summary>
        /// <param name="templateID">The entity of primary key</param>
        /// <returns>return operation result which true or false</returns>
        bool Delete(Guid flowID);

        /// <summary>
        /// Delete the list of WorkflowTemplateFlow
        /// </summary>
        /// <param name="flowIDs">the list of keys</param>
        /// <returns>return opeation result which true or false</returns>
        bool DeleteList(List<Guid> flowIDs);
        /// <summary>
        /// Update the entity of WorkflowTemplateFlow
        /// </summary>
        /// <param name="data">the newer entity of WorkflowTemplateFlow</param>
        /// <returns>return operation result which true or false</returns>
        bool Update(WorkflowTemplateFlowParameter data);

        /// <summary>
        /// Delete the entity of WorkflowTemplateFlow
        /// </summary>
        /// <param name="templateID">The entity of primary key</param>
        /// <returns>return operation result which true or false</returns>
        bool SaveAndUpdateChild(WorkflowTemplateFlowParameter nowData, Guid childFlowID);
    }


3. 日志

   
    public interface IWorkflowRunLogService
    {
        /// <summary>
        /// Save the workflow run log
        /// </summary>
        /// <param name="data">the entity of WorkflowRunLog</param>
        /// <returns>return the operation record's primary key</returns>
        Guid Save(WorkflowRunLogParameter data);

        /// <summary>
        /// Get the list of WorkflowRunLogResult by workflow instance id
        /// </summary>
        /// <param name="instanceFlowID">the workflow instance id</param>
        /// <returns>return the WorkflowRunLogResult array</returns>
        List<WorkflowRunLogResult> ReadByFlowID(Guid flowID);

        /// <summary>
        /// Get the list of WorkflowRunLogResult by workflow instance id
        /// </summary>
        /// <param name="instanceFlowID">the workflow instance id</param>
        /// <returns>return the WorkflowRunLogResult array</returns>
        List<WorkflowRunLogResult> ReadByInstanceID(Guid instanceID);

        /// <summary>
        /// Get the entity of WorkflowRunLogResult by primary key
        /// </summary>
        /// <param name="logID">the primary key of WorkflowRunLogResult</param>
        /// <returns>return the one WorkflowRunLogResult</returns>
        WorkflowRunLogResult Read(Guid logID);

        /// <summary>
        /// Update the logs's status by flowID
        /// </summary>
        /// <param name="flowID">the key of WorkflowInstantceFlow</param>
        /// <param name="status">the target status</param>
        /// <returns>return true or false</returns>
        bool UpdateStatus(Guid flowID, RunStatus status);

        
        /// <summary>
        /// Update the logs's status by flowID
        /// </summary>
        /// <param name="flowID">the keys of WorkflowInstantceFlow</param>
        /// <param name="status">the target status</param>
        /// <returns>return true or false</returns>
        bool UpdateListStatus(List<Guid> flowIDs, RunStatus status);
    }


在设计的过程实例和这个上面2个接口差不多,就是参数多一些。(由于临时有事离开,待续)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值