Exemplo n.º 1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual async Task UpdateAsync(PersistedWorkflowDefinition entity)
        {
            if (_registry.IsRegistered(entity.Id.ToString(), entity.Version))
            {
                _registry.DeregisterWorkflow(entity.Id.ToString(), entity.Version);
            }

            LoadDefinition(entity);
            await _workflowDefinitionRepository.UpdateAsync(entity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 注册工作流
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        internal WorkflowDefinition LoadDefinition(PersistedWorkflowDefinition input)
        {
            if (_registry.IsRegistered(input.Id.ToString(), input.Version))
            {
                throw new AbpException($"the workflow {input.Id} has ben definded!");
            }
            var source = new DefinitionSourceV1();

            source.Id          = input.Id.ToString();
            source.Version     = input.Version;
            source.Description = input.Title;
            source.DataType    = $"{typeof(Dictionary<string, object>).FullName}, {typeof(Dictionary<string, object>).Assembly.FullName}";

            BuildWorkflow(input.Nodes, source, _stepBodys, input.Nodes.First(u => u.Key.ToLower().StartsWith("start")));
            var json = source.ToJsonString();

            Logger.DebugFormat("Workflow Json:{0}", json);
            var def = _definitionLoader.LoadDefinition(json, Deserializers.Json);

            return(def);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 创建流程
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public virtual async Task CreateAsync(PersistedWorkflowDefinition entity)
 {
     LoadDefinition(entity);
     await _workflowDefinitionRepository.InsertAsync(entity);
 }