Skip to content

Commit

Permalink
fixing search for reports
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Jan 19, 2023
1 parent 0c0955e commit 6f4a5d2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5558,6 +5558,10 @@ public static ItemPath getPath(GuiObjectColumnType column) {
return null;
}

if (column.getPath() == null) {
return null;
}

return column.getPath().getItemPath();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,19 @@ private LookupTableType getSearchItemLookupTable(ItemDefinition<?> def,
PrismObject<LookupTableType> lookupTable = WebComponentUtil.findLookupTable(def, (PageBase) modelServiceLocator);
return lookupTable != null ? lookupTable.asObjectable() : null;
}
if (hasParameter() && item.getParameter().getAllowedValuesLookupTable() != null) {
if (hasParameter() && hasLookupTableDefined(item)) {
PrismObject<LookupTableType> lookupTable = WebComponentUtil.findLookupTable(
item.getParameter().getAllowedValuesLookupTable().asReferenceValue(), (PageBase) modelServiceLocator);
return lookupTable != null ? lookupTable.asObjectable() : null;
}
return null;
}

private boolean hasLookupTableDefined(SearchItemType item) {
ObjectReferenceType lookupTableRef = item.getParameter().getAllowedValuesLookupTable();
return lookupTableRef != null && lookupTableRef.getOid() != null;
}

private QName getSearchItemValueTypeName(SearchItemType searchItem, ItemDefinition<?> def) {
if (def != null) {
return def.getTypeName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ protected Panel createSummaryPanel(String id, IModel<ReportType> summaryModel) {
protected ReportOperationalButtonsPanel createButtonsPanel(String id, LoadableModel<PrismObjectWrapper<ReportType>> wrapperModel) {
return new ReportOperationalButtonsPanel(id, wrapperModel) {

@Override
protected ReportType getReport() {
return getReportWithAppliedChanges();
}

@Override
protected void refresh(AjaxRequestTarget target) {
PageReport.this.refresh(target);
Expand Down Expand Up @@ -147,7 +152,7 @@ protected void initLayout() {
tableContainer.setOutputMarkupId(true);
add(tableContainer);

ReportObjectsListPanel<?> reportTable = new ReportObjectsListPanel<>(ID_REPORT_TABLE, Model.of(getModelObjectType()));
ReportObjectsListPanel<?> reportTable = new ReportObjectsListPanel<>(ID_REPORT_TABLE, () -> getReportWithAppliedChanges());
reportTable.setOutputMarkupId(true);

WebMarkupContainer tableBox = new WebMarkupContainer(ID_TABLE_BOX);
Expand All @@ -158,6 +163,15 @@ protected void initLayout() {
tableBox.add(reportTable);
}

private ReportType getReportWithAppliedChanges() {
try {
return getModelWrapperObject().getObjectApplyDelta().asObjectable();
} catch (SchemaException e) {
LOGGER.debug("Cannot apply changes for report, returning original state");
return getModelWrapperObject().getObjectOld().asObjectable();
}
}

public void saveAndRunPerformed(AjaxRequestTarget target) {
try {
processingOfSaveAndRun = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ private static void runConfirmPerformed(AjaxRequestTarget target, PrismObject<Re
target.add(pageBase.getFeedbackPanel());
}

private ReportType getReport() {
return getModelObject().getObject().asObjectable();
protected ReportType getReport() {
throw new UnsupportedOperationException("Override in the Page where it is used please.");
}

private boolean isCollectionReport() {
Expand Down

0 comments on commit 6f4a5d2

Please sign in to comment.