Example #1
0
        public async System.Threading.Tasks.Task <long?> PushWorkflowAsync(Workflow workflow)
        {
            var json = workflow.ToJson();

            var workflowId = await _lua.PushWorkflowAsync(_db, json, Timestamp());

            return(workflowId.Value);
        }
Example #2
0
        /// <summary>
        /// Pushes an executable workflow into the system. Task Names are assumed to be unique; there's
        /// no checking of integrity and consistency of child-parent relationships (so no guarantee of transitive
        /// closure and so on). Creates a new instance of this workflow which is available for execution
        /// immediately.
        /// </summary>
        /// <param name="workflow"></param>
        /// <param name="checkConsistency">Optionally checks the internal consistency of the workflow</param>
        /// <returns>The handle used to identify this workflow instance</returns>
        public long?PushWorkflow(Workflow workflow, bool checkConsistency = true)
        {
            if (checkConsistency)
            {
                workflow.VerifyInternalConsistency();
            }

            var json = workflow.ToJson();

            var workflowId = _lua.PushWorkflow(_db, json, Timestamp());

            return(workflowId.Value);
        }
        public async System.Threading.Tasks.Task<long?> PushWorkflowAsync(Workflow workflow)
        {
            var json = workflow.ToJson();

            var workflowId = await _lua.PushWorkflowAsync(_db, json, Timestamp());

            return workflowId.Value;
        }
        /// <summary>
        /// Pushes an executable workflow into the system. Task Names are assumed to be unique; there's
        /// no checking of integrity and consistency of child-parent relationships (so no guarantee of transitive
        /// closure and so on). Creates a new instance of this workflow which is available for execution
        /// immediately.
        /// </summary>
        /// <param name="workflow"></param>
        /// <param name="tasks"></param>
        /// <returns>The handle used to identify this workflow instance</returns>
        public long? PushWorkflow(Workflow workflow)
        {
            var rootParentCount = 0;
            foreach(var task in workflow.Tasks)
            {
                if(task.Parents.Length == 0)
                {
                    rootParentCount++;
                }
            }

            if(rootParentCount == 0)
            {
                throw new ArgumentException("A workflow must have at least one task with no parents.", "workflow");
            }

            var json = workflow.ToJson();

            var workflowId = _lua.PushWorkflow(_db, json, Timestamp());
            
            return workflowId.Value;
        }
        /// <summary>
        /// Pushes an executable workflow into the system. Task Names are assumed to be unique; there's
        /// no checking of integrity and consistency of child-parent relationships (so no guarantee of transitive
        /// closure and so on). Creates a new instance of this workflow which is available for execution
        /// immediately.
        /// </summary>
        /// <param name="workflow"></param>
        /// <param name="checkConsistency">Optionally checks the internal consistency of the workflow</param>
        /// <returns>The handle used to identify this workflow instance</returns>
        public long? PushWorkflow(Workflow workflow, bool checkConsistency = true)
        {
            if (checkConsistency) workflow.VerifyInternalConsistency();

            var json = workflow.ToJson();

            var workflowId = _lua.PushWorkflow(_db, json, Timestamp());
            
            return workflowId.Value;
        }