示例#1
0
 public AuditLog(IDSFDataObject dsfDataObject, string auditType, string detail, IDev2Activity previousActivity, IDev2Activity nextActivity)
 {
     WorkflowID                 = dsfDataObject.ResourceID.ToString();
     ExecutionID                = dsfDataObject.ExecutionID.ToString();
     ExecutionOrigin            = Convert.ToInt64(dsfDataObject.ExecutionOrigin);
     IsSubExecution             = Convert.ToInt64(dsfDataObject.IsSubExecution);
     IsRemoteWorkflow           = Convert.ToInt64(dsfDataObject.IsRemoteWorkflow());
     WorkflowName               = dsfDataObject.ServiceName;
     ServerID                   = dsfDataObject.ServerID.ToString();
     ParentID                   = dsfDataObject.ParentID.ToString();
     ExecutingUser              = dsfDataObject.ExecutingUser?.ToString();
     ExecutionOriginDescription = dsfDataObject.ExecutionOriginDescription;
     ExecutionToken             = dsfDataObject.ExecutionToken.ToJson();
     Environment                = dsfDataObject.Environment.ToJson();
     AuditDate                  = DateTime.Now.ToString();
     AuditType                  = auditType;
     AdditionalDetail           = detail;
     if (previousActivity != null)
     {
         PreviousActivity     = previousActivity.GetDisplayName();
         PreviousActivityType = previousActivity.GetType().ToString();
         PreviousActivityId   = previousActivity.ActivityId.ToString();
     }
     if (nextActivity != null)
     {
         NextActivity     = nextActivity.GetDisplayName();
         NextActivityType = nextActivity.GetType().ToString();
         NextActivityId   = nextActivity.ActivityId.ToString();
     }
 }
示例#2
0
 private void PerformSearchOnActivity(ISearch searchParameters, List <ISearchResult> searchResults, KeyValuePair <Guid, IDev2Activity> resourceActivity, IDev2Activity activity)
 {
     if (activity != null)
     {
         var foundMatch = SearchUtils.FilterText(activity.GetDisplayName(), searchParameters);
         if (foundMatch)
         {
             var resource     = _resourceCatalog.GetResource(GlobalConstants.ServerWorkspaceID, resourceActivity.Key);
             var searchResult = new SearchResult(resource.ResourceID, resource.ResourceName, resource.GetResourcePath(GlobalConstants.ServerWorkspaceID), SearchItemType.ToolTitle, activity.GetDisplayName());
             searchResults.Add(searchResult);
         }
     }
 }
        public void ThenADetailedLogEntryIsCreated(Table table)
        {
            var nodeTable = table.CreateSet <NodeLogTable>().ToList();

            var           dataObject = _scenarioContext.Get <IDSFDataObject>("dataObject");
            IDev2Activity resource   = GetWFsFirstNode(dataObject);

            var displayName = resource.GetDisplayName();
            var nodeType    = resource.GetType();

            _scenarioContext.Add(nameof(resource), resource);

            Assert.AreEqual(nodeTable[0].Key, nodeType.Name);
            Assert.AreEqual(nodeTable[0].Value, displayName.Trim());
        }
示例#4
0
        private IWorkflowNode WorkflowNodeFrom(IDev2Activity activity)
        {
            if (activity != null && !IsDsfComment(activity))
            {
                var workflowNode = new WorkflowNode
                {
                    ActivityID      = activity.ActivityId,
                    UniqueID        = Guid.Parse(activity.UniqueID),
                    StepDescription = activity.GetDisplayName(),
                };

                if (!_workflowNodes.Any(o => o.UniqueID == workflowNode.UniqueID))
                {
                    _workflowNodes.Add(workflowNode);
                }

                return(workflowNode);
            }
            return(null);
        }
示例#5
0
        public Audit(IDSFDataObject dsfDataObject, string auditType, string detail, IDev2Activity previousActivity, IDev2Activity nextActivity, Exception exception)
        {
            var dev2Serializer = new Dev2JsonSerializer();

            WorkflowID                 = dsfDataObject.ResourceID.ToString();
            ExecutionID                = dsfDataObject.ExecutionID.ToString();
            ExecutionOrigin            = Convert.ToInt64(dsfDataObject.ExecutionOrigin);
            IsSubExecution             = Convert.ToBoolean(dsfDataObject.IsSubExecution);
            IsRemoteWorkflow           = Convert.ToBoolean(dsfDataObject.IsRemoteWorkflow());
            WorkflowName               = dsfDataObject.ServiceName;
            ServerID                   = dsfDataObject.ServerID.ToString();
            ParentID                   = dsfDataObject.ParentID.ToString();
            ExecutingUser              = dsfDataObject.ExecutingUser?.ToString();
            User                       = dsfDataObject.ExecutingUser?.ToString();
            ExecutionOriginDescription = dsfDataObject.ExecutionOriginDescription;
            ExecutionToken             = dev2Serializer.Serialize(ExecutionToken);
            Environment                = dsfDataObject.Environment.ToJson();
            VersionNumber              = dsfDataObject.VersionNumber.ToString();
            AuditDate                  = DateTime.Now;
            StartDateTime              = DateTime.Now;
            CompletedDateTime          = DateTime.Now;
            Url              = dsfDataObject.WebUrl;
            AuditType        = auditType;
            AdditionalDetail = detail;
            Exception        = exception;

            if (previousActivity != null)
            {
                PreviousActivity     = previousActivity.GetDisplayName();
                PreviousActivityType = previousActivity.GetType().ToString();
                PreviousActivityId   = previousActivity.UniqueID;
            }
            if (nextActivity != null)
            {
                NextActivity     = nextActivity.GetDisplayName();
                NextActivityType = nextActivity.GetType().ToString();
                NextActivityId   = nextActivity.UniqueID;
            }
        }
示例#6
0
        private IWorkflowNode WorkflowNodeFrom(IDev2Activity activity)
        {
            if (activity != null && !IsDsfComment(activity))
            {
                var workflowNode = new WorkflowNode
                {
                    ActivityID      = activity.ActivityId != Guid.Empty ? activity.ActivityId : Guid.Parse(activity.UniqueID),
                    UniqueID        = Guid.Parse(activity.UniqueID),
                    StepDescription = activity.GetDisplayName(),
                    ChildNodes      = activity.GetChildrenNodes()
                                      .Select(o => WorkflowNodeFrom(o))
                                      .ToList()
                };

                if (!_workflowNodes.Any(o => o.UniqueID == workflowNode.UniqueID))
                {
                    _workflowNodes.Add(workflowNode);
                }

                return(workflowNode);
            }
            return(null);
        }
示例#7
0
        private void WriteHeader(IDev2Activity previousActivity, IDev2Activity nextActivity)
        {
            _jsonTextWriter.WriteStartObject();
            _jsonTextWriter.WritePropertyName("timestamp");
            _jsonTextWriter.WriteValue(DateTime.Now);
            if (!(previousActivity is null))
            {
                _jsonTextWriter.WritePropertyName("PreviousActivity");
                _jsonTextWriter.WriteValue(previousActivity.UniqueID);
            }
            if (!(nextActivity is null))
            {
                _jsonTextWriter.WritePropertyName("NextActivity");

                _jsonTextWriter.WriteStartObject();
                _jsonTextWriter.WritePropertyName("Id");
                _jsonTextWriter.WriteValue(nextActivity.UniqueID);
                _jsonTextWriter.WritePropertyName("Type");
                _jsonTextWriter.WriteValue(nextActivity.GetType().ToString());
                _jsonTextWriter.WritePropertyName("DisplayName");
                _jsonTextWriter.WriteValue(nextActivity.GetDisplayName());
                if (nextActivity is DsfActivity dsfActivity)
                {
                    _jsonTextWriter.WritePropertyName("Inputs");
                    var jsonSerializer = new Dev2JsonSerializer();
                    _jsonTextWriter.WriteRawValue(jsonSerializer.Serialize(dsfActivity.Inputs, Formatting.None));
                    _jsonTextWriter.WritePropertyName("Outputs");
                    _jsonTextWriter.WriteRawValue(jsonSerializer.Serialize(dsfActivity.Outputs, Formatting.None));
                }
                _jsonTextWriter.WriteEndObject();
            }
            _jsonTextWriter.WriteEndObject();
            _jsonTextWriter.Flush();
            _writer.WriteLine();
            _writer.Flush();
        }
示例#8
0
        private void CalculateFlowDecisionNodes(List <IWorkflowNode> list, List <IWorkflowNode> childNodes, FlowNode node, out IDev2Activity activity, out List <IWorkflowNode> nodes)
        {
            var flowDecision = ((FlowDecision)node);

            nodes = GetFlowStepFromFlowNode(flowDecision.False);
            if (nodes.Count > 0)
            {
                childNodes.AddRange(nodes);
            }
            else
            {
                var falseA = (((FlowStep)flowDecision.False)?.Action as IDev2Activity);
                if (falseA.GetType().Name is "DsfCommentActivity")
                {
                    //Do nothing. DsfCommentActivity should not be part of coverage
                }
                else
                {
                    var falseArm = new WorkflowNode
                    {
                        ActivityID      = falseA.ActivityId,
                        UniqueID        = Guid.Parse(falseA.UniqueID),
                        StepDescription = falseA.GetDisplayName(),
                    };
                    childNodes.Add(falseArm);
                }
            }

            nodes = GetFlowStepFromFlowNode(flowDecision.True);
            if (nodes.Count > 0)
            {
                childNodes.AddRange(nodes);
            }
            else
            {
                var trueA = ((FlowStep)flowDecision.True)?.Action as IDev2Activity;
                if (trueA.GetType().Name is "DsfCommentActivity")
                {
                    //Do nothing. DsfCommentActivity should not be part of coverage
                }
                else
                {
                    var trueArm = new WorkflowNode
                    {
                        ActivityID      = trueA.ActivityId,
                        UniqueID        = Guid.Parse(trueA.UniqueID),
                        StepDescription = trueA.GetDisplayName(),
                    };
                    childNodes.Add(trueArm);
                }
            }

            activity = flowDecision.Condition as IDev2Activity;
            list.Add(new WorkflowNode
            {
                ActivityID      = activity.ActivityId,
                UniqueID        = Guid.Parse(activity.UniqueID),
                StepDescription = activity.GetDisplayName(),
                NextNodes       = childNodes
            });
        }