a_cmsgroupuserslist.java
来自「找了很久才找到到源代码」· Java 代码 · 共 449 行 · 第 1/2 页
JAVA
449 行
/*
* File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/A_CmsGroupUsersList.java,v $
* Date : $Date: 2007-08-13 16:29:46 $
* Version: $Revision: 1.18 $
*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) 2002 - 2007 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.workplace.tools.accounts;
import org.opencms.file.CmsUser;
import org.opencms.i18n.CmsMessageContainer;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.main.CmsException;
import org.opencms.security.CmsOrganizationalUnit;
import org.opencms.util.CmsUUID;
import org.opencms.workplace.list.A_CmsListDialog;
import org.opencms.workplace.list.CmsListColumnAlignEnum;
import org.opencms.workplace.list.CmsListColumnDefinition;
import org.opencms.workplace.list.CmsListIndependentAction;
import org.opencms.workplace.list.CmsListItem;
import org.opencms.workplace.list.CmsListItemDetails;
import org.opencms.workplace.list.CmsListItemDetailsFormatter;
import org.opencms.workplace.list.CmsListMetadata;
import org.opencms.workplace.list.CmsListOrderEnum;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.jsp.JspException;
/**
* Generalized user groups view.<p>
*
* @author Michael Moossen
*
* @version $Revision: 1.18 $
*
* @since 6.0.0
*/
public abstract class A_CmsGroupUsersList extends A_CmsListDialog {
/** list action id constant. */
public static final String LIST_ACTION_ICON = "ai";
/** list action id constant. */
public static final String LIST_ACTION_STATE = "as";
/** list column id constant. */
public static final String LIST_COLUMN_FULLNAME = "cf";
/** list column id constant. */
public static final String LIST_COLUMN_ICON = "ci";
/** list column id constant. */
public static final String LIST_COLUMN_LOGIN = "cl";
/** list column id constant. */
public static final String LIST_COLUMN_NAME = "cn";
/** list column id constant. */
public static final String LIST_COLUMN_ORGUNIT = "co";
/** list column id constant. */
public static final String LIST_COLUMN_STATE = "cs";
/** list item detail id constant. */
public static final String LIST_DETAIL_OTHEROU = "doo";
/** Cached value. */
private Boolean m_hasUsersInOtherOus;
/** Stores the value of the request parameter for the user id. */
private String m_paramGroupid;
/** Stores the value of the request parameter for the user name. */
private String m_paramGroupname;
/** Stores the value of the request parameter for the organizational unit fqn. */
private String m_paramOufqn;
/**
* Public constructor.<p>
*
* @param jsp an initialized JSP action element
* @param listId the id of the list
* @param listName the name of the list
* @param searchable searchable flag
*/
protected A_CmsGroupUsersList(
CmsJspActionElement jsp,
String listId,
CmsMessageContainer listName,
boolean searchable) {
super(jsp, listId, listName, LIST_COLUMN_LOGIN, CmsListOrderEnum.ORDER_ASCENDING, searchable ? LIST_COLUMN_NAME
: null);
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#actionDialog()
*/
public void actionDialog() throws JspException, ServletException, IOException {
updateGroupList();
super.actionDialog();
}
/**
* Returns the user id parameter value.<p>
*
* @return the user id parameter value
*/
public String getParamGroupid() {
return m_paramGroupid;
}
/**
* Returns the Group name parameter.<p>
*
* @return the Group name paramter
*/
public String getParamGroupname() {
return m_paramGroupname;
}
/**
* Returns the right icon path for the given list item.<p>
*
* @param item the list item to get the icon path for
*
* @return the icon path for the given role
*/
public String getIconPath(CmsListItem item) {
try {
CmsUser user = getCms().readUser((String)item.get(LIST_COLUMN_LOGIN));
if (user.getOuFqn().equals(getParamOufqn())) {
return A_CmsUsersList.PATH_BUTTONS + "user.png";
} else {
return A_CmsUsersList.PATH_BUTTONS + "user_other_ou.png";
}
} catch (CmsException e) {
return A_CmsUsersList.PATH_BUTTONS + "user.png";
}
}
/**
* Returns the organizational unit fqn parameter value.<p>
*
* @return the organizational unit fqn parameter value
*/
public String getParamOufqn() {
return m_paramOufqn;
}
/**
* Returns true if the list of users has users of other organizational units.<p>
*
* @return <code>true</code> if the list of users has users of other organizational units
*/
public boolean hasUsersInOtherOus() {
if (m_hasUsersInOtherOus == null) {
// lazzy initialization
m_hasUsersInOtherOus = Boolean.FALSE;
try {
Iterator itUsers = getUsers(true).iterator();
while (itUsers.hasNext()) {
CmsUser user = (CmsUser)itUsers.next();
if (!user.getOuFqn().equals(getParamOufqn())) {
m_hasUsersInOtherOus = Boolean.TRUE;
break;
}
}
} catch (Exception e) {
// ignore
}
}
return m_hasUsersInOtherOus.booleanValue();
}
/**
* Sets the user id parameter value.<p>
*
* @param userId the user id parameter value
*/
public void setParamGroupid(String userId) {
m_paramGroupid = userId;
}
/**
* Sets the organizational unit fqn parameter value.<p>
*
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?