@Test public void getAuthoritiesItems() { AuthorityDTO authority = createAuthority(); List<String> items = new ArrayList<String>(); items.add("1"); authority.setItems(items); List<AuthorityDTO> authorities = new ArrayList<AuthorityDTO>(); authorities.add(authority); AuthoritiesNodeHelper helper = new AuthoritiesNodeHelper(authorities); assertNotNull(helper); Set<AuthorityView> auths = new HashSet<AuthorityView>(); auths.add(authority); assertTrue(helper.getAuthoritiesItems(auths).size() == 1); assertTrue(helper.getAuthorities().size() == 1); }
public Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities) { Set<Integer> authItems = new HashSet<Integer>(); for (AuthorityView auth : authorities) { if (authItemsMap.containsKey(auth.getName())) { authItems.addAll(new HashSet<Integer>(authItemsMap.get(auth .getName()))); } } return authItems; }
AuthoritiesNodeHelper { public Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities) { Set<Integer> authItems = new HashSet<Integer>(); for (AuthorityView auth : authorities) { if (authItemsMap.containsKey(auth.getName())) { authItems.addAll(new HashSet<Integer>(authItemsMap.get(auth .getName()))); } } return authItems; } }
AuthoritiesNodeHelper { public Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities) { Set<Integer> authItems = new HashSet<Integer>(); for (AuthorityView auth : authorities) { if (authItemsMap.containsKey(auth.getName())) { authItems.addAll(new HashSet<Integer>(authItemsMap.get(auth .getName()))); } } return authItems; } AuthoritiesNodeHelper(List<AuthorityDTO> authorities); }
AuthoritiesNodeHelper { public Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities) { Set<Integer> authItems = new HashSet<Integer>(); for (AuthorityView auth : authorities) { if (authItemsMap.containsKey(auth.getName())) { authItems.addAll(new HashSet<Integer>(authItemsMap.get(auth .getName()))); } } return authItems; } AuthoritiesNodeHelper(List<AuthorityDTO> authorities); Boolean deleteAuthority(String authority); synchronized Boolean deleteItem(Integer id); Set<String> getAuthorities(); Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities); @SuppressWarnings("unchecked") void addAuthorityWithNodes(AuthorityDTO authority); }
AuthoritiesNodeHelper { public Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities) { Set<Integer> authItems = new HashSet<Integer>(); for (AuthorityView auth : authorities) { if (authItemsMap.containsKey(auth.getName())) { authItems.addAll(new HashSet<Integer>(authItemsMap.get(auth .getName()))); } } return authItems; } AuthoritiesNodeHelper(List<AuthorityDTO> authorities); Boolean deleteAuthority(String authority); synchronized Boolean deleteItem(Integer id); Set<String> getAuthorities(); Set<Integer> getAuthoritiesItems(Set<AuthorityView> authorities); @SuppressWarnings("unchecked") void addAuthorityWithNodes(AuthorityDTO authority);  }