-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ed41b1
commit 9028750
Showing
4 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...java/com/evolveum/midpoint/web/component/search/refactored/ObjectTypeSearchItemPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.web.component.search.refactored; | ||
|
||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.apache.wicket.model.PropertyModel; | ||
|
||
public class ObjectTypeSearchItemPanel<T> extends AbstractSearchItemPanel<ObjectTypeSearchItemWrapper> { | ||
|
||
public ObjectTypeSearchItemPanel(String id, IModel<ObjectTypeSearchItemWrapper> searchItem) { | ||
super(id, searchItem); | ||
} | ||
|
||
@Override | ||
protected Component initSearchItemField() { | ||
return WebComponentUtil.createDropDownChoices( | ||
ID_SEARCH_ITEM_FIELD, new PropertyModel(getModel(), ObjectTypeSearchItemWrapper.F_DISPLAYABLE_VALUE), Model.ofList(getModelObject().getAvailableValues()), true, getPageBase()); | ||
} | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
...va/com/evolveum/midpoint/web/component/search/refactored/ObjectTypeSearchItemWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (C) 2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.web.component.search.refactored; | ||
|
||
import com.evolveum.midpoint.gui.api.page.PageBase; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.prism.Containerable; | ||
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.ObjectTypeSearchItemConfigurationType; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ObjectTypeSearchItemWrapper extends AbstractSearchItemWrapper<QName> { | ||
|
||
ObjectTypeSearchItemConfigurationType config; | ||
|
||
public ObjectTypeSearchItemWrapper(ObjectTypeSearchItemConfigurationType config) { | ||
this.config = config; | ||
} | ||
|
||
public Class<ObjectTypeSearchItemPanel> getSearchItemPanelClass() { | ||
return ObjectTypeSearchItemPanel.class; | ||
} | ||
|
||
public List<DisplayableValue<QName>> getAvailableValues() { | ||
List<DisplayableValue<QName>> availableValues = new ArrayList<>(); | ||
config.getSupportedTypes().forEach(type -> availableValues.add(new SearchValue(type))); | ||
return availableValues; | ||
} | ||
|
||
public DisplayableValue<QName> getDefaultValue() { | ||
return new SearchValue(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public String getHelp() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return ""; //todo | ||
} | ||
|
||
@Override | ||
public boolean isApplyFilter() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public ObjectFilter createFilter(PageBase pageBase, VariablesMap variables) { | ||
return PrismContext.get().queryFor((Class<? extends Containerable>) WebComponentUtil.qnameToClass(PrismContext.get(), config.getDefaultValue())) | ||
.buildFilter(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters