@RequestMapping(params = "addNode", method = RequestMethod.POST) public String addNode( @ModelAttribute("newNode") @Valid Node newNode, BindingResult bindingResult, Model uiModel, RedirectAttributes redirectAttributes, Locale locale) { validateNode(newNode.getName(), newNode.getAddress(), bindingResult); if (bindingResult.hasErrors()) { uiModel.addAttribute( "message", new Message( "error", messageSource.getMessage("label_node_add_failure", new Object[] {}, locale))); uiModel.addAttribute("newNode", newNode); return "nodes/list"; } // uiModel.asMap().clear(); // redirectAttributes.addFlashAttribute("message") uiModel.addAttribute( "message", new Message( "success", messageSource.getMessage("label_node_add_success", new Object[] {}, locale))); nodeService.save(newNode); uiModel.addAttribute("newNode", new Node()); return "nodes/list"; }
private List<NodeExt> checkAccessiblity(List<Node> nodes) { List<NodeExt> nodeExtList = new ArrayList<NodeExt>(); for (Node node : nodes) { NodeExt nodeExt = new NodeExt(node); nodeExt.setAccessible(crawlerConnector.pingNode(node.toString())); nodeExtList.add(nodeExt); } return nodeExtList; }