@Override protected void deleteSelectedItems() { if (!isSelectAll) { Collection<SimpleRole> currentDataList = view.getPagedBeanTable().getCurrentDataList(); List<Role> keyList = new ArrayList<>(); for (SimpleRole item : currentDataList) { if (item.isSelected()) { if (Boolean.TRUE.equals(item.getIssystemrole())) { NotificationUtil.showErrorNotification( String.format( "Can not delete role %s because it is the system role.", item.getRolename())); } else { keyList.add(item); } } } if (keyList.size() > 0) { roleService.massRemoveWithSession( keyList, AppContext.getUsername(), AppContext.getAccountId()); doSearch(searchCriteria); } } else { roleService.removeByCriteria(searchCriteria, AppContext.getAccountId()); doSearch(searchCriteria); } }