Ejemplo n.º 1
0
        async Task StartWorkflowInt()
        {
            var info = new StartWorkflowInfo()
            {
                Source = "file:Workflows/SimpleWorkflow_v1",
                UserId = 50, // predefined user id
            };
            WorkflowResult result = await _workflow.StartWorkflow(info);

            Assert.AreNotEqual(0, result.ProcessId);
        }
Ejemplo n.º 2
0
        public async Task <ServerCommandResult> Execute(RequestCommand cmd, ExpandoObject dataToExec)
        {
            var swi = new StartWorkflowInfo
            {
                DataSource = cmd.CurrentSource,
                Schema     = cmd.CurrentSchema,
                Model      = cmd.CurrentModel,
                ModelId    = dataToExec.Get <Int64>("Id"),
                ActionBase = cmd.ActionBase
            };

            if (swi.ModelId == 0)
            {
                throw new RequestModelException("Id must be specified to 'startProcess' command");
            }
            if (!String.IsNullOrEmpty(cmd.file))
            {
                swi.Source = $"file:{cmd.file}";
            }
            swi.Comment = dataToExec.Get <String>("Comment");
            swi.UserId  = dataToExec.Get <Int64>("UserId");
            if (swi.Source == null)
            {
                throw new RequestModelException($"File or clrType must be specified to 'startProcess' command");
            }
            WorkflowResult wr = await _workflowEngine.StartWorkflow(swi);

            return(new ServerCommandResult(JsonConvert.SerializeObject(wr, JsonHelpers.StandardSerializerSettings)));
        }
        private void NotifyWorkflowAboutChanges(int portalId, int tabId, int userId)
        {
            try
            {
                var tabInfo = _tabController.GetTab(tabId, portalId);
                if (tabInfo != null && !tabInfo.IsDeleted && _workflowEngine.IsWorkflowCompleted(tabInfo))
                {
                    var workflow = GetCurrentOrDefaultWorkflow(tabInfo, portalId);
                    if (workflow == null)
                    {
                        Logger.Warn("Current Workflow and Default workflow are not found on NotifyWorkflowAboutChanges");
                        return;
                    }

                    _workflowEngine.StartWorkflow(workflow.WorkflowID, tabInfo.ContentItemId, userId);
                    _tabController.RefreshCache(portalId, tabId);
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }
        }
Ejemplo n.º 4
0
 public void StartWorkflow(ContentItem contentItem, int workflowId)
 {
     _workflowEngine.StartWorkflow(workflowId, contentItem.ContentItemId, _userController.GetCurrentUserInfo().UserID);
 }