public bool ValidateChecks(ucEAValidator uc, List <Check> selectedchecks, TSF_EA.Element scopeElement, TSF_EA.Diagram EA_diagram)
        {
            // Clear the log
            this.clearEAOutput();

            // Check if the Enterprise Architect repository type is allowed
            if (!(this.settings.AllowedRepositoryTypes.Contains(this.model.repositoryType)))
            {
                MessageBox.Show($"Connectiontype of EA project not allowed: {this.model.repositoryType.ToString()}"
                                + $"{Environment.NewLine}Please connect to an EA project of an allowed repository type");
                this.addLineToEAOutput("Connectiontype of EA project not allowed: ", this.model.repositoryType.ToString());
                return(false);
            }
            this.addLineToEAOutput("Connected to: ", this.model.repositoryType.ToString());

            // Check if any checks are selected
            int numberOfChecks = selectedchecks.Count();

            uc.InitProgressbar(numberOfChecks);
            // Check if the Enterprise Architect connection is sql
            this.addLineToEAOutput("Number of checks to validate: ", numberOfChecks.ToString());
            if (numberOfChecks > 0)
            {
                // Clear list of validations
                this.validations.Clear();

                // Perform the selected checks and return the validation-results
                this.addLineToEAOutput("START of Validations...", "");

                //get the ID's of the scope package tree
                var scopePackage = scopeElement as TSF_EA.Package;
                if (scopePackage != null)
                {
                    this.scopePackageIDs = scopePackage.packageTreeIDString;
                }
                else
                {
                    //make sure it won't hurt if used in a query anyway
                    this.scopePackageIDs = "0";
                }
                //reset status for all checks
                this.checks.ToList().ForEach(x => x.resetStatus());
                // Validate all selected checks
                foreach (var check in selectedchecks)
                {
                    this.addLineToEAOutput("Validating check: ", check.CheckDescription);
                    this.validations.AddRange(check.Validate(scopeElement, EA_diagram, this.settings.excludeArchivedPackages, this.scopePackageIDs));
                    uc.refreshCheck(check);
                    uc.IncrementProgressbar();
                }

                this.addLineToEAOutput("END of Validations.", "");
                this.addLineToEAOutput("Show list with validation results.", "");
            }

            // If one (or more) check gave an ERROR, then notify the user about it
            return(selectedchecks.Any(x => x.Status == CheckStatus.Error));
        }
示例#2
0
 private void handleHandleDestroyed(object sender, EventArgs e)
 {
     // Handle must be present for clean destroy
     this._ucEAValidator = null;
 }
示例#3
0
        public bool ValidateChecks(ucEAValidator uc, List <Check> selectedchecks, TSF_EA.Element EA_element, TSF_EA.Diagram EA_diagram)
        {
            // Clear the log
            clearEAOutput();

            // Check if the Enterprise Architect connection is sql
            var repositoryType = this._model.repositoryType.ToString();

            if (!(this.settings.AllowedRepositoryTypes.Contains(repositoryType)))
            {
                MessageBox.Show("Connectiontype of EA project not allowed: " + repositoryType + Environment.NewLine + "Please connect to another EA project.");
                addLineToEAOutput("Connectiontype of EA project not allowed: ", repositoryType);
                return(false);
            }
            addLineToEAOutput("Connected to: ", _model.repositoryType.ToString());

            // Check if any checks are selected
            int numberOfChecks = selectedchecks.Count();

            uc.InitProgressbar(numberOfChecks);
            // Check if the Enterprise Architect connection is sql
            addLineToEAOutput("Number of checks to validate: ", numberOfChecks.ToString());
            if (numberOfChecks > 0)
            {
                // Clear list of validations
                validations.Clear();

                // Perform the selected checks and return the validation-results
                addLineToEAOutput("START of Validations...", "");

                // Validate all selected checks
                foreach (var check in selectedchecks)
                {
                    addLineToEAOutput("Validating check: ", check.CheckDescription);

                    validations.AddRange(check.Validate(this, EA_element, EA_diagram, uc.getExcludeArchivedPackagesState()));
                    var obj = checks.FirstOrDefault(x => x.CheckId == check.CheckId);
                    if (obj != null)
                    {
                        obj.SetStatus(check.Status);
                    }

                    uc.IncrementProgressbar();
                }

                addLineToEAOutput("END of Validations.", "");
                addLineToEAOutput("Show list with validation results.", "");
            }

            // If one (or more) check gave an ERROR, then notify the user about it
            var objWithError = checks.FirstOrDefault(x => x.Status == "ERROR");

            if (objWithError != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }