@Override public List<RolePermission> findAllPermissionsBy(final Long roleId) { List<? extends RolePermission> permissions = rolePermissionsDao.findAllByRoleIdSorted(roleId); if (permissions != null) { return new ArrayList<>(permissions); } return Collections.emptyList(); }
@Override public RolePermission findRolePermission(final Long id) { if (id == null) { return null; } return rolePermissionsDao.findById(id); }
@Override public RolePermission findRolePermissionByUuid(final String uuid) { if (Strings.isNullOrEmpty(uuid)) { return null; } return rolePermissionsDao.findByUuid(uuid); }
@Override public Boolean doInTransaction(TransactionStatus status) { List<? extends RolePermission> rolePermissions = rolePermissionsDao.findAllByRoleIdSorted(role.getId()); if (rolePermissions != null && !rolePermissions.isEmpty()) { for (RolePermission rolePermission : rolePermissions) { rolePermissionsDao.remove(rolePermission.getId()); } } if (roleDao.remove(role.getId())) { RoleVO roleVO = roleDao.findByIdIncludingRemoved(role.getId()); roleVO.setName(null); return roleDao.update(role.getId(), roleVO); } return false; } });
@Override public boolean updateRolePermission(Role role, RolePermission rolePermission, RolePermission.Permission permission) { checkCallerAccess(); return role != null && rolePermissionsDao.update(role, rolePermission, permission); }
@Override public RolePermissionVO doInTransaction(TransactionStatus status) { return rolePermissionsDao.persist(new RolePermissionVO(role.getId(), rule.toString(), permission, description)); } });
@Override @ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_DELETE, eventDescription = "deleting Role Permission") public boolean deleteRolePermission(final RolePermission rolePermission) { checkCallerAccess(); return rolePermission != null && rolePermissionsDao.remove(rolePermission.getId()); }
@Override @ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_UPDATE, eventDescription = "updating Role Permission order") public boolean updateRolePermission(final Role role, final List<RolePermission> newOrder) { checkCallerAccess(); return role != null && newOrder != null && rolePermissionsDao.update(role, newOrder); }