Skip to content

Commit

Permalink
session storage for object list page
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Dec 26, 2018
1 parent 05bb24d commit ddcfc33
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
Expand Up @@ -499,7 +499,7 @@ protected WebMarkupContainer createTableButtonToolbar(String id) {
return null;
}

private String getStorageKey() {
protected String getStorageKey() {
String storageKey = WebComponentUtil.getStorageKeyForPage(parentPage.getClass());
if (storageKey == null) {
storageKey = WebComponentUtil.getStorageKeyForTableId(tableId);
Expand Down
Expand Up @@ -17,6 +17,7 @@

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.MainObjectListPanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectOrdering;
Expand All @@ -27,8 +28,10 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.session.SessionStorage;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
Expand Down Expand Up @@ -135,6 +138,14 @@ protected String getTableIdKeyValue(){
return collectionNameParameter == null || collectionNameParameter.isEmpty() ?
super.getTableIdKeyValue() : super.getTableIdKeyValue() + "." + collectionNameParameter.toString();
}

@Override
protected String getStorageKey() {
StringValue collectionName = getCollectionNameParameterValue();
String key = (collectionName != null && StringUtils.isNotEmpty(collectionName.toString()))?
SessionStorage.KEY_OBJECT_LIST + "." + collectionName : SessionStorage.KEY_OBJECT_LIST + "." + getType().getSimpleName();
return key;
}
};

userListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_USER_BOX_CSS_CLASSES);
Expand Down
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.session;

import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.web.component.search.Search;

/**
* Created by honchar.
*/
public class ObjectListStorage implements PageStorage, DebugDumpable {

private static final long serialVersionUID = 1L;

private Search objectListSearch;
private ObjectPaging objectListTablePaging;

@Override
public ObjectPaging getPaging() {
return objectListTablePaging;
}

@Override
public void setPaging(ObjectPaging usersPaging) {
this.objectListTablePaging = usersPaging;
}

@Override
public Search getSearch() {
return objectListSearch;
}

@Override
public void setSearch(Search usersSearch) {
this.objectListSearch = usersSearch;
}

@Override
public String debugDump() {
return debugDump(0);
}

@Override
public String debugDump(int indent) {
StringBuilder sb = new StringBuilder();
DebugUtil.indentDebugDump(sb, indent);
sb.append("ObjectListStorage\n");
DebugUtil.debugDumpWithLabelLn(sb, "objectListSearch", objectListSearch, indent+1);
DebugUtil.debugDumpWithLabelLn(sb, "objectListTablePaging", objectListTablePaging, indent+1);
return sb.toString();
}
}
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import org.apache.commons.lang.StringUtils;

/**
* @author lazyman
Expand Down Expand Up @@ -62,6 +63,7 @@ public class SessionStorage implements Serializable, DebugDumpable {
public static final String KEY_ORG_MEMEBER_PANEL = "orgMemberPanel";
public static final String KEY_SERVICE_MEMEBER_PANEL = "serviceMemberPanel";
public static final String KEY_WORK_ITEMS = "workItems";
public static final String KEY_OBJECT_LIST = "objectListPage";

private static final String KEY_TASKS = "tasks";
private static final String KEY_CERT_CAMPAIGNS = "certCampaigns";
Expand Down Expand Up @@ -104,6 +106,13 @@ public UsersStorage getUsers() {
return (UsersStorage)pageStorageMap.get(KEY_USERS);
}

public ObjectListStorage getObjectListStorage(String key) {
if (pageStorageMap.get(key) != null) {
pageStorageMap.put(key, new ObjectListStorage());
}
return (ObjectListStorage) pageStorageMap.get(key);
}

public ResourcesStorage getResources() {
if (pageStorageMap.get(KEY_RESOURCES) == null) {
pageStorageMap.put(KEY_RESOURCES, new ResourcesStorage());
Expand Down Expand Up @@ -259,7 +268,10 @@ public UserProfileStorage getUserProfile(){

public PageStorage initPageStorage(String key){
PageStorage pageStorage = null;
if (KEY_USERS.equals(key)){
if (key.startsWith(KEY_OBJECT_LIST)) {
pageStorage = new ObjectListStorage();
pageStorageMap.put(key, pageStorage);
} else if (KEY_USERS.equals(key)){
pageStorage = new UsersStorage();
pageStorageMap.put(KEY_USERS, pageStorage);

Expand Down

0 comments on commit ddcfc33

Please sign in to comment.