Search in sources :

Example 1 with MidPointAuthWebSession

use of com.evolveum.midpoint.web.security.MidPointAuthWebSession 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)

Example 2 with MidPointAuthWebSession

use of com.evolveum.midpoint.web.security.MidPointAuthWebSession in project midpoint by Evolveum.

the class OrgTreePanel method getOrgTreeStateStorage.

public OrgTreeStateStorage getOrgTreeStateStorage() {
    MidPointAuthWebSession session = OrgTreePanel.this.getSession();
    SessionStorage storage = session.getSessionStorage();
    return storage.getOrgStructurePanelStorage();
}
Also used : SessionStorage(com.evolveum.midpoint.web.session.SessionStorage) MidPointAuthWebSession(com.evolveum.midpoint.web.security.MidPointAuthWebSession)

Example 3 with MidPointAuthWebSession

use of com.evolveum.midpoint.web.security.MidPointAuthWebSession in project midpoint by Evolveum.

the class BoxedTablePanel method getItemsPerPage.

private int getItemsPerPage(UserProfileStorage.TableId tableId) {
    if (tableId == null) {
        return UserProfileStorage.DEFAULT_PAGING_SIZE;
    }
    MidPointAuthWebSession session = getSession();
    UserProfileStorage userProfile = session.getSessionStorage().getUserProfile();
    return userProfile.getPagingSize(tableId);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) MidPointAuthWebSession(com.evolveum.midpoint.web.security.MidPointAuthWebSession)

Aggregations

MidPointAuthWebSession (com.evolveum.midpoint.web.security.MidPointAuthWebSession)3 SessionStorage (com.evolveum.midpoint.web.session.SessionStorage)2 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 Search (com.evolveum.midpoint.web.component.search.Search)1 RepoQueryDto (com.evolveum.midpoint.web.page.admin.configuration.dto.RepoQueryDto)1 PageStorage (com.evolveum.midpoint.web.session.PageStorage)1 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)1 SearchFilterType (com.evolveum.prism.xml.ns._public.query_3.SearchFilterType)1