Search in sources :

Example 11 with PageStorage

use of com.evolveum.midpoint.web.session.PageStorage in project midpoint by Evolveum.

the class PageResources method initSearch.

private void initSearch(String text) {
    PageStorage storage = getSessionStorage().getPageStorageMap().get(SessionStorage.KEY_RESOURCES);
    if (storage == null) {
        storage = getSessionStorage().initPageStorage(SessionStorage.KEY_RESOURCES);
    }
    Search search = SearchFactory.createSearch(ResourceType.class, this);
    if (SearchBoxModeType.FULLTEXT.equals(search.getSearchType())) {
        search.setFullText(text);
    } else if (search.getItems() != null && search.getItems().size() > 0) {
        SearchItem searchItem = search.getItems().get(0);
        searchItem.getValues().add(new SearchValue<>(text));
    }
    storage.setSearch(search);
    getSessionStorage().getPageStorageMap().put(SessionStorage.KEY_RESOURCES, storage);
}
Also used : PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 12 with PageStorage

use of com.evolveum.midpoint.web.session.PageStorage in project midpoint by Evolveum.

the class ObjectListPanel method initSearchModel.

private LoadableModel<Search> initSearchModel() {
    return new LoadableModel<Search>(false) {

        private static final long serialVersionUID = 1L;

        @Override
        public Search load() {
            String storageKey = getStorageKey();
            Search search = null;
            if (StringUtils.isNotEmpty(storageKey)) {
                PageStorage storage = getPageStorage(storageKey);
                if (storage != null) {
                    search = storage.getSearch();
                }
            }
            if (search == null) {
                search = createSearch();
            }
            return search;
        }
    };
}
Also used : Search(com.evolveum.midpoint.web.component.search.Search) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 13 with PageStorage

use of com.evolveum.midpoint.web.session.PageStorage in project midpoint by Evolveum.

the class ObjectListPanel method searchPerformed.

@SuppressWarnings("deprecation")
private void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
    BaseSortableDataProvider<SelectableBean<O>> provider = getDataProvider();
    // note: we ignore 'query' parameter, as the 'customQuery' already contains its content (MID-3271)
    ObjectQuery customQuery = getQuery();
    //		if (customQuery == null){
    //			customQuery = query;
    //		} else {
    //			if (query != null){
    //				customQuery.addFilter(query.getFilter());
    //			}
    //		}
    provider.setQuery(customQuery);
    String storageKey = getStorageKey();
    if (StringUtils.isNotEmpty(storageKey)) {
        PageStorage storage = getPageStorage(storageKey);
        if (storage != null) {
            storage.setSearch(searchModel.getObject());
            storage.setPaging(null);
        }
    }
    Table table = getTable();
    table.setCurrentPage(null);
    target.add((Component) table);
    target.add(parentPage.getFeedbackPanel());
}
Also used : Table(com.evolveum.midpoint.web.component.data.Table) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 14 with PageStorage

use of com.evolveum.midpoint.web.session.PageStorage in project midpoint by Evolveum.

the class ObjectListPanel method saveSearchModel.

private void saveSearchModel() {
    String storageKey = getStorageKey();
    if (StringUtils.isNotEmpty(storageKey)) {
        PageStorage storage = getPageStorage(storageKey);
        if (storage != null) {
            storage.setSearch(searchModel.getObject());
            storage.setPaging(null);
        }
    }
}
Also used : PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 15 with PageStorage

use of com.evolveum.midpoint.web.session.PageStorage in project midpoint by Evolveum.

the class ObjectListPanel method initProvider.

protected BaseSortableDataProvider<SelectableBean<O>> initProvider() {
    Set<O> selectedObjectsSet = selectedObjects == null ? null : new HashSet<O>(selectedObjects);
    SelectableBeanObjectDataProvider<O> provider = new SelectableBeanObjectDataProvider<O>(parentPage, type, selectedObjectsSet) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
            String storageKey = getStorageKey();
            if (StringUtils.isNotEmpty(storageKey)) {
                PageStorage storage = getPageStorage(storageKey);
                if (storage != null) {
                    storage.setPaging(paging);
                }
            }
        }

        @Override
        public SelectableBean<O> createDataObjectWrapper(O obj) {
            SelectableBean<O> bean = super.createDataObjectWrapper(obj);
            List<InlineMenuItem> inlineMenu = createInlineMenu();
            if (inlineMenu != null) {
                bean.getMenuItems().addAll(inlineMenu);
            }
            return bean;
        }
    };
    if (options == null) {
        if (ResourceType.class.equals(type)) {
            options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
        }
    } else {
        if (ResourceType.class.equals(type)) {
            GetOperationOptions root = SelectorOptions.findRootOptions(options);
            root.setNoFetch(Boolean.TRUE);
        }
        provider.setOptions(options);
    }
    provider.setQuery(getQuery());
    return provider;
}
Also used : SelectableBeanObjectDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Aggregations

PageStorage (com.evolveum.midpoint.web.session.PageStorage)17 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)5 MultivalueContainerListPanelWithDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Task (com.evolveum.midpoint.task.api.Task)3 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)3 Search (com.evolveum.midpoint.web.component.search.Search)3 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)3 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 QName (javax.xml.namespace.QName)3 ListItem (org.apache.wicket.markup.html.list.ListItem)3 IModel (org.apache.wicket.model.IModel)3 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2