private static InspectionResult Execute(IWorkflowModel workflow, Rule ruleInstance) { return(new InspectionResult() { RecommendationMessage = "Success!" }); }
/// <summary> /// Parametri di avvio del workflow. /// </summary> /// <param name="parameterModel">contiente un modello che deriva dalla interfaccia generica IWorkflowModel. /// Le classi esistenti sono le seguenti: /// - ArchiveModel /// - CategoryModel /// - ContactModel /// - DocumentModel /// - DocumentUnitModel /// - FascicleModel /// - PaperworkModel /// - ReferenceModel /// - SignerModel /// </param> /// <param name="parameterName">Determina il nome del parametro. Attenzione per popolare i valori corretti usare la classe <see cref="Parameters.WorkflowParameterNames"/> </param> public WorkflowParameterModel(IWorkflowModel parameterModel, string parameterName) : base(Guid.NewGuid()) { Name = parameterModel?.GetType().Name; ParameterName = parameterName; ParameterModel = parameterModel; }
// This is the function that executes for each activity in all the files. Might impact performance. // The rule instance is the rule provided above which also contains the user-configured data. private static InspectionResult Inspect(IWorkflowModel workflowModel, Rule ruleInstance) { var messageList = new List <string>(); var rootActivity = workflowModel.Root; bool isLogmessagePresent = false; isLogmessagePresent = ContainLogMessage(rootActivity); if (!isLogmessagePresent) { messageList.Add($"LogMessage not used in workflow {workflowModel.DisplayName}."); } if (messageList.Count > 0) { return(new InspectionResult() { ErrorLevel = ruleInstance.ErrorLevel, HasErrors = true, RecommendationMessage = ruleInstance.RecommendationMessage, // When inspecting a model, a rule can generate more than one message. Messages = messageList }); } else { return(new InspectionResult() { HasErrors = false }); } }
private InspectionResult InspectVariableForString(IWorkflowModel WorkflowToInspect, Rule configuredRule) { var messageList = new List <InspectionMessage>(); foreach (var activity in WorkflowToInspect.Root.Children) { if (!string.IsNullOrEmpty(activity.Type) && activity.Type.Contains("MessageBox")) { messageList.Add(new InspectionMessage() { Message = $"MessageBox found in workflow {WorkflowToInspect.DisplayName} with display name as {activity.DisplayName}." }); } } if (messageList.Count > 0) { return(new InspectionResult() { HasErrors = true, InspectionMessages = messageList, RecommendationMessage = "Message box should not be present during deployment.", ErrorLevel = configuredRule.ErrorLevel }); } return(new InspectionResult() { HasErrors = false }); }
/// <summary> /// This constructor has to be called from the component managing the navigation context stack. /// </summary> public NavigationContext(WorkflowState workflowState, string displayLabel, NavigationContext predecessor, IWorkflowModel workflowModel) { _workflowState = workflowState; _displayLabel = displayLabel; _predecessor = predecessor; if (workflowModel != null) { _workflowModelId = workflowModel.ModelId; _models.Add(workflowModel.ModelId, workflowModel); } }
private static InspectionResult Inspect(IWorkflowModel workflowModel, Rule ruleInstance) { var regex = new Regex(alphabeticRegex); var messageList = new List <string>(); if (workflowModel.DisplayName.Length < 3 || workflowModel.DisplayName.Length > 10) { messageList.Add(string.Format("Workflow Name: {0} should be no shorter than 3 characters and not exceed 10 characters.", workflowModel.DisplayName)); } //The name should contain ONLY alphabetic characters. if (!regex.IsMatch(workflowModel.DisplayName)) { messageList.Add(string.Format("Workflow Name: {0} doesnt match with alphabetic regex.", workflowModel.DisplayName)); } foreach (var workflowArgs in workflowModel.Arguments) { //The name should contain ONLY alphabetic characters. if (!regex.IsMatch(workflowArgs.DisplayName)) { messageList.Add(string.Format("Workflow Argument: {0} doesnt match with alphabetic regex.", workflowArgs.DisplayName)); } //checking if variables they fall within length restraints if (workflowArgs.DisplayName.Length < 3 || workflowArgs.DisplayName.Length > 10) { messageList.Add(string.Format("Workflow Argument: {0} should be no shorter than 3 characters and not exceed 10 characters.", workflowArgs.DisplayName)); } } if (messageList.Count > 0) { return(new InspectionResult() { ErrorLevel = ruleInstance.ErrorLevel, HasErrors = true, RecommendationMessage = ruleInstance.RecommendationMessage, Messages = messageList, DocumentationLink = ruleInstance.DocumentationLink }); } else { return(new InspectionResult() { HasErrors = false }); } }
private static InspectionResult Inspect(IWorkflowModel workflowModel, Rule ruleInstance) { var messageList = new List <string>(); var regex = new Regex(moduleNameRegex); if (workflowModel.DisplayName.ToLower().Equals("main.xaml") && !regex.IsMatch(workflowModel.DisplayName)) { messageList.Add(workflowModel.DisplayName + " should be all lowercase and seperated by underscores contain only alphabetic characters."); } //enforce file lengths if (workflowModel.DisplayName.Length < 3) { messageList.Add(workflowModel.DisplayName + " should be no shorter than 3 characters."); } if (workflowModel.DisplayName.Length > 30) { messageList.Add(workflowModel.DisplayName + " should not exceed 30 characters."); } if (messageList.Count > 0) { return(new InspectionResult() { ErrorLevel = ruleInstance.ErrorLevel, HasErrors = true, RecommendationMessage = ruleInstance.RecommendationMessage, Messages = messageList, DocumentationLink = ruleInstance.DocumentationLink }); } else { return(new InspectionResult() { HasErrors = false }); } }
private static InspectionResult Inspect(IWorkflowModel workflowModel, Rule ruleInstance) { var messageList = new List <string>(); //stuff that deals with just the activity messageList.Add(string.Format("workflowModel.DisplayName: {0}", workflowModel.DisplayName)); messageList.Add(string.Format("workflowModel.RelativePath: {0}", workflowModel.RelativePath)); messageList.Add(string.Format("workflowModel.Root.DisplayName: {0}", workflowModel.Root.DisplayName)); foreach (var args in workflowModel.Arguments) { messageList.Add(string.Format("workflowModel arg: {0}", args)); } foreach (var args in workflowModel.ImportedNamespaces) { messageList.Add(string.Format("imported namespaces: {0}", args)); } if (messageList.Count > 0) { return(new InspectionResult() { ErrorLevel = ruleInstance.ErrorLevel, HasErrors = true, RecommendationMessage = ruleInstance.RecommendationMessage, Messages = messageList, DocumentationLink = ruleInstance.DocumentationLink }); } else { return(new InspectionResult() { HasErrors = false }); } }