private List<InlineMenuItem> initInlineMenu() { List<InlineMenuItem> headerMenuItems = new ArrayList<>(); headerMenuItems.add( new InlineMenuItem( createStringResource("pageCreatedReports.inlineMenu.deleteAll"), true, new HeaderMenuAction(this) { @Override public void onSubmit(AjaxRequestTarget target, Form<?> form) { deleteAllPerformed(target, ReportDeleteDialogDto.Operation.DELETE_ALL); } })); headerMenuItems.add( new InlineMenuItem( createStringResource("pageCreatedReports.inlineMenu.deleteSelected"), true, new HeaderMenuAction(this) { @Override public void onSubmit(AjaxRequestTarget target, Form<?> form) { deleteSelectedPerformed( target, ReportDeleteDialogDto.Operation.DELETE_SELECTED, null); } })); return headerMenuItems; }
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; } }
private List<ReportOutputType> getSelectedData() { ObjectDataProvider<SelectableBean<ReportOutputType>, ReportOutputType> provider = getReportDataProvider(); List<SelectableBean<ReportOutputType>> rows = provider.getAvailableData(); List<ReportOutputType> selected = new ArrayList<>(); for (SelectableBean<ReportOutputType> row : rows) { if (row.isSelected()) { selected.add(row.getValue()); } } return selected; }
private void deleteSelectedPerformed( AjaxRequestTarget target, ReportDeleteDialogDto.Operation op, ReportOutputType single) { List<ReportOutputType> selected = getSelectedData(); if (single != null) { selected.clear(); selected.add(single); } if (selected.isEmpty()) { return; } ReportDeleteDialogDto dto = new ReportDeleteDialogDto(op, selected); deleteModel.setObject(dto); getPageBase().showMainPopup(getDeleteDialogPanel(), target); }
private void deleteSelectedPerformed( AjaxRequestTarget target, ReportDeleteDialogDto.Operation op, ReportOutputType single) { List<ReportOutputType> selected = getSelectedData(); if (single != null) { selected.clear(); selected.add(single); } if (selected.isEmpty()) { return; } ReportDeleteDialogDto dto = new ReportDeleteDialogDto(op, selected); deleteModel.setObject(dto); ModalWindow dialog = (ModalWindow) get(ID_CONFIRM_DELETE); dialog.show(target); }