// Suspect Links /* Program to generate a report of all suspect links within a specified CR and to reset all of the suspect links if they are determined to be "clean". */ Object o = current //Declares an object "o" to be the current object DB chooseCR = create "Choose your CR" //Creates a dialog box called "chooseCR" string mix //Creates a string called "mix" string types[] = { "CR", "CRG"} //Creates a string array called "types" Filter f1 //Creates the first filter, called f1 DBE chooseRadio = radioBox(chooseCR, "What kind of CR is it?", types, 2) //Creates a box of radio buttons called "pick" which allows the user to choose whether it is a CR or a CRG DBE pick = field(chooseCR, "Enter number here:", null, 40) //Creates a field into which the user can type data (the number of the CR/CRG void clearAllLinks(DB checkLink) //Creates a method called "clearAllLinks" { eval_("#include ") //Runs the program to clear all of the suspect links void closeFilter(DB deleteFilter) //Creates a method called "closeFilter" { filtering off //Turns filtering off delete(f1) //Deletes the filter "f1" } DB deleteFilter = create "Delete the Filter?" //Creates a Dialog Box called "deleteFilter" label(deleteFilter, "After the suspect links are cleared, click on 'Delete' to close and delete the filter.") //Creates a label for the 'deleteFilter' box DBE buttonB = ok(deleteFilter, "Delete", closeFilter) //Creates a button called "buttonB" which, when pressed, runs the "closeFilter" method show deleteFilter //shows the "deleteFilter" Dialog Box } void filter(string mix, Object o) //Creates a method called "filter" { f1 = contains(attribute "CR", mix, false) //Initializes the filter "f1" set(current, f1) //Sets the filter f1 to work on the module "current" filtering on //Turns filtering on { pragma runLim, 0 //Prevent dxl timeout dialog Module mParent = current //Sets the module "mParent" to be the current module if (mParent != null && type(mParent) == (NLS_("Formal"))) //This is only relevant if it is run from a formal module { Object a //Creates an object a fnFiltersOff(mParent) //Operates "fnFiltersOff" on mParent for a in entire mParent do //Process module { reject a //Rejects a if (fnDetermineSuspectOutLinks(a) == true) //only relevant if suspect out-links exist { accept a //Accepts a } } fnFiltersOn(mParent) //Operates "fnFiltersOn" on mParen } else { warningBox(dbExplorer, LS_("String_You_must_have_a_formal_module_to_run_this_utility",NLSTEMP_("You must have a formal module to run this utility."))) // warn user } } { pragma runLim, 0 // prevent dxl timeout dialog Module mParent = current //Sets mParent to be the current module if (mParent != null && type(mParent) == (NLS_("Formal"))) // only relevant if performed from a formal module { Object b fnFiltersOff(mParent) //Runs fnFiltersOff on mParent for b in entire mParent do // process module { reject b //Rejects b if (fnDetermineSuspectInLinks(b) == true) // only relevant if suspect in-links exist { accept b //Accept b } } fnFiltersOn(mParent) //Runs fnFiltersOn on mParent } else { warningBox(dbExplorer, LS_("String_You_must_have_a_formal_module_to_run_this_utility",NLSTEMP_("You must have a formal module to run this utility."))) // warn user } } f1 = contains(attribute "CR", mix, false) //Creates a filter called f1 that is if the "CR" column contains "mix" set(current, f1) //Sets f1 to the current module filtering on //Turns filtering on DB checkLink = create "Check the Suspect Links" //Creates the Dialog Box "checkLink" label(checkLink, "Please check all of the suspect links listed in the module window. When you are finished, click on 'Clear' to clear all of the suspect links.") //creates a label for the box "checkLink" DBE buttonA = ok(checkLink, "Clear", clearAllLinks) //Creates a button called "buttonA" which runs the "clearAllLinks" method when it is clicked show checkLink //shows the checkLink dialog box } void getType(DB chooseCR) //Creates a method called "getType" { string types[2] = { "CR", "CRG"} //Stores the values in the radio box hide chooseCR //hides the chooseCR dialog Box int i = get chooseRadio //Collects a number to show which radio button is selected string forms = types[i] //Creates a string called "forms" and initializes it to the string variable that was selected string jo = get pick //Creates a string called "jo" which is initialized to the number in the "pick" box int j = intOf(jo) //Creates an int called "j" which is initialized to be "jo" mix = forms jo //Initializes "mix" to the combination of "forms" and "jo" bool check = confirm(chooseCR, "You want to look inside " mix ". Is this correct?", msgQuery) //Creates a boolean called "check" and makes a dialog box appear with which to initialize "check" if(check) //If "check" is true, then the next two lines will be run { filter(mix, o) //Runs the filter method and passes "mix" and "o" to the method hide chooseCR //Hides the chooseCR dialog box } else { show chooseCR //Shows the chooseCR dialog box } } apply(chooseCR, "Ok", getType) //Puts an "ok" button in the chooseCR box, which runs the "getType" method when it is clicked show chooseCR //Shows the chooseCR dialog box //Sho