@Test public void shouldGetTopLevelNodesForRequestedQuery() { String query = "Node1"; List<SupervisoryNode> supervisoryNodes = new ArrayList<>(); when(supervisoryNodeService.searchTopLevelSupervisoryNodesByName(query)).thenReturn(supervisoryNodes); List<SupervisoryNode> filteredNodes = controller.searchTopLevelSupervisoryNodesByName(query); verify(supervisoryNodeService).searchTopLevelSupervisoryNodesByName(query); assertThat(filteredNodes, is(supervisoryNodes)); }
@RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") public List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param) { return supervisoryNodeService.searchTopLevelSupervisoryNodesByName(param); }
SupervisoryNodeController extends BaseController { @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") public List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param) { return supervisoryNodeService.searchTopLevelSupervisoryNodesByName(param); } }
SupervisoryNodeController extends BaseController { @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") public List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param) { return supervisoryNodeService.searchTopLevelSupervisoryNodesByName(param); }  }
SupervisoryNodeController extends BaseController { @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") public List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param) { return supervisoryNodeService.searchTopLevelSupervisoryNodesByName(param); }  @RequestMapping(value = "/supervisory-nodes", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_USER')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "/supervisory-nodes/list", method = GET) ResponseEntity<OpenLmisResponse> getAllReadOnly(); @RequestMapping(value = "/paged-search-supervisory-nodes", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> searchSupervisoryNode(@RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
                                                                @RequestParam(required = true) String param,
                                                                @RequestParam(required = true) Boolean parent); @RequestMapping(value = "/supervisory-nodes/{id}", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") SupervisoryNode getById(@PathVariable(value = "id") Long id); @RequestMapping(value = "/search-supervisory-nodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE, MANAGE_REQUISITION_GROUP')") List<SupervisoryNode> getFilteredNodes(@RequestParam(value = "searchParam") String param); @RequestMapping(value = "/supervisory-nodes", method = POST) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> insert(@RequestBody SupervisoryNode supervisoryNode,
                                                 HttpServletRequest request); @RequestMapping(value = "/supervisory-nodes/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> update(@RequestBody SupervisoryNode supervisoryNode,
                                                 @PathVariable(value = "id") Long supervisoryNodeId,
                                                 HttpServletRequest request); @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param); }
SupervisoryNodeController extends BaseController { @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") public List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param) { return supervisoryNodeService.searchTopLevelSupervisoryNodesByName(param); }  @RequestMapping(value = "/supervisory-nodes", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_USER')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "/supervisory-nodes/list", method = GET) ResponseEntity<OpenLmisResponse> getAllReadOnly(); @RequestMapping(value = "/paged-search-supervisory-nodes", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> searchSupervisoryNode(@RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
                                                                @RequestParam(required = true) String param,
                                                                @RequestParam(required = true) Boolean parent); @RequestMapping(value = "/supervisory-nodes/{id}", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") SupervisoryNode getById(@PathVariable(value = "id") Long id); @RequestMapping(value = "/search-supervisory-nodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE, MANAGE_REQUISITION_GROUP')") List<SupervisoryNode> getFilteredNodes(@RequestParam(value = "searchParam") String param); @RequestMapping(value = "/supervisory-nodes", method = POST) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> insert(@RequestBody SupervisoryNode supervisoryNode,
                                                 HttpServletRequest request); @RequestMapping(value = "/supervisory-nodes/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPERVISORY_NODE')") ResponseEntity<OpenLmisResponse> update(@RequestBody SupervisoryNode supervisoryNode,
                                                 @PathVariable(value = "id") Long supervisoryNodeId,
                                                 HttpServletRequest request); @RequestMapping(value = "/topLevelSupervisoryNodes", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SUPPLY_LINE')") List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(@RequestParam(value = "searchParam") String param); static final String SUPERVISORY_NODES; }