Skip to content

Commit

Permalink
MID-9053: Fixed useInObjectList in Query Playground
Browse files Browse the repository at this point in the history
UseInObjetList tried always evaluate expressions, even if not present
 - fixed by checking value of checkbox
 - removed generation of XML filter in favour of reusing generated axiom query
  • Loading branch information
tonydamage committed Oct 12, 2023
1 parent b2bd592 commit 0befd7f
Showing 1 changed file with 9 additions and 15 deletions.
Expand Up @@ -383,19 +383,12 @@ private void useInObjectListPerformed(AjaxRequestTarget target) {
Task task = getPageBase().createSimpleTask(OPERATION_CHECK_QUERY);
OperationResult result = task.getResult();
try {
updateRequestWithMidpointQuery(request, dto.getObjectType(), queryText, dto.isDistinct(), dto.getMidPointQueryScript(), task, result); // just to parse the query

ObjectFilter parsedFilter = request.getQuery().getFilter();
String filterAsString;
if (parsedFilter != null) {
SearchFilterType filterType = getPageBase().getQueryConverter().createSearchFilterType(parsedFilter);
filterAsString = getPrismContext().xmlSerializer().serializeRealValue(filterType, SchemaConstantsGenerated.Q_FILTER);
// TODO remove extra xmlns from serialized value
} else {
filterAsString = "";
}

// TODO add containerable option too (or split the code sooner?)
ExpressionType scriptQuery = null;
if (dto.isScriptEnabled()) {
scriptQuery = dto.getMidPointQueryScript();
}
updateRequestWithMidpointQuery(request, dto.getObjectType(), dto.getMidPointQuery(), dto.isDistinct(), scriptQuery, task, result);
//noinspection unchecked
Class<? extends PageBase> listPageClass = DetailsPageUtil.getObjectListPage((Class<? extends ObjectType>) request.getType());
String storageKey = listPageClass != null ? WebComponentUtil.getObjectListPageStorageKey(dto.getObjectType().getLocalPart()) : null;
Expand All @@ -413,9 +406,10 @@ private void useInObjectListPerformed(AjaxRequestTarget target) {
}
// TODO add containerable option too
Search search = storage.getSearch() != null ? storage.getSearch() : new SearchBuilder(request.getType()).modelServiceLocator(getPageBase()).build();
search.addAllowedModelType(SearchBoxModeType.ADVANCED);
search.setSearchMode(SearchBoxModeType.ADVANCED);
search.setAdvancedQuery(filterAsString);
search.addAllowedModelType(SearchBoxModeType.AXIOM_QUERY);
search.setSearchMode(SearchBoxModeType.AXIOM_QUERY);
// Use query from model object, call of updateRequestWithMidpointQuery may updated it with new Query Language text.
search.setDslQuery(getModelObject().getMidPointQuery());

if (!search.isAdvancedQueryValid(getPageBase())) {
// shouldn't occur because the query was already parsed
Expand Down

0 comments on commit 0befd7f

Please sign in to comment.