/// <summary>
 /// Initializes a new <see cref="V1CreateWorkflowActivityCommand"/>
 /// </summary>
 /// <param name="workflowInstanceId">The id of the <see cref="V1WorkflowInstance"/> the <see cref="Domain.Models.V1WorkflowActivity"/> to create belongs to</param>
 /// <param name="type">The type of <see cref="V1WorkflowActivity"/> to create</param>
 /// <param name="input">The input data of the <see cref="V1WorkflowActivity"/> to create</param>
 /// <param name="metadata">The metadata of the <see cref="V1WorkflowActivity"/> to create</param>
 /// <param name="parentId">The id the parent of the <see cref="V1WorkflowActivity"/> to create</param>
 public V1CreateWorkflowActivityCommand(string workflowInstanceId, V1WorkflowActivityType type, object?input, IDictionary <string, string>?metadata, string?parentId)
 {
     this.WorkflowInstanceId = workflowInstanceId;
     this.Type     = type;
     this.Input    = input;
     this.Metadata = metadata;
     this.ParentId = parentId;
 }
 /// <summary>
 /// Initializes a new <see cref="V1WorkflowActivity"/>
 /// </summary>
 /// <param name="workflowInstance">The <see cref="V1WorkflowInstance"/> the <see cref="V1WorkflowActivity"/> belongs to</param>
 /// <param name="type">The <see cref="V1WorkflowActivity"/>'s type</param>
 /// <param name="input">The <see cref="V1WorkflowActivity"/>'s data</param>
 /// <param name="metadata">The <see cref="V1WorkflowActivity"/>'s metadata</param>
 /// <param name="parent">The <see cref="V1WorkflowActivity"/>'s parent, if any</param>
 public V1WorkflowActivity(V1WorkflowInstance workflowInstance, V1WorkflowActivityType type, object?input = null, IDictionary <string, string>?metadata = null, V1WorkflowActivity?parent = null)
     : this()
 {
     if (workflowInstance == null)
     {
         throw DomainException.ArgumentNull(nameof(workflowInstance));
     }
     this.On(this.RegisterEvent(new V1WorkflowActivityCreatedDomainEvent(Guid.NewGuid().ToString(), workflowInstance.Id, type, input, metadata, parent?.Id)));
 }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public virtual async Task <V1WorkflowActivity> CreateActivityAsync(V1WorkflowActivityType type, object?input, IDictionary <string, string>?metadata, V1WorkflowActivity?parent, CancellationToken cancellationToken)
        {
            var inputParam = input as Dynamic;

            if (inputParam == null && input != null)
            {
                inputParam = Dynamic.FromObject(input);
            }
            var metadataParam = metadata == null ? null : new NameValueCollection <string>(metadata);

            return(await this.SynapseRuntimeApi.CreateActivityAsync(new() { WorkflowInstanceId = this.Instance.Id, Type = type, Input = inputParam, Metadata = metadataParam, ParentId = parent?.Id }, cancellationToken));
        }
 /// <summary>
 /// Initializes a new <see cref="V1WorkflowActivityCreatedDomainEvent"/>
 /// </summary>
 /// <param name="id">The id of the newly created <see cref="V1WorkflowActivity"/></param>
 /// <param name="workflowInstanceId">The id of the <see cref="V1WorkflowInstance"/> the newly created <see cref="V1WorkflowActivity"/> belongs to</param>
 /// <param name="type">The type of the newly created <see cref="V1WorkflowActivity"/></param>
 /// <param name="input">The data of the <see cref="V1WorkflowActivity"/>'s data</param>
 /// <param name="metadata">An <see cref="IDictionary{TKey, TValue}"/> that contains the newly created <see cref="V1WorkflowActivity"/>'s metadata</param>
 /// <param name="parentId">The id of the newly created <see cref="V1WorkflowActivity"/>'s parent, if any</param>
 public V1WorkflowActivityCreatedDomainEvent(string id, string workflowInstanceId, V1WorkflowActivityType type, object?input, IDictionary <string, string>?metadata, string?parentId = null)
     : base(id)
 {
     this.WorkflowInstanceId = workflowInstanceId;
     this.Type     = type;
     this.Input    = input;
     this.Metadata = metadata;
     this.ParentId = parentId;
 }