Example #1
0
  private void clearSearchPerformed(AjaxRequestTarget target) {
    ReportOutputSearchDto dto = searchModel.getObject();
    dto.setReportType(null);
    dto.setText(null);

    refreshTable(target);
  }
Example #2
0
  private void refreshTable(AjaxRequestTarget target) {
    Table panel = getReportOutputTable();

    ReportsStorage storage = getSessionStorage().getReports();
    storage.setReportOutputSearch(searchModel.getObject());
    storage.setReportOutputsPaging(null);
    panel.setCurrentPage(0);

    target.add((Component) panel);
    target.add(getFeedbackPanel());
  }
Example #3
0
  private ObjectQuery createQuery() {
    ReportOutputSearchDto dto = searchModel.getObject();

    try {
      List<ObjectFilter> ands = new ArrayList<>();

      if (StringUtils.isNotEmpty(dto.getText())) {
        PolyStringNormalizer normalizer = getPrismContext().getDefaultPolyStringNormalizer();
        String normalizedString = normalizer.normalize(dto.getText());

        SubstringFilter substring =
            SubstringFilter.createSubstring(
                ReportOutputType.F_NAME,
                ReportOutputType.class,
                getPrismContext(),
                PolyStringNormMatchingRule.NAME,
                normalizedString);
        ands.add(substring);
      }

      String oid = dto.getReportTypeMap().get(dto.getReportType());
      if (StringUtils.isNotEmpty(oid)) {
        RefFilter ref =
            RefFilter.createReferenceEqual(
                ReportOutputType.F_REPORT_REF, ReportOutputType.class, getPrismContext(), oid);
        ands.add(ref);
      }

      switch (ands.size()) {
        case 0:
          return null;
        case 1:
          return ObjectQuery.createObjectQuery(ands.get(0));
        default:
          AndFilter and = AndFilter.createAnd(ands);
          return ObjectQuery.createObjectQuery(and);
      }
    } catch (Exception e) {
      error(getString("pageCreatedReports.message.queryError") + " " + e.getMessage());
      LoggingUtils.logException(LOGGER, "Couldn't create query filter.", e);
      return null;
    }
  }