Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TraceLinkBuilder{TLinkData}"/> class.
        /// </summary>
        /// <param name="cfg"> the config to instantiate the builder </param>
        public TraceLinkBuilder(TraceLinkBuilderConfig <TLinkData> cfg) : base(
                cfg.WorkflowId, (cfg.ParentLink != null ? cfg.ParentLink.TraceId() : Guid.NewGuid().ToString()))
        {
            // trace id is either retrieved from parent link when it is provided
            // or set to a new uuid.

            // set the parent link
            this.parentLink = (TraceLink <TLinkData>)cfg.ParentLink;

            // degree is always 1
            base.WithDegree(1);
            // set priority to 1 by default
            // may be overriden if parent link was provided
            base.WithPriority(1);

            // set the created at timestamp
            this.metadata           = new TraceLinkMetaData();
            this.metadata.CreatedAt = DateTime.Now;

            // if parent link was provided set the parent hash and priority
            if (this.parentLink != null)
            {
                base.WithPriority(this.parentLink.Priority() + 1).WithParent(this.parentLink.Hash());
            }
        }
Esempio n. 2
0
 public AppendLinkInput(string formId, TLinkData data, string traceId, ITraceLink <TLinkData> prevLink)
 {
     if (string.ReferenceEquals(formId, null))
     {
         throw new System.ArgumentException("formId cannot be null in AppendLinkInput");
     }
     this.formId   = formId;
     this.data     = data;
     this.traceId  = traceId;
     this.prevLink = prevLink;
 }
Esempio n. 3
0
        public TraceState(string traceId, ITraceLink <TLinkData> headLink, DateTime updatedAt, Account updatedBy, TState data, string[] tags)
        {
            if (string.ReferenceEquals(traceId, null))
            {
                throw new System.ArgumentException("traceId cannot be null in a TraceState object");
            }

            this.traceId   = traceId;
            this.headLink  = headLink;
            this.updatedAt = updatedAt;
            this.updatedBy = updatedBy;
            this.data      = data;
            this.tags      = tags;
        }
Esempio n. 4
0
 public TraceLinkBuilderConfig(string workflowId, ITraceLink <TLinkData> parentLink)
 {
     this.workflowId = workflowId;
     this.parentLink = parentLink;
 }