Search in sources :

Example 16 with PageStorage

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

the class AbstractRoleMemberPanel method getMemberPanelStorage.

protected MemberPanelStorage getMemberPanelStorage() {
    String storageKey = createStorageKey();
    if (StringUtils.isEmpty(storageKey)) {
        return null;
    }
    PageStorage storage = getPageStorage(storageKey);
    if (storage == null) {
        storage = getSessionStorage().initMemberStorage(storageKey);
    }
    return (MemberPanelStorage) storage;
}
Also used : MemberPanelStorage(com.evolveum.midpoint.web.session.MemberPanelStorage) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Example 17 with PageStorage

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

the class PageRepositoryQuery method useInObjectListPerformed.

private void useInObjectListPerformed(AjaxRequestTarget target) {
    final RepoQueryDto dto = model.getObject();
    String queryText = dto.getMidPointQuery();
    if (StringUtils.isBlank(queryText)) {
        queryText = "<query/>";
    }
    RepositoryQueryDiagRequest request = new RepositoryQueryDiagRequest();
    Task task = createSimpleTask(OPERATION_CHECK_QUERY);
    OperationResult result = task.getResult();
    try {
        // just to parse the query
        updateRequestWithMidpointQuery(request, dto.getObjectType(), queryText, dto.isDistinct(), task, result);
        ObjectFilter parsedFilter = request.getQuery().getFilter();
        String filterAsString;
        if (parsedFilter != null) {
            SearchFilterType filterType = getQueryConverter().createSearchFilterType(parsedFilter);
            filterAsString = getPrismContext().xmlSerializer().serializeRealValue(filterType, SchemaConstantsGenerated.Q_FILTER);
        // TODO remove extra xmlns from serialized value
        } else {
            filterAsString = "";
        }
        Class<? extends PageBase> listPageClass = WebComponentUtil.getObjectListPage(request.getType());
        String storageKey = listPageClass != null ? WebComponentUtil.getObjectListPageStorageKey(dto.getObjectType().getLocalPart()) : null;
        if (storageKey == null) {
            // shouldn't occur because of button visibility
            error("No page to redirect for " + dto.getObjectType());
            target.add(getFeedbackPanel());
            return;
        }
        Search search = SearchFactory.createSearch(request.getType(), this);
        search.setAdvancedQuery(filterAsString);
        search.setSearchType(SearchBoxModeType.ADVANCED);
        if (!search.isAdvancedQueryValid(getPrismContext())) {
            // shouldn't occur because the query was already parsed
            error("Query is not valid: " + search.getAdvancedError());
            target.add(getFeedbackPanel());
            return;
        }
        SessionStorage sessionStorage = ((MidPointAuthWebSession) getSession()).getSessionStorage();
        PageStorage storage = sessionStorage.getPageStorageMap().get(storageKey);
        if (storage == null) {
            storage = sessionStorage.initPageStorage(storageKey);
        }
        storage.setSearch(search);
        setResponsePage(listPageClass);
    } catch (CommonException | RuntimeException e) {
        result.recordFatalError(getString("PageRepositoryQuery.message.couldNotParseQuery", e.getMessage()), e);
        showResult(result);
        target.add(this);
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) MidPointAuthWebSession(com.evolveum.midpoint.web.security.MidPointAuthWebSession) RepoQueryDto(com.evolveum.midpoint.web.page.admin.configuration.dto.RepoQueryDto) Search(com.evolveum.midpoint.web.component.search.Search) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage) 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