@Test void testSetActivationUserUnknown() { this.setSecurityContextSuperUser(); assertThrows( UnknownEntityException.class, () -> userManagerService.setActivationUser("unknownUserId", true)); }
@Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional public void setActivationUser(String userId, Boolean active) { User user = dataService.findOneById(USER, userId, User.class); if (user == null) { throw new UnknownEntityException(USER, userId); } user.setActive(active); this.dataService.update(USER, user); }
UserManagerServiceImpl implements UserManagerService { @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional public void setActivationUser(String userId, Boolean active) { User user = dataService.findOneById(USER, userId, User.class); if (user == null) { throw new UnknownEntityException(USER, userId); } user.setActive(active); this.dataService.update(USER, user); } }
UserManagerServiceImpl implements UserManagerService { @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional public void setActivationUser(String userId, Boolean active) { User user = dataService.findOneById(USER, userId, User.class); if (user == null) { throw new UnknownEntityException(USER, userId); } user.setActive(active); this.dataService.update(USER, user); } UserManagerServiceImpl(DataService dataService); }
UserManagerServiceImpl implements UserManagerService { @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional public void setActivationUser(String userId, Boolean active) { User user = dataService.findOneById(USER, userId, User.class); if (user == null) { throw new UnknownEntityException(USER, userId); } user.setActive(active); this.dataService.update(USER, user); } UserManagerServiceImpl(DataService dataService); @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional(readOnly = true) List<UserViewData> getAllUsers(); @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional void setActivationUser(String userId, Boolean active); }
UserManagerServiceImpl implements UserManagerService { @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional public void setActivationUser(String userId, Boolean active) { User user = dataService.findOneById(USER, userId, User.class); if (user == null) { throw new UnknownEntityException(USER, userId); } user.setActive(active); this.dataService.update(USER, user); } UserManagerServiceImpl(DataService dataService); @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional(readOnly = true) List<UserViewData> getAllUsers(); @Override @PreAuthorize("hasAnyRole('ROLE_SU','ROLE_MANAGER')") @Transactional void setActivationUser(String userId, Boolean active);  }