public ITaskInstance createTaskInstance(IWorkflowSession currentSession, RuntimeContext runtimeContxt, IProcessInstance processInstance, Task task, Activity activity)
        {
            LoanTaskInstance taskInstance = new LoanTaskInstance();
            taskInstance.Sn=(String)processInstance.getProcessInstanceVariable("sn");
            taskInstance.ApplicantName=(String)processInstance.getProcessInstanceVariable("applicantName");
            taskInstance.LoanValue=(int)processInstance.getProcessInstanceVariable("loanValue");
            taskInstance.RiskFlag=(Boolean)processInstance.getProcessInstanceVariable("RiskFlag");
            taskInstance.Decision=(Boolean)processInstance.getProcessInstanceVariable("Decision");

            return taskInstance;
        }
        public ITaskInstance createTaskInstance(IWorkflowSession currentSession,
            RuntimeContext runtimeContxt, IProcessInstance processInstance,
            Task task, Activity activity)
        {
            GoodsDeliverTaskInstance taskInst = new GoodsDeliverTaskInstance();

            String sn = (String)processInstance.getProcessInstanceVariable("sn");
            taskInst.Sn = sn;

            String customerName = (String)processInstance.getProcessInstanceVariable("customerName");
            taskInst.CustomerName = customerName;

            String goodsName = (String)processInstance.getProcessInstanceVariable("goodsName");
            taskInst.GoodsName = goodsName;

            long quantity = (long)processInstance.getProcessInstanceVariable("quantity");
            taskInst.Quantity = quantity;

            //taskInst.BizInfo=

            return taskInst;
        }
Esempio n. 3
0
 public TaskRef(Task task)
 {
     referencedTask = task;
 }
Esempio n. 4
0
 public TaskRef(IWFElement parent, Task task)
     : base(parent, task.Name)
 {
     referencedTask = task;
 }
 // throws EngineException
 public ITaskInstance createTaskInstance(IWorkflowSession currentSession, RuntimeContext runtimeContxt,
     IProcessInstance processInstance, Task task, Activity activity)
 {
     TaskInstance taskInstance = new TaskInstance();
     return taskInstance;
 }
        // throws EngineException
        public ITaskInstance createTaskInstance(IWorkflowSession currentSession, IProcessInstance processInstance, Task task,
            Activity activity)
        {
            //如果loopStrategy为SKIP且Task被执行过,则直接返回null;
            IPersistenceService persistenceService = this.RuntimeContext.PersistenceService;
            LoopStrategyEnum loopStrategy = task.LoopStrategy;
            if (LoopStrategyEnum.SKIP == loopStrategy && !currentSession.isInWithdrawOrRejectOperation())
            {
                //检查是否已经执行过的task instance
                Int32 count = persistenceService.GetCompletedTaskInstanceCountForTask(processInstance.Id, task.Id);
                if (count > 0)
                {
                    return null;
                }
            }

            String taskInstanceCreatorName = null;
            ITaskInstanceCreator taskInstanceCreator = null;

            //首先查找Task级别的TaskInstanceCreator
            taskInstanceCreatorName = task.TaskInstanceCreator;
            if (!String.IsNullOrEmpty(taskInstanceCreatorName.Trim()))
            {
                IBeanFactory beanFactory = this.RuntimeContext.BeanFactory;
                taskInstanceCreator = (ITaskInstanceCreator)beanFactory.GetBean(taskInstanceCreatorName);
            }
            //如果没有,则查询流程级别的TaskInstanceCreator
            if (taskInstanceCreator == null)
            {
                taskInstanceCreatorName = processInstance.WorkflowProcess.TaskInstanceCreator;
                if (!String.IsNullOrEmpty(taskInstanceCreatorName.Trim()))
                {
                    IBeanFactory beanFactory = this.RuntimeContext.BeanFactory;
                    taskInstanceCreator = (ITaskInstanceCreator)beanFactory.GetBean(taskInstanceCreatorName);
                }
            }

            //如果流程定义中也没有指定TaskInstanceCreator,则用缺省的
            if (taskInstanceCreator == null)
            {
                taskInstanceCreator = DefaultTaskInstanceCreator;
            }

            return taskInstanceCreator.createTaskInstance(currentSession, RuntimeContext, processInstance, task, activity);
        }