public static TreeNode[] getNodes_WithoutFunctionsAttributes(Dictionary <SpringMvcController, TreeNode> treeNodesForloadedSpingMvcControllers) { var nodes = new List <TreeNode>(); foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { if (springMcvController.AutoWiredJavaObjects.Count == 0) { nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } return(nodes.ToArray()); }
public static TreeNode[] getNodes_UsingModelAttribute(Dictionary <SpringMvcController, TreeNode> treeNodesForloadedSpingMvcControllers) { var nodes = new List <TreeNode>(); foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { if (SpringMvcUtils.isMethodUsedInController(springMcvController, "ModelAttribute")) { nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } return(nodes.ToArray()); }
public static TreeNode[] getNodes_ThatUseGetParameter_RecursiveSearch(ICirData cirdata, Dictionary <SpringMvcController, TreeNode> treeNodesForloadedSpringMvcControllers) { var nodes = new List <TreeNode>(); foreach (SpringMvcController springMcvController in treeNodesForloadedSpringMvcControllers.Keys) { if (SpringMvcUtils.doesControllerFunctionCallFunction(cirdata, springMcvController, javaxGetParameterSignatures, true)) { nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpringMvcControllers[springMcvController])); } } return(nodes.ToArray()); }
/* * public TreeNode[] getNodes_() * { * var nodes = new List<TreeNode>(); * * return nodes.ToArray(); * } */ public void showLoadedControllers(string viewMode) { tvControllers.Nodes.Clear(); tvControllers.Sorted = true; try { switch (viewMode) { case "All Loaded Controllers": foreach (var treeNode in treeNodesForloadedSpingMvcControllers.Values) { tvControllers.Nodes.Add(treeNode); } break; case "With Functions Attributes": tvControllers.Nodes.AddRange(SpringMvcUtils.getNodes_WithFunctionsAttributes(treeNodesForloadedSpingMvcControllers)); break; case "Without Functions Attributes": tvControllers.Nodes.AddRange(SpringMvcUtils.getNodes_WithoutFunctionsAttributes(treeNodesForloadedSpingMvcControllers)); break; case "Using ModelAttribute": tvControllers.Nodes.AddRange(SpringMvcUtils.getNodes_UsingModelAttribute(treeNodesForloadedSpingMvcControllers)); break; case "Using RequestParam": foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { if (SpringMvcUtils.isMethodUsedInController(springMcvController, "RequestParam")) { tvControllers.Nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } break; case "With Functions Attributes and not using ModelAttribbute or RequestParam": foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { if (springMcvController.AutoWiredJavaObjects.Count > 0 && !SpringMvcUtils.isMethodUsedInController(springMcvController, "RequestParam") && !SpringMvcUtils.isMethodUsedInController(springMcvController, "ModelAttribute")) { tvControllers.Nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } break; case "Use GetParameter": foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { if (SpringMvcUtils.doesControllerFunctionCallFunction(cirData, springMcvController, CreateFindingsFromMvcData.javaxGetParameterSignatures, false)) { tvControllers.Nodes.Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } break; case "Use GetParameter (recursive function search)": tvControllers.Nodes.AddRange(CreateFindingsFromMvcData.getNodes_ThatUseGetParameter_RecursiveSearch(cirData, treeNodesForloadedSpingMvcControllers)); break; case "Classes binded via ModelAttribute": var listOfClassesBindedViaModelAttribute = new Dictionary <ICirClass, List <TreeNode> >(); foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { foreach (var springMvcParameter in springMcvController.AutoWiredJavaObjects) { if (springMvcParameter.autoWiredMethodUsed == "ModelAttribute") { if (springMvcParameter.className == null) { DI.log.error("in showLoadedControllers, springMvcParameter.autoWiredMethodUsed = ModelAttribute , but springMvcParameter.className == null"); } else if (cirData.dClasses_bySignature.ContainsKey(springMvcParameter.className)) { var bindedCirClass = cirData.dClasses_bySignature[springMvcParameter.className]; if (false == listOfClassesBindedViaModelAttribute.ContainsKey(bindedCirClass)) { listOfClassesBindedViaModelAttribute.Add(bindedCirClass, new List <TreeNode>()); } listOfClassesBindedViaModelAttribute[bindedCirClass].Add(O2Forms.cloneTreeNode(treeNodesForloadedSpingMvcControllers[springMcvController])); } } } } foreach (var bindedCirClass in listOfClassesBindedViaModelAttribute.Keys) { O2Forms.newTreeNode(tvControllers.Nodes, bindedCirClass.Signature, 0, bindedCirClass).Nodes.AddRange(listOfClassesBindedViaModelAttribute[bindedCirClass].ToArray()); } break; case "Url => Classes binded via ModelAttribute": foreach (SpringMvcController springMcvController in treeNodesForloadedSpingMvcControllers.Keys) { foreach (var springMvcParameter in springMcvController.AutoWiredJavaObjects) { if (springMvcParameter.autoWiredMethodUsed == "ModelAttribute") { if (cirData.dClasses_bySignature.ContainsKey(springMvcParameter.className)) { var bindedCirClass = cirData.dClasses_bySignature[springMvcParameter.className]; var nodeText = string.Format("{0} => {1}", springMcvController.HttpRequestUrl, bindedCirClass.Signature); O2Forms.newTreeNode(tvControllers.Nodes, nodeText, 0, bindedCirClass); } } } } break; default: setContollersViewMode(); break; } lbNumberOfControllersLoaded.Text = loadedSpringMvcControllers.Count.ToString(); lbNumberOfNodesShown.Text = string.Format("Showing {0} of {1} ", tvControllers.Nodes.Count, treeNodesForloadedSpingMvcControllers.Keys.Count); } catch (Exception ex) { DI.log.error("in showLoadedControllers:{0}", ex.Message); } }