private void searchPerformed(AjaxRequestTarget target) {
    ObjectQuery query = createQuery();

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(query);
    table.setCurrentPage(0);

    target.add(panel);
    target.add(getFeedbackPanel());
  }
  private void clearSearchPerformed(AjaxRequestTarget target) {
    searchModel.setObject(new AccountContentSearchDto());

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(null);

    ResourcesStorage storage = getSessionStorage().getResources();
    storage.setAccountContentSearch(searchModel.getObject());
    storage.setAccountContentPaging(null);
    panel.setCurrentPage(null);

    target.add(get(ID_SEARCH_FORM));
    target.add(panel);
  }
  private void deleteConfirmedPerformed(AjaxRequestTarget target) {
    List<AccountContentDto> selected = new ArrayList<AccountContentDto>();

    if (singleDelete != null) {
      selected.add(singleDelete);
    } else {
      selected = isAnythingSelected(target, null);
    }

    OperationResult result = new OperationResult(OPERATION_DELETE_ACCOUNT_FROM_RESOURCE);

    for (AccountContentDto acc : selected) {
      String accOid = acc.getAccountOid();

      try {
        Task task = createSimpleTask(OPERATION_DELETE_ACCOUNT_FROM_RESOURCE);

        ObjectDelta delta =
            ObjectDelta.createDeleteDelta(ShadowType.class, accOid, getPrismContext());
        getModelService()
            .executeChanges(WebMiscUtil.createDeltaCollection(delta), null, task, result);

      } catch (Exception e) {
        result.recordPartialError("Couldn't delete account from resource.", e);
        LoggingUtils.logException(LOGGER, "Couldn't delete account from resource", e);
      }
    }

    if (result.isUnknown()) {
      result.recomputeStatus("Error occurred during resource account deletion.");
    }

    if (result.isSuccess()) {
      result.recordStatus(
          OperationResultStatus.SUCCESS, "Selected accounts have been successfully deleted.");
    }

    AccountContentDataProvider provider =
        (AccountContentDataProvider) getTable().getDataTable().getDataProvider();
    provider.clearCache();

    TablePanel table = getTable();
    target.add(table);
    showResult(result);
    target.add(getFeedbackPanel());
  }
  private void initLayout() {
    Form searchForm = new Form(ID_SEARCH_FORM);
    add(searchForm);

    CheckBox nameCheck =
        new CheckBox(ID_NAME_CHECK, new PropertyModel(searchModel, AccountContentSearchDto.F_NAME));
    searchForm.add(nameCheck);

    CheckBox identifiersCheck =
        new CheckBox(
            ID_IDENTIFIERS_CHECK,
            new PropertyModel(searchModel, AccountContentSearchDto.F_IDENTIFIERS));
    searchForm.add(identifiersCheck);

    BasicSearchPanel<AccountContentSearchDto> basicSearch =
        new BasicSearchPanel<AccountContentSearchDto>(ID_BASIC_SEARCH) {

          @Override
          protected IModel<String> createSearchTextModel() {
            return new PropertyModel<>(searchModel, AccountContentSearchDto.F_SEARCH_TEXT);
          }

          @Override
          protected void searchPerformed(AjaxRequestTarget target) {
            PageContentAccounts.this.searchPerformed(target);
          }

          @Override
          protected void clearSearchPerformed(AjaxRequestTarget target) {
            PageContentAccounts.this.clearSearchPerformed(target);
          }
        };
    searchForm.add(basicSearch);

    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);

    AccountContentDataProvider provider =
        new AccountContentDataProvider(
            this,
            new PropertyModel<String>(resourceModel, "oid"),
            createObjectClassModel(),
            createUseObjectCountingModel()) {

          @Override
          protected void addInlineMenuToDto(AccountContentDto dto) {
            addRowMenuToTable(dto);
          }
        };
    provider.setQuery(createQuery());

    List<IColumn> columns = initColumns();
    TablePanel table =
        new TablePanel(
            ID_TABLE,
            provider,
            columns,
            UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL,
            getItemsPerPage(UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL));
    table.setOutputMarkupId(true);
    mainForm.add(table);

    initDialog();
  }