Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public String saveAccount() {
  2.  
  3. ua.forEach((a) -> {
  4.  
  5. if (a.getIsActive()) {
  6. int i = 0;
  7. for (AccountAccess accountAccess1 : accountAccess) {
  8. if (accountAccess1.getAccessId().getLevel().equals(a.getAccess().getLevel())) {
  9. if (!accountAccess1.getActive()) accountAccess1.setActive(true);
  10. i++;
  11. }
  12. }
  13. if (i == 0) {
  14. accountAccess.add(new AccountAccess(true, a.getAccess(), account));
  15. }
  16. } else {
  17. int i = 0;
  18. for (AccountAccess accountAccess2 : accountAccess) {
  19. if (accountAccess2.getAccessId().getLevel().equals(a.getAccess().getLevel()) && accountAccess2.getActive()) {
  20. accountAccess2.setActive(false);
  21. }
  22. }
  23. }
  24. });
  25. try{
  26. accountController.saveAccountAfterEdit(account, userDetail, accountAccess);}
  27. catch(OptimisticLockException e){
  28. FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
  29. return "optLockEx";
  30. }
  31. return "success";
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement