Skip to content

Commit

Permalink
better support for shadow search
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Jan 10, 2023
1 parent d9433e3 commit fdeba22
Show file tree
Hide file tree
Showing 23 changed files with 768 additions and 426 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public Set<? extends O> getSelected() {
}
};
provider.setCompiledObjectCollectionView(getObjectCollectionView());
provider.setOptions(createOptions());
provider.setOptions(getOptions());
return provider;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,9 @@ public static DisplayType combineDisplay(DisplayType display, DisplayType variat
}

public static String getItemDefinitionDisplayNameOrName(ItemDefinition def) {
if (def == null) {
return null;
}
String name = getItemDefinitionDisplayName(def);
if (StringUtils.isNotEmpty(name)) {
return name;
Expand Down Expand Up @@ -2607,6 +2610,26 @@ public static Class<? extends PageBase> getObjectDetailsPage(Class<? extends Obj
return OBJECT_DETAILS_PAGE_MAP.get(type);
}

public static Class<? extends ObjectType> getObjectTypeForDetailsPage(PageBase pageType) {
var objectDetailsPages = OBJECT_DETAILS_PAGE_MAP.entrySet();
for (Map.Entry<Class<? extends ObjectType>, Class<? extends PageBase>> detailsPage : objectDetailsPages) {
if (detailsPage.getValue().equals(pageType.getPageClass())) {
return detailsPage.getKey();
}
}

return null;
}

public static String getPanelIdentifierFromParams(PageParameters pageParameters) {
StringValue panelIdentifierParam = pageParameters.get(AbstractPageObjectDetails.PARAM_PANEL_ID);
String panelIdentifier = null;
if (panelIdentifierParam != null && !panelIdentifierParam.isEmpty()) {
panelIdentifier = panelIdentifierParam.toString();
}
return panelIdentifier;
}

public static Class<? extends PageBase> getNewlyCreatedObjectPage(Class<? extends ObjectType> type) {
// if (ResourceType.class.equals(type)) {
// return CREATE_NEW_OBJECT_PAGE_MAP.get(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ protected ObjectQuery getCustomizeContentQuery(){

@Override
protected SearchBoxConfigurationType getDefaultSearchBoxConfiguration(Class<O> type) {
SearchBoxConfigurationType searchBoxConfigurationType = super.getDefaultSearchBoxConfiguration(type);
searchBoxConfigurationType.setObjectTypeConfiguration(SearchBoxConfigurationUtil.createObjectTypeSearchItemConfiguration(type, Arrays.asList(
return new SearchBoxConfigurationUtil(type)
.supportedTypes(Arrays.asList(
AbstractRoleType.COMPLEX_TYPE,
OrgType.COMPLEX_TYPE,
ArchetypeType.COMPLEX_TYPE,
RoleType.COMPLEX_TYPE,
ServiceType.COMPLEX_TYPE)));
return searchBoxConfigurationType;
ServiceType.COMPLEX_TYPE))
.modelServiceLocator(getPageBase())
.create();
// SearchBoxConfigurationType searchBoxConfigurationType = super.getDefaultSearchBoxConfiguration(type);
// searchBoxConfigurationType.setObjectTypeConfiguration(SearchBoxConfigurationUtil.createObjectTypeSearchItemConfiguration(type, );
// return searchBoxConfigurationType;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.schema.processor.ResourceObjectDefinition;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -217,13 +219,20 @@ private Search<C> createSearch() {
.modelServiceLocator(getPageBase())
.nameSearch(getSearchByNameParameterValue())
.isPreview(isPreview())
.isViewForDashboard(isCollectionViewPanelForWidget());
.isViewForDashboard(isCollectionViewPanelForWidget())
.resourceObjectDefinition(getResourceObjectDefinition());

return searchFactory.createSearch();
}

protected ResourceObjectDefinition getResourceObjectDefinition() {
return null;
}

protected SearchBoxConfigurationType getDefaultSearchBoxConfiguration(Class<C> type) {
return SearchBoxConfigurationUtil.getDefaultSearchBoxConfiguration(type, null, getPageBase());
return new SearchBoxConfigurationUtil(type)
.modelServiceLocator(getPageBase())
.create(); //getDefaultSearchBoxConfiguration(type, null, getPageBase());
}

private void initLayout() {
Expand Down Expand Up @@ -633,7 +642,7 @@ private String getSortProperty(GuiObjectColumnType customColumn, ItemPath column
}

private List<ItemPath> getSearchablePaths(Class<C> type, ModelServiceLocator modelServiceLocator) {
List<ItemPath> availablePaths = PredefinedSearchableItems.getAvailableSearchableItems(type, modelServiceLocator);
List<ItemPath> availablePaths = PredefinedSearchableItems.getSearchableItemsFor(type);//SearchBoxConfigurationUtil.getAvailableSearchableItems(type, modelServiceLocator);
if (CollectionUtils.isEmpty(availablePaths)) {
availablePaths = new ArrayList<>();
}
Expand All @@ -647,7 +656,7 @@ private List<ItemPath> addSuperSearchablePaths(Class<?> type, List<ItemPath> typ
return typePaths;
}

List<ItemPath> superPaths = PredefinedSearchableItems.getAvailableSearchableItems(superClass, getPageBase());
List<ItemPath> superPaths = PredefinedSearchableItems.getSearchableItemsFor(superClass);//SearchBoxConfigurationUtil.getAvailableSearchableItems(superClass, getPageBase());
if (CollectionUtils.isNotEmpty(superPaths)) {
typePaths.addAll(superPaths);
}
Expand Down Expand Up @@ -902,25 +911,25 @@ public List<PO> getSelectedObjects() {

public abstract List<C> getSelectedRealObjects();

protected final Collection<SelectorOptions<GetOperationOptions>> createOptions() {

if (getObjectCollectionView() != null && getObjectCollectionView().getOptions() != null
&& !getObjectCollectionView().getOptions().isEmpty()) {
return getObjectCollectionView().getOptions();
}

if (options == null) {
if (ResourceType.class.equals(getType())) {
options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
}
} else {
if (ResourceType.class.equals(getType())) {
GetOperationOptions root = SelectorOptions.findRootOptions(options);
root.setNoFetch(Boolean.TRUE);
}
}
return options;
}
// protected final Collection<SelectorOptions<GetOperationOptions>> createOptions() {
//
// if (getObjectCollectionView() != null && getObjectCollectionView().getOptions() != null
// && !getObjectCollectionView().getOptions().isEmpty()) {
// return getObjectCollectionView().getOptions();
// }
//
// if (options == null) {
// if (ResourceType.class.equals(getType())) {
// options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
// }
// } else {
// if (ResourceType.class.equals(getType())) {
// GetOperationOptions root = SelectorOptions.findRootOptions(options);
// root.setNoFetch(Boolean.TRUE);
// }
// }
// return options;
// }

protected List<C> getPreselectedObjectList() {
return null;
Expand Down

0 comments on commit fdeba22

Please sign in to comment.