Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String saveAccount() {
- ua.forEach((a) -> {
- if (a.getIsActive()) {
- int i = 0;
- for (AccountAccess accountAccess1 : accountAccess) {
- if (accountAccess1.getAccessId().getLevel().equals(a.getAccess().getLevel())) {
- if (!accountAccess1.getActive()) accountAccess1.setActive(true);
- i++;
- }
- }
- if (i == 0) {
- accountAccess.add(new AccountAccess(true, a.getAccess(), account));
- }
- } else {
- int i = 0;
- for (AccountAccess accountAccess2 : accountAccess) {
- if (accountAccess2.getAccessId().getLevel().equals(a.getAccess().getLevel()) && accountAccess2.getActive()) {
- accountAccess2.setActive(false);
- }
- }
- }
- });
- try{
- accountController.saveAccountAfterEdit(account, userDetail, accountAccess);}
- catch(OptimisticLockException e){
- FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
- return "optLockEx";
- }
- return "success";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement