示例#1
0
        public WorkflowAnalysis GetWorkflowAnalysis(XElement doc)
        {
            WorkflowAnalysis result = new WorkflowAnalysis();

            result.CreateUpdateEntitySteps.AddRange(GetWorkflowEntityOperationsSteps(doc));

            result.UsedEntityAttributes.AddRange(GetWorkflowUsedAttributes(doc));

            return(result);
        }
示例#2
0
        public async Task GetDescriptionEntitesAndAttributesInWorkflowAsync(StringBuilder strFile, Guid idWorkflow)
        {
            try
            {
                var repository = new WorkflowRepository(_service);

                var workflow = await repository.GetByIdAsync(idWorkflow, new ColumnSet(true));

                string xmlContent = ContentCoparerHelper.RemoveDiacritics(workflow.Xaml);

                var doc = XElement.Parse(xmlContent);

                var handler = new WorkflowUsedEntitiesHandler();

                strFile
                .AppendFormat("Entity:   {0}", workflow.PrimaryEntity).AppendLine()
                .AppendFormat("Category: {0}", workflow.FormattedValues[Workflow.Schema.Attributes.category]).AppendLine()
                .AppendFormat("Name:     {0}", workflow.Name).AppendLine()
                .AppendFormat("Url:      {0}", _service.UrlGenerator.GetSolutionComponentUrl(ComponentType.Workflow, idWorkflow)).AppendLine()
                .AppendLine()
                ;

                WorkflowAnalysis analysis = handler.GetWorkflowAnalysis(doc);

                if (analysis.UsedEntityAttributes.Any())
                {
                    strFile
                    .AppendLine()
                    .AppendLine()
                    .AppendLine()
                    .AppendLine(new string('-', 150))
                    .AppendLine()
                    .AppendLine()
                    .AppendLine()
                    ;

                    var tableUsedAttributes = new FormatTextTableHandler();
                    tableUsedAttributes.SetHeader("Entity", "Attribute", "StepName");

                    foreach (var step in analysis.UsedEntityAttributes
                             .OrderBy(e => e.EntityName)
                             .ThenBy(e => e.Attribute)
                             .ThenBy(e => e.DisplayName)
                             )
                    {
                        tableUsedAttributes.AddLine(step.EntityName, step.Attribute, step.DisplayName);
                    }

                    strFile.AppendFormat("Used Attributes: {0}", analysis.UsedEntityAttributes.Count).AppendLine();

                    tableUsedAttributes.GetFormatedLines(false).ForEach(s => strFile.AppendLine(tabspacer + s));
                }

                if (analysis.CreateUpdateEntitySteps.Any())
                {
                    strFile
                    .AppendLine()
                    .AppendLine()
                    .AppendLine()
                    .AppendLine(new string('-', 150))
                    .AppendLine()
                    .AppendLine()
                    .AppendLine()
                    ;

                    strFile.AppendFormat("Created or Updated Entities {0}", analysis.CreateUpdateEntitySteps.Count).AppendLine();

                    foreach (var step in analysis.CreateUpdateEntitySteps)
                    {
                        strFile.AppendFormat("Entity {0}    Operation {1}    StepName {2}    With Attributes {2}", step.EntityName, step.StepType, step.DisplayName, step.SetEntityPropertySteps.Count).AppendLine()
                        ;

                        var tableUsedAttributes = new FormatTextTableHandler();
                        tableUsedAttributes.SetHeader("Attribute");

                        foreach (var stepSet in step.SetEntityPropertySteps
                                 .OrderBy(e => e.EntityName)
                                 .ThenBy(e => e.Attribute)
                                 )
                        {
                            tableUsedAttributes.AddLine(stepSet.Attribute);
                        }

                        tableUsedAttributes.GetFormatedLines(false).ForEach(s => strFile.AppendLine(tabspacer + s));

                        strFile.AppendLine().AppendLine();
                    }
                }
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(_service.ConnectionData, ex);
            }
        }