Skip to content

Commit

Permalink
drop down search item filter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 17, 2022
1 parent 9bef009 commit c2dea34
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
*/
package com.evolveum.midpoint.gui.impl.component.search;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.schema.expression.VariablesMap;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.midpoint.web.component.search.SearchValue;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchItemType;

import javax.xml.namespace.QName;
import java.util.List;

public class ChoicesSearchItemWrapper<T> extends PropertySearchItemWrapper {
Expand All @@ -21,6 +26,7 @@ public ChoicesSearchItemWrapper(SearchItemType searchItem, List<DisplayableValue
this.availableValues = availableValues;
}

@Override
public Class<ChoicesSearchItemPanel> getSearchItemPanelClass() {
return ChoicesSearchItemPanel.class;
}
Expand All @@ -29,8 +35,17 @@ public List<DisplayableValue<T>> getAvailableValues() {
return availableValues;
}

@Override
public DisplayableValue<T> getDefaultValue() {
return new SearchValue();
}

@Override
public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap variables) {
if (getValue().getValue() == null) {
return null;
}
return PrismContext.get().queryFor(type)
.item(getSearchItem().getPath().getItemPath()).eq(getValue().getValue()).buildFilter();
}
}

0 comments on commit c2dea34

Please sign in to comment.