Пример #1
0
  private List<GrantedAuthority> buildUserAuthority(Set<Authority> authorities) {

    Set<GrantedAuthority> setAuths = new HashSet<GrantedAuthority>();
    for (Authority authority : authorities) {
      setAuths.add(new SimpleGrantedAuthority(authority.name()));
    }
    return new ArrayList<GrantedAuthority>(setAuths);
  }
Пример #2
0
 @Override
 public Set<AccountDTO> getAccountsByAuthority(Authority authority) {
   Set<Account> accountSet = getCustomAccountRepository().getAccountsByAuthority(authority);
   Set<AccountDTO> accountDTOSet = new HashSet<AccountDTO>();
   for (Account account : accountSet) {
     accountDTOSet.add(getMapper().map(account, AccountDTO.class));
   }
   return accountDTOSet;
 }
Пример #3
0
 @Override
 public GenericDatatablesDTO<AccountDTO> getPaginatedAndFilteredAccounts(
     Integer draw,
     Integer start,
     Integer length,
     String name,
     String surname,
     String email,
     String login) {
   Set<AccountDTO> accountDTOs = new LinkedHashSet<AccountDTO>();
   for (Account acc :
       getCustomAccountRepository()
           .getPaginatedFilteredAndOrderedByLoginAccounts(
               start, length, name, surname, email, login)) {
     accountDTOs.add(getMapper().map(acc, AccountDTO.class));
   }
   return new GenericDatatablesDTO<>(
       accountDTOs,
       draw,
       getAccountRepository().getAccountCount(),
       getCustomAccountRepository()
           .getFilteredAccountsCount(name, surname, email, login)
           .intValue());
 }