コード例 #1
0
        private List <string> RunBusinessFlowAnalyzer(BusinessFlow businessFlow, bool markCompletion = true)
        {
            List <string> usedVariablesInBF       = new List <string>();
            List <string> usedVariablesInActivity = new List <string>();

            DSList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>();
            SetStatus("Analyzing " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow, suffixString: ":  ") + businessFlow.Name);
            List <AnalyzerItemBase> issues = AnalyzeBusinessFlow.Analyze(mSolution, businessFlow);

            AddIssues(issues);
            foreach (Activity activity in businessFlow.Activities)
            {
                issues = AnalyzeActivity.Analyze(businessFlow, activity);
                AddIssues(issues);
                foreach (Act action in activity.Acts)
                {
                    List <AnalyzerItemBase> actionissues = AnalyzeAction.Analyze(businessFlow, activity, action, DSList);
                    AddIssues(actionissues);
                    List <string> tempList = AnalyzeAction.GetUsedVariableFromAction(action);
                    usedVariablesInActivity.AddRange(tempList);
                }
                ReportUnusedVariables(activity, usedVariablesInActivity);
                usedVariablesInBF.AddRange(usedVariablesInActivity);
                usedVariablesInActivity.Clear();
            }
            ReportUnusedVariables(businessFlow, usedVariablesInBF);

            if (markCompletion)
            {
                SetAnalayzeProceesAsCompleted();
            }

            return(usedVariablesInBF);
        }
コード例 #2
0
        public static List <AnalyzerItemBase> AnalyzeForMissingMandatoryInputValues(BusinessFlow businessFlow)
        {
            List <AnalyzerItemBase> issuesList = new List <AnalyzerItemBase>();

            foreach (VariableBase var in businessFlow.GetBFandActivitiesVariabeles(includeParentDetails: true, includeOnlySetAsInputValue: true, includeOnlyMandatoryInputs: true))
            {
                if (var.SetAsInputValue && var.MandatoryInput && string.IsNullOrWhiteSpace(var.Value) && var.MappedOutputType == VariableBase.eOutputType.None)
                {
                    AnalyzeBusinessFlow mandatoryInputIssue = new AnalyzeBusinessFlow();
                    mandatoryInputIssue.Description   = string.Format("Mandatory Input {0} is missing a value", GingerDicser.GetTermResValue(eTermResKey.Variable));
                    mandatoryInputIssue.UTDescription = "MissingMandatoryInputValue";
                    mandatoryInputIssue.Details       = string.Format("The {0} '{1}' was marked as 'Mandatory Input' but it has empty value and no dynamic mapped value.", GingerDicser.GetTermResValue(eTermResKey.Variable), var.Name);
                    mandatoryInputIssue.HowToFix      = string.Format("Set a value to the {0} before starting the execution.", GingerDicser.GetTermResValue(eTermResKey.Variable));
                    mandatoryInputIssue.CanAutoFix    = AnalyzerItemBase.eCanFix.No;
                    mandatoryInputIssue.FixItHandler  = null;
                    mandatoryInputIssue.Status        = AnalyzerItemBase.eStatus.NeedFix;
                    mandatoryInputIssue.IssueType     = eType.Error;
                    mandatoryInputIssue.ItemParent    = var.ParentName;
                    mandatoryInputIssue.mBusinessFlow = businessFlow;
                    mandatoryInputIssue.ItemName      = var.Name;
                    mandatoryInputIssue.Impact        = "Execution probably will fail due to missing input value.";
                    mandatoryInputIssue.mSolution     = WorkSpace.Instance.Solution;
                    mandatoryInputIssue.ItemClass     = GingerDicser.GetTermResValue(eTermResKey.Variable);
                    mandatoryInputIssue.Severity      = eSeverity.High;
                    mandatoryInputIssue.Selected      = true;
                    issuesList.Add(mandatoryInputIssue);
                }
            }
            return(issuesList);
        }
コード例 #3
0
        private static AnalyzeBusinessFlow GetOutputvalidationErros(BusinessFlow businessFlow)
        {
            AnalyzeBusinessFlow ABF = new AnalyzeBusinessFlow();

            IEnumerable <ObservableList <IAct> > ActionList = businessFlow.Activities.Select(x => x.Acts);

            foreach (ObservableList <IAct> ActList in ActionList)
            {
                foreach (Act action in ActList)
                {
                    ABF.ReturnValues.AddRange(action.ActReturnValues.Where(x => x.Operator == Amdocs.Ginger.Common.Expressions.eOperator.Legacy));
                }
            }
            return(ABF);
        }
コード例 #4
0
        public static List <AnalyzerItemBase> Analyze(Solution Solution, BusinessFlow BusinessFlow)
        {
            // Put all tests on BF here
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();

            // Check BF have Target Apps
            if (BusinessFlow.TargetApplications == null || BusinessFlow.TargetApplications.Count() == 0)
            {
                AnalyzeBusinessFlow ABF = new AnalyzeBusinessFlow();
                ABF.Description   = MissingTargetApp;
                ABF.UTDescription = "MissingTargetApp";
                ABF.Details       = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " doesn't have Target Application(s) defined";
                ABF.HowToFix      = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " in solution tab and add target apps";
                ABF.CanAutoFix    = AnalyzerItemBase.eCanFix.Yes; //  take it from solution
                ABF.FixItHandler  = FixMissingTargetApp;
                ABF.Status        = AnalyzerItemBase.eStatus.NeedFix;
                ABF.IssueType     = eType.Error;
                ABF.ItemParent    = "NA";
                ABF.mBusinessFlow = BusinessFlow;
                ABF.ItemName      = BusinessFlow.Name;
                ABF.Impact        = "Might be executed on wrong application if solution have more than 1 target application";
                ABF.mSolution     = Solution;
                ABF.ItemClass     = "BusinessFlow";
                ABF.Severity      = eSeverity.High;
                ABF.Selected      = true;
                IssuesList.Add(ABF);
            }

            // Check BF have activities
            if (BusinessFlow.Activities.Count() == 0)
            {
                AnalyzeBusinessFlow ABF = new AnalyzeBusinessFlow();
                ABF.UTDescription = "MissingActivities";
                ABF.Description   = MissingActivities;
                ABF.Details       = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " doesn't have " + GingerDicser.GetTermResValue(eTermResKey.Activities);
                ABF.HowToFix      = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " and add " + GingerDicser.GetTermResValue(eTermResKey.Activities) + " or remove this " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                ABF.CanAutoFix    = AnalyzerItemBase.eCanFix.No; // we can autofix by delete, but don't want to
                ABF.Status        = AnalyzerItemBase.eStatus.NeedFix;
                ABF.IssueType     = eType.Warning;
                ABF.ItemParent    = "NA";
                ABF.mBusinessFlow = BusinessFlow;
                ABF.Severity      = eSeverity.Medium;
                ABF.ItemClass     = "BusinessFlow";
                IssuesList.Add(ABF);
            }

            return(IssuesList);
        }
コード例 #5
0
        private static void FixOutputValidationIssue(object sender, EventArgs e)
        {
            AnalyzeBusinessFlow ABF = (AnalyzeBusinessFlow)sender;

            int issueCount      = ABF.ReturnValues.Count;
            int FixedIssueCount = 0;

            foreach (ActReturnValue ARV in ABF.ReturnValues)
            {
                if (!string.IsNullOrEmpty(ARV.Expected) && !ARV.Expected.Contains("{"))
                {
                    ARV.Operator = Amdocs.Ginger.Common.Expressions.eOperator.Equals;
                }
                else
                {
                    if (!string.IsNullOrEmpty(ARV.Expected) && ARV.Expected.StartsWith(@"{Var "))
                    {
                        MatchCollection matches = rxVarPattern.Matches(ARV.Expected);
                        if (matches.Count == 1)
                        {
                            if (matches[0].Value.Equals(ARV.Expected))
                            {
                                FixedIssueCount++;
                                ARV.Operator = Amdocs.Ginger.Common.Expressions.eOperator.Equals;
                            }
                        }
                    }
                }
            }

            if (FixedIssueCount == 0)
            {
                ABF.Status = eStatus.CannotFix;
            }
            else if (FixedIssueCount < issueCount)
            {
                ABF.Status = eStatus.PartiallyFixed;
            }
            else
            {
                ABF.Status = eStatus.Fixed;
            }
        }
コード例 #6
0
        private static void FixMissingTargetApp(object sender, EventArgs e)
        {
            // Take the target app from the solution
            AnalyzeBusinessFlow ABF = (AnalyzeBusinessFlow)sender;

            // Do recheck
            if (ABF.mBusinessFlow.TargetApplications.Count() == 0)
            {
                if (ABF.mSolution.ApplicationPlatforms.Count == 0)
                {
                    Reporter.ToUser(eUserMsgKey.MissingTargetApplication, "The default Application Platform Info is missing, please go to Solution level to add at least one Target Application.");
                    return;
                }
                string SAN = ABF.mSolution.ApplicationPlatforms[0].AppName;
                ABF.mBusinessFlow.TargetApplications.Add(new TargetApplication()
                {
                    AppName = SAN
                });
                ABF.Status = eStatus.Fixed;
            }
        }
コード例 #7
0
        private void RunBusinessFlowAnalyzer(BusinessFlow businessFlow, bool markCompletion = true)
        {
            DSList = Ginger.App.LocalRepository.GetSolutionDataSources();
            SetStatus("Analyzing " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow, suffixString: ":  ") + businessFlow.Name);
            List <AnalyzerItemBase> issues = AnalyzeBusinessFlow.Analyze(mSolution, businessFlow);

            AddIssues(issues);
            foreach (Activity activitiy in businessFlow.Activities)
            {
                issues = AnalyzeActivity.Analyze(businessFlow, activitiy);
                AddIssues(issues);
                foreach (Act action in activitiy.Acts)
                {
                    List <AnalyzerItemBase> actionissues = AnalyzeAction.Analyze(businessFlow, activitiy, action, DSList);
                    AddIssues(actionissues);
                }
            }

            if (markCompletion)
            {
                SetAnalayzeProceesAsCompleted();
            }
        }
コード例 #8
0
        public static List <AnalyzerItemBase> Analyze(GingerExecutionEngine GR, BusinessFlow BusinessFlow)
        {
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();

            //code added to analyze for BFFlowControls in Runner BF.
            if (BusinessFlow.BFFlowControls.Count > 0)
            {
                foreach (FlowControl f in BusinessFlow.BFFlowControls)
                {
                    if (f.Active == true)
                    {
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.GoToBusinessFlow)
                        {
                            string       GoToBusinessFlow = f.GetNameFromValue();
                            BusinessFlow bf           = null;
                            Guid         guidToLookBy = Guid.Empty;

                            if (!string.IsNullOrEmpty(f.GetGuidFromValue().ToString()))
                            {
                                guidToLookBy = Guid.Parse(f.GetGuidFromValue().ToString());
                            }

                            List <BusinessFlow> lstBusinessFlow = null;
                            if (guidToLookBy != Guid.Empty)
                            {
                                lstBusinessFlow = GR.BusinessFlows.Where(x => x.InstanceGuid == guidToLookBy).ToList();
                            }

                            if (lstBusinessFlow == null || lstBusinessFlow.Count == 0)
                            {
                                bf = null;
                            }
                            else if (lstBusinessFlow.Count == 1)
                            {
                                bf = (BusinessFlow)lstBusinessFlow[0];
                            }
                            else//we have more than 1
                            {
                                BusinessFlow firstActive = (BusinessFlow)lstBusinessFlow.Where(x => x.Active == true).FirstOrDefault();
                                if (firstActive != null)
                                {
                                    bf = firstActive;
                                }
                                else
                                {
                                    bf = (BusinessFlow)lstBusinessFlow[0];//no one is Active so returning the first one
                                }
                            }
                            if (bf == null)
                            {
                                AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                ABF.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " which does not exist";
                                ABF.Details     = "'" + GoToBusinessFlow + "' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " does not exist in the '" + GR.GingerRunner.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.RunSet);
                                ABF.HowToFix    = "Remap the Flow Control Action";
                                ABF.IssueType   = eType.Error;
                                ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                ABF.Impact      = "Flow Control will fail on run time";
                                ABF.Severity    = eSeverity.High;
                            }
                        }
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.SetVariableValue)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                string   SetVariableValue = f.GetNameFromValue();
                                string[] vals             = SetVariableValue.Split(new char[] { '=' });
                                if ((BusinessFlow.GetAllHierarchyVariables().Where(x => x.Name == vals[0].Trim()).Select(x => x.Name).FirstOrDefault() == null))
                                {
                                    AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                    ABF.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";;
                                    ABF.Details     = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items";
                                    ABF.HowToFix    = "Remap the Flow Control Action";
                                    ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    ABF.IssueType   = eType.Error;
                                    ABF.Impact      = "Flow Control will fail on run time";
                                    ABF.Severity    = eSeverity.High;
                                }
                            }
                        }
                    }
                }
            }

            IssuesList.AddRange(AnalyzeBusinessFlow.AnalyzeForMissingMandatoryInputValues(BusinessFlow));

            return(IssuesList);
        }
コード例 #9
0
ファイル: AnalyzerPage.xaml.cs プロジェクト: linuxerlj/Ginger
        public void ReportUnusedVariables(object obj, List <string> usedVariables)
        {
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();
            Solution     solution           = null;
            BusinessFlow businessFlow       = null;
            Activity     activity           = null;
            string       variableSourceType = "";
            string       variableSourceName = "";
            ObservableList <VariableBase> AvailableAllVariables = new ObservableList <VariableBase>();

            if (typeof(BusinessFlow).Equals(obj.GetType()))
            {
                businessFlow = (BusinessFlow)obj;
                if (businessFlow.Variables.Count > 0)
                {
                    AvailableAllVariables = businessFlow.Variables;
                    variableSourceType    = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                    variableSourceName    = businessFlow.Name;
                }
            }
            else if (typeof(Activity).Equals(obj.GetType()))
            {
                activity = (Activity)obj;
                if (activity.Variables.Count > 0)
                {
                    AvailableAllVariables = activity.Variables;
                    variableSourceType    = GingerDicser.GetTermResValue(eTermResKey.Activity);
                    variableSourceName    = activity.ActivityName;
                }
            }
            else if (typeof(Solution).Equals(obj.GetType()))
            {
                solution = (Solution)obj;
                AvailableAllVariables = solution.Variables;
                variableSourceType    = "Solution";
                variableSourceName    = solution.Name;
            }

            foreach (VariableBase var in AvailableAllVariables)
            {
                if (usedVariables != null && (!usedVariables.Contains(var.Name)))
                {
                    if (obj.GetType().Equals(typeof(BusinessFlow)))
                    {
                        AnalyzeBusinessFlow aa = new AnalyzeBusinessFlow();
                        aa.Status        = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName      = var.Name;
                        aa.Description   = var + " is Unused in " + variableSourceType + ": " + businessFlow.Name;
                        aa.Details       = variableSourceType;
                        aa.mBusinessFlow = businessFlow;
                        aa.ItemParent    = variableSourceName;
                        aa.CanAutoFix    = AnalyzerItemBase.eCanFix.Yes;
                        aa.IssueType     = eType.Error;
                        aa.FixItHandler  = DeleteUnusedVariables;
                        aa.Severity      = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                    else if (obj.GetType().Equals(typeof(Solution)))
                    {
                        AnalyzeSolution aa = new AnalyzeSolution();
                        aa.Status       = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName     = var.Name;
                        aa.Description  = var + " is Unused in Solution";
                        aa.Details      = variableSourceType;
                        aa.ItemParent   = variableSourceName;
                        aa.CanAutoFix   = AnalyzerItemBase.eCanFix.Yes;
                        aa.IssueType    = eType.Error;
                        aa.FixItHandler = DeleteUnusedVariables;
                        aa.Severity     = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                    else
                    {
                        AnalyzeActivity aa = new AnalyzeActivity();
                        aa.Status      = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName    = var.Name;
                        aa.Description = var + " is Unused in " + variableSourceType + ": " + activity.ActivityName;
                        aa.Details     = variableSourceType;
                        aa.mActivity   = activity;
                        //aa.mBusinessFlow = businessFlow;
                        aa.ItemParent   = variableSourceName;
                        aa.CanAutoFix   = AnalyzerItemBase.eCanFix.Yes;
                        aa.IssueType    = eType.Error;
                        aa.FixItHandler = DeleteUnusedVariables;
                        aa.Severity     = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                }
            }
            AddIssues(IssuesList);
        }
コード例 #10
0
        public void ReportUnusedVariables(object obj, List <string> usedVariables)
        {
            List <AnalyzerItemBase> IssuesList   = new List <AnalyzerItemBase>();
            BusinessFlow            BusinessFlow = App.BusinessFlow;
            Activity activity           = BusinessFlow.Activities[0];
            string   variableSourceType = "";
            string   variableSourceName = "";
            ObservableList <VariableBase> AvailableAllVariables = new ObservableList <VariableBase>();

            if (typeof(BusinessFlow).Equals(obj.GetType()))
            {
                BusinessFlow = (BusinessFlow)obj;
                if (BusinessFlow.Variables.Count > 0)
                {
                    AvailableAllVariables = BusinessFlow.Variables;
                    variableSourceType    = "BusinessFlow";
                    variableSourceName    = BusinessFlow.Name;
                }
            }
            else if (typeof(Activity).Equals(obj.GetType()))
            {
                activity = (Activity)obj;
                if (activity.Variables.Count > 0)
                {
                    AvailableAllVariables = activity.Variables;
                    variableSourceType    = "Activity";
                    variableSourceName    = activity.ActivityName;
                }
            }
            else if (typeof(Solution).Equals(obj.GetType()))
            {
                Solution solution = (Solution)obj;
                AvailableAllVariables = solution.Variables;
                variableSourceType    = "Solution";
                variableSourceName    = solution.Name;
                activity = BusinessFlow.Activities[0];
            }



            foreach (VariableBase var in AvailableAllVariables)
            {
                if (usedVariables != null && (!usedVariables.Contains(var.Name)))
                {
                    if (obj.GetType().Equals(typeof(BusinessFlow)))
                    {
                        AnalyzeBusinessFlow aa = new AnalyzeBusinessFlow();
                        aa.Status        = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName      = var.Name;
                        aa.Description   = var + " is Unused in Business Flow : " + BusinessFlow.Name;
                        aa.Details       = variableSourceType;
                        aa.mBusinessFlow = BusinessFlow;
                        aa.ItemParent    = variableSourceName;

                        aa.CanAutoFix   = AnalyzerItemBase.eCanFix.Yes;  // we can autofix by delete, but don't want to
                        aa.IssueType    = eType.Error;
                        aa.FixItHandler = DeleteUnusedVariables;
                        aa.Severity     = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                    else if (obj.GetType().Equals(typeof(Solution)))
                    {
                        AnalyzeSolution aa = new AnalyzeSolution();
                        aa.Status      = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName    = var.Name;
                        aa.Description = var + " is Unused in Solution";
                        aa.Details     = variableSourceType;
                        aa.ItemParent  = variableSourceName;

                        aa.CanAutoFix   = AnalyzerItemBase.eCanFix.Yes;  // we can autofix by delete, but don't want to
                        aa.IssueType    = eType.Error;
                        aa.FixItHandler = DeleteUnusedVariables;
                        aa.Severity     = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                    else
                    {
                        AnalyzeActivity aa = new AnalyzeActivity();
                        aa.Status        = AnalyzerItemBase.eStatus.NeedFix;
                        aa.ItemName      = var.Name;
                        aa.Description   = var + " is Unused in Activity : " + activity.ActivityName;
                        aa.Details       = variableSourceType;
                        aa.mActivity     = activity;
                        aa.mBusinessFlow = BusinessFlow;
                        aa.ItemParent    = variableSourceName;

                        aa.CanAutoFix   = AnalyzerItemBase.eCanFix.Yes;  // we can autofix by delete, but don't want to
                        aa.IssueType    = eType.Error;
                        aa.FixItHandler = DeleteUnusedVariables;
                        aa.Severity     = eSeverity.Medium;
                        IssuesList.Add(aa);
                    }
                }
            }
            AddIssues(IssuesList);
        }
コード例 #11
0
        public static List <AnalyzerItemBase> Analyze(Solution Solution, BusinessFlow BusinessFlow, bool includeMandatoryInputsAnalyze = true)
        {
            // Put all tests on BF here
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();

            // Check BF have Target Apps
            if (BusinessFlow.TargetApplications == null || BusinessFlow.TargetApplications.Count() == 0)
            {
                AnalyzeBusinessFlow ABF = new AnalyzeBusinessFlow();
                ABF.Description   = MissingTargetApp;
                ABF.UTDescription = "MissingTargetApp";
                ABF.Details       = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " doesn't have Target Application(s) defined";
                ABF.HowToFix      = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " in solution tab and add target apps";
                ABF.CanAutoFix    = AnalyzerItemBase.eCanFix.Yes; //  take it from solution
                ABF.FixItHandler  = FixMissingTargetApp;
                ABF.Status        = AnalyzerItemBase.eStatus.NeedFix;
                ABF.IssueType     = eType.Error;
                ABF.ItemParent    = "NA";
                ABF.mBusinessFlow = BusinessFlow;
                ABF.ItemName      = BusinessFlow.Name;
                ABF.Impact        = "Might be executed on wrong application if solution have more than 1 target application";
                ABF.mSolution     = Solution;
                ABF.ItemClass     = "BusinessFlow";
                ABF.Severity      = eSeverity.High;
                ABF.Selected      = true;
                IssuesList.Add(ABF);
            }

            // Check BF have activities
            if (BusinessFlow.Activities.Count() == 0)
            {
                AnalyzeBusinessFlow ABF = new AnalyzeBusinessFlow();
                ABF.UTDescription = "MissingActivities";
                ABF.Description   = MissingActivities;
                ABF.Details       = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " doesn't have " + GingerDicser.GetTermResValue(eTermResKey.Activities);
                ABF.HowToFix      = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " and add " + GingerDicser.GetTermResValue(eTermResKey.Activities) + " or remove this " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                ABF.CanAutoFix    = AnalyzerItemBase.eCanFix.No; // we can autofix by delete, but don't want to
                ABF.Status        = AnalyzerItemBase.eStatus.NeedFix;

                ABF.IssueType     = eType.Warning;
                ABF.ItemParent    = "NA";
                ABF.mBusinessFlow = BusinessFlow;
                ABF.Severity      = eSeverity.Medium;
                ABF.ItemClass     = "BusinessFlow";
                IssuesList.Add(ABF);
            }

            //check for mandatory inputs without value:
            if (includeMandatoryInputsAnalyze)
            {
                IssuesList.AddRange(AnalyzeForMissingMandatoryInputValues(BusinessFlow));
            }

            // Check BF have actions with legacy outputValidation

            AnalyzeBusinessFlow OutputValidationIssue = GetOutputvalidationErros(BusinessFlow);

            if (OutputValidationIssue.ReturnValues.Count > 0)
            {
                OutputValidationIssue.ItemName      = BusinessFlow.Name;
                OutputValidationIssue.Description   = LegacyOutPutValidationDescription;
                OutputValidationIssue.IssueType     = eType.Warning;
                OutputValidationIssue.mBusinessFlow = BusinessFlow;
                OutputValidationIssue.Severity      = eSeverity.Medium;
                OutputValidationIssue.ItemClass     = "BusinessFlow";
                OutputValidationIssue.CanAutoFix    = eCanFix.Maybe;
                OutputValidationIssue.Status        = AnalyzerItemBase.eStatus.NeedFix;
                OutputValidationIssue.FixItHandler  = FixOutputValidationIssue;
                IssuesList.Add(OutputValidationIssue);
            }
            return(IssuesList);
        }
コード例 #12
0
ファイル: AnalyzerUtils.cs プロジェクト: csuffyy/Ginger
        public List <string> RunBusinessFlowAnalyzer(BusinessFlow businessFlow, ObservableList <AnalyzerItemBase> issuesList)
        {
            List <string> usedVariablesInBF       = new List <string>();
            List <string> usedVariablesInActivity = new List <string>();

            ObservableList <DataSourceBase> DSList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>();

            foreach (AnalyzerItemBase issue in AnalyzeBusinessFlow.Analyze(WorkSpace.Instance.Solution, businessFlow))
            {
                AddIssue(issuesList, issue);
            }

            Parallel.ForEach(businessFlow.Activities, new ParallelOptions {
                MaxDegreeOfParallelism = 5
            }, activity =>
            {
                if (activity.Active)
                {
                    foreach (AnalyzerItemBase issue in AnalyzeActivity.Analyze(businessFlow, activity))
                    {
                        AddIssue(issuesList, issue);
                    }
                }

                Parallel.ForEach(activity.Acts, new ParallelOptions {
                    MaxDegreeOfParallelism = 5
                }, iaction =>
                {
                    Act action = (Act)iaction;
                    if (action.Active)
                    {
                        foreach (AnalyzerItemBase issue in AnalyzeAction.Analyze(businessFlow, activity, action, DSList))
                        {
                            AddIssue(issuesList, issue);
                        }
                    }

                    List <string> tempList = AnalyzeAction.GetUsedVariableFromAction(action);
                    usedVariablesInActivity.AddRange(tempList);
                });

                List <string> activityVarList = AnalyzeActivity.GetUsedVariableFromActivity(activity);
                usedVariablesInActivity.AddRange(activityVarList);
                ReportUnusedVariables(activity, usedVariablesInActivity, issuesList);
                usedVariablesInBF.AddRange(usedVariablesInActivity);
                usedVariablesInActivity.Clear();
            });

            //Get all the missing variable issues Grouped by Variable name
            var missingVariableIssuesGroupList = issuesList.Where(x => x.IssueCategory == AnalyzerItemBase.eIssueCategory.MissingVariable).GroupBy(x => x.IssueReferenceObject);

            foreach (var variableIssueGroup in missingVariableIssuesGroupList)
            {
                //If for specific variable, all the issues are for set variable action then we support Auto Fix
                var canAutoFix = variableIssueGroup.All(x => x is AnalyzeAction && ((AnalyzeAction)x).mAction.GetType() == typeof(ActSetVariableValue));

                if (canAutoFix)
                {
                    foreach (AnalyzeAction issue in variableIssueGroup)
                    {
                        issue.CanAutoFix    = AnalyzerItemBase.eCanFix.Yes;
                        issue.FixItHandler += MarkSetVariableActionAsInactive;
                    }
                }
            }

            ReportUnusedVariables(businessFlow, usedVariablesInBF, issuesList);

            return(usedVariablesInBF);
        }