@Test public void testDoSearchNotFound() { Mockito.when(groupListHelper.search(ENTITY_TYPE, "test")) .thenReturn(Collections.emptySet()); List<String> entitytypes = new ArrayList<String>(); entitytypes.add(ENTITY_TYPE); Set<JsonEntityBean> beans = entitiesRESTController.doSearch(req, res, "test", entitytypes); Assert.assertTrue(beans.isEmpty()); }
@PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) public Set<JsonEntityBean> doSearch( HttpServletRequest request, HttpServletResponse response, @RequestParam("q") String query, @RequestParam("entityType[]") List<String> entityTypes) { Set<JsonEntityBean> results = new HashSet<JsonEntityBean>(); for (String entityType : entityTypes) { Set<JsonEntityBean> entities = groupListHelper.search(entityType, query); results.addAll(entities); } return results; }
EntitiesRESTController { @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) public Set<JsonEntityBean> doSearch( HttpServletRequest request, HttpServletResponse response, @RequestParam("q") String query, @RequestParam("entityType[]") List<String> entityTypes) { Set<JsonEntityBean> results = new HashSet<JsonEntityBean>(); for (String entityType : entityTypes) { Set<JsonEntityBean> entities = groupListHelper.search(entityType, query); results.addAll(entities); } return results; } }
EntitiesRESTController { @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) public Set<JsonEntityBean> doSearch( HttpServletRequest request, HttpServletResponse response, @RequestParam("q") String query, @RequestParam("entityType[]") List<String> entityTypes) { Set<JsonEntityBean> results = new HashSet<JsonEntityBean>(); for (String entityType : entityTypes) { Set<JsonEntityBean> entities = groupListHelper.search(entityType, query); results.addAll(entities); } return results; }  }
EntitiesRESTController { @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) public Set<JsonEntityBean> doSearch( HttpServletRequest request, HttpServletResponse response, @RequestParam("q") String query, @RequestParam("entityType[]") List<String> entityTypes) { Set<JsonEntityBean> results = new HashSet<JsonEntityBean>(); for (String entityType : entityTypes) { Set<JsonEntityBean> entities = groupListHelper.search(entityType, query); results.addAll(entities); } return results; }  @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) JsonEntityBean findEntity(
            HttpServletRequest request,
            HttpServletResponse response,
            @PathVariable("entityType") String entityType,
            @PathVariable("entityId") String entityId); @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) Set<JsonEntityBean> doSearch(
            HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam("q") String query,
            @RequestParam("entityType[]") List<String> entityTypes); }
EntitiesRESTController { @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) public Set<JsonEntityBean> doSearch( HttpServletRequest request, HttpServletResponse response, @RequestParam("q") String query, @RequestParam("entityType[]") List<String> entityTypes) { Set<JsonEntityBean> results = new HashSet<JsonEntityBean>(); for (String entityType : entityTypes) { Set<JsonEntityBean> entities = groupListHelper.search(entityType, query); results.addAll(entities); } return results; }  @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) JsonEntityBean findEntity(
            HttpServletRequest request,
            HttpServletResponse response,
            @PathVariable("entityType") String entityType,
            @PathVariable("entityId") String entityId); @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) Set<JsonEntityBean> doSearch(
            HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam("q") String query,
            @RequestParam("entityType[]") List<String> entityTypes);  }