private void LoadGridData() { //TODO: check if Summary view is used... switch (mWindowMode) { case eWindowMode.Configuration: grdVariables.Title = "'" + mBusinessFlow.Name + "' Run " + GingerDicser.GetTermResValue(eTermResKey.Variables); ObservableList <VariableBase> bfInputVariables = mBusinessFlow.GetBFandActivitiesVariabeles(true, true); grdVariables.DataSourceList = VariableBase.SortByMandatoryInput(bfInputVariables); //**Legacy--- set the Variabels can be used- user should use Global Variabels/ Output Variabels instead ObservableList <string> optionalVars = new ObservableList <string>(); optionalVars.Add(string.Empty); //default value for clear selection foreach (VariableBase var in ((GingerExecutionEngine)mGingerRunner.Executor).GetPossibleOutputVariables(WorkSpace.Instance.RunsetExecutor.RunSetConfig, mBusinessFlow, includeGlobalVars: true, includePrevRunnersVars: false)) { optionalVars.Add(var.Name); } //allow setting vars options only to variables types which supports setting value foreach (VariableBase inputVar in bfInputVariables) { if (inputVar.SupportSetValue) { inputVar.PossibleVariables = optionalVars; } } //Set Output Variabels can be used ObservableList <VariableBase> optionalOutputVars = new ObservableList <VariableBase>(); foreach (VariableBase outputVar in ((GingerExecutionEngine)mGingerRunner.Executor).GetPossibleOutputVariables(WorkSpace.Instance.RunsetExecutor.RunSetConfig, mBusinessFlow, includeGlobalVars: false, includePrevRunnersVars: true)) { optionalOutputVars.Add(outputVar); } //allow setting output vars options only to variables types which supports setting value foreach (VariableBase inputVar in bfInputVariables) { if (inputVar.SupportSetValue) { inputVar.PossibleOutputVariables = optionalOutputVars; } } break; case eWindowMode.SummaryView: grdVariables.Title = "'" + mBusinessFlowExecSummary.BusinessFlowName + "' Run " + GingerDicser.GetTermResValue(eTermResKey.Variables); grdVariables.DataSourceList = mBusinessFlowExecSummary.ExecutionVariabeles; break; } }
private void UpdateOldOutputVariableMappedValues(VariableBase var) { //For BusinessFlowCustomizedRunVariables the output variable mappedvalue was storing only variable GUID //But if there 2 variables with same name then users were not able to map it to the desired instance //So mappedValue for output variable type mapping was enhanced to store the BusinessFlowInstanceGUID_VariabledGuid //Below code is for backward support for old runset with output variable mapping having only guid. try { if (var.MappedOutputType == VariableBase.eOutputType.OutputVariable && !var.MappedOutputValue.Contains("_")) { for (int i = AllPreviousBusinessFlowRuns.Count - 1; i >= 0; i--)//doing in reverse for sorting by latest value in case having the same var more than once { Guid guid = AllPreviousBusinessFlowRuns[i].BusinessFlowGuid; BusinessFlow bf = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <BusinessFlow>(guid); if (bf.GetBFandActivitiesVariabeles(false, false, true).Where(x => x.Guid.ToString() == var.MappedOutputValue).FirstOrDefault() != null) { var.MappedOutputValue = AllPreviousBusinessFlowRuns[i].BusinessFlowInstanceGuid + "_" + var.MappedOutputValue; break; } } } } catch (Exception ex) { Reporter.ToLog(eLogLevel.WARN, "Exception occured when trying to update outputvariable mapped value ", ex); } }
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); }
private void LoadGridData() { //TODO: check if Summary view is used... switch (mWindowMode) { case eWindowMode.Configuration: grdVariables.Title = "'" + mBusinessFlow.Name + "' Run " + GingerDicser.GetTermResValue(eTermResKey.Variables); ObservableList <VariableBase> bfInputVariables = mBusinessFlow.GetBFandActivitiesVariabeles(true, true); //set the Output vars can be used ObservableList <string> optionalOutputVars = new ObservableList <string>(); optionalOutputVars.Add(string.Empty); //default value for clear selection //solution vars if (BusinessFlow.SolutionVariables != null) { foreach (VariableBase var in BusinessFlow.SolutionVariables) { optionalOutputVars.Add(var.Name); } } //prev bf's output vars foreach (BusinessFlow bf in mPrevBusinessFlowsInFlow) { foreach (VariableBase var in bf.GetBFandActivitiesVariabeles(true, false, true)) { optionalOutputVars.Add(var.Name); } } //allow setting output vars options only to variables types which supports setting value foreach (VariableBase inputVar in bfInputVariables) { if (inputVar.SupportSetValue) { inputVar.PossibleOutputVariables = optionalOutputVars; } } grdVariables.DataSourceList = bfInputVariables; break; case eWindowMode.SummaryView: grdVariables.Title = "'" + mBusinessFlowExecSummary.BusinessFlowName + "' Run " + GingerDicser.GetTermResValue(eTermResKey.Variables); grdVariables.DataSourceList = mBusinessFlowExecSummary.ExecutionVariabeles; break; } }
/// <summary> /// Should be deleted after switch will be fully done to serialized objects /// </summary> public ReportInfo(ProjEnvironment Env, BusinessFlow BF, GingerRunner GR = null) // to remove after discussion !!! { mProjEnvironment = Env; mBFESs = new ObservableList <BusinessFlowExecutionSummary>(); BusinessFlowExecutionSummary BFES = new BusinessFlowExecutionSummary(); BFES.BusinessFlowName = BF.Name; BFES.BusinessFlowRunDescription = BF.RunDescription; BFES.Status = BF.RunStatus; BFES.Activities = BF.Activities.Count; BFES.Actions = BF.GetActionsCount(); BFES.Validations = BF.GetValidationsCount(); BFES.ExecutionVariabeles = BF.GetBFandActivitiesVariabeles(true); BFES.BusinessFlow = BF; BFES.Selected = true; if (GR != null) { BFES.BusinessFlowExecLoggerFolder = Path.Combine(GR.ExecutionLoggerManager.ExecutionLogfolder, BF.ExecutionLogFolder); } if (mBFESs != null) { mBFESs.Clear(); } mBFESs.Add(BFES); mGingersMultiRun = null; // Set all General info if (BF.Elapsed != null) { TotalExecutionTime = TimeSpan.FromSeconds((long)BF.ElapsedSecs); } else { TotalExecutionTime = new TimeSpan(0); } ExecutionElapsedTime = TotalExecutionTime; DateCreated = DateTime.Now.ToString(); ExecutionEnv = mProjEnvironment.Name; DateCreatedShort = DateTime.Now.ToString("MM/dd"); }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList()) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList()) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.ContainingFolder = businessFlow.ContainingFolder; BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { foreach (VariableBase varb in BFCopy.GetBFandActivitiesVariabeles(true)) { VariableBase runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.ParentGuid == varb.ParentGuid && v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar == null)//for supporting dynamic run set XML in which we do not have GUID { runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar == null) { runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.Name == varb.Name).FirstOrDefault(); } } if (runVar != null) { RepositoryItemBase.ObjectsDeepCopy(runVar, varb); varb.DiffrentFromOrigin = runVar.DiffrentFromOrigin; varb.MappedOutputVariable = runVar.MappedOutputVariable; } else { varb.DiffrentFromOrigin = false; varb.MappedOutputVariable = null; } } } BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runnerFlows.Add(BFCopy); } } runner.IsUpdateBusinessFlowRunList = true; runner.BusinessFlows = runnerFlows; }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent p in runner.ApplicationAgents) { if (p.AgentName != null) { p.Agent = (from a in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where a.Name == p.AgentName select a).FirstOrDefault(); } } //Load the biz flows runner.BusinessFlows.Clear(); foreach (BusinessFlowRun bf in runner.BusinessFlowsRunList) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow BF1 = (from bfr in businessFlows where bfr.Guid == bf.BusinessFlowGuid select bfr).FirstOrDefault(); if (BF1 == null) { BF1 = (from bfr in businessFlows where bfr.Name == bf.BusinessFlowName select bfr).FirstOrDefault(); } if (BF1 == null) { Reporter.ToUser(eUserMsgKeys.CannontFindBusinessFlow, bf.BusinessFlowName); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)BF1.CreateCopy(false); BFCopy.Reset(); BFCopy.Active = bf.BusinessFlowIsActive; BFCopy.Mandatory = bf.BusinessFlowIsMandatory; BFCopy.AttachActivitiesGroupsAndActivities(); if (bf.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = bf.BusinessFlowInstanceGuid; } if (bf.BusinessFlowCustomizedRunVariables != null && bf.BusinessFlowCustomizedRunVariables.Count > 0) { foreach (VariableBase varb in BFCopy.GetBFandActivitiesVariabeles(true)) { VariableBase runVar = bf.BusinessFlowCustomizedRunVariables.Where(v => v.ParentGuid == varb.ParentGuid && v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar != null) { RepositoryItemBase.ObjectsDeepCopy(runVar, varb); varb.DiffrentFromOrigin = runVar.DiffrentFromOrigin; varb.MappedOutputVariable = runVar.MappedOutputVariable; } else { varb.DiffrentFromOrigin = false; varb.MappedOutputVariable = null; } } } BFCopy.RunDescription = bf.BusinessFlowRunDescription; BFCopy.BFFlowControls = bf.BFFlowControls; runner.BusinessFlows.Add(BFCopy); } } }
public void InitRunner(GingerRunner runner, GingerExecutionEngine ExecutorEngine) { //Configure Runner for execution runner.Status = eRunStatus.Pending; runner.Executor = ExecutorEngine; ConfigureRunnerForExecution((GingerExecutionEngine)runner.Executor); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList()) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList()) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.ContainingFolder = businessFlow.ContainingFolder; BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { ObservableList <VariableBase> allBfVars = BFCopy.GetBFandActivitiesVariabeles(true); Parallel.ForEach(businessFlowRun.BusinessFlowCustomizedRunVariables, customizedVar => { //This is needed to handle updating the outputvariable mappedoutvalues to new style UpdateOldOutputVariableMappedValues(customizedVar); VariableBase originalVar = allBfVars.Where(v => v.ParentGuid == customizedVar.ParentGuid && v.Guid == customizedVar.Guid).FirstOrDefault(); if (originalVar == null)//for supporting dynamic run set XML in which we do not have GUID { originalVar = allBfVars.Where(v => v.ParentName == customizedVar.ParentName && v.Name == customizedVar.Name).FirstOrDefault(); if (originalVar == null) { originalVar = allBfVars.Where(v => v.Name == customizedVar.Name).FirstOrDefault(); } } if (originalVar != null) { CopyCustomizedVariableConfigurations(customizedVar, originalVar); } }); } AllPreviousBusinessFlowRuns.Add(businessFlowRun); BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runnerFlows.Add(BFCopy); } } runner.Executor.IsUpdateBusinessFlowRunList = true; runner.Executor.BusinessFlows = runnerFlows; }