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); }
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); }