Exemplo n.º 1
0
  @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);
    }
  }
Exemplo n.º 2
0
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canRead(RolePermissionCollections.ACCOUNT_ROLE)) {
      RoleService roleService = ApplicationContextUtil.getSpringBean(RoleService.class);
      SimpleRole role = roleService.findById((Integer) data.getParams(), AppContext.getAccountId());
      if (role != null) {
        RoleContainer roleContainer = (RoleContainer) container;
        roleContainer.removeAllComponents();
        roleContainer.addComponent(view.getWidget());
        view.previewItem(role);

        AccountSettingBreadcrumb breadcrumb =
            ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
        breadcrumb.gotoRoleRead(role);
      } else {
        NotificationUtil.showRecordNotExistNotification();
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }