cmshistorylist.java
来自「找了很久才找到到源代码」· Java 代码 · 共 826 行 · 第 1/3 页
JAVA
826 行
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/commons/CmsHistoryList.java,v $
* Date : $Date: 2007-08-13 16:29:45 $
* Version: $Revision: 1.9 $
*
* 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.commons;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsProject;
import org.opencms.file.CmsResource;
import org.opencms.file.CmsResourceFilter;
import org.opencms.file.CmsVfsResourceNotFoundException;
import org.opencms.file.history.CmsHistoryProject;
import org.opencms.file.history.CmsHistoryResourceHandler;
import org.opencms.file.history.I_CmsHistoryResource;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.main.CmsRuntimeException;
import org.opencms.main.OpenCms;
import org.opencms.security.CmsPrincipal;
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.CmsListDirectAction;
import org.opencms.workplace.list.CmsListItem;
import org.opencms.workplace.list.CmsListItemActionIconComparator;
import org.opencms.workplace.list.CmsListItemDetails;
import org.opencms.workplace.list.CmsListItemDetailsFormatter;
import org.opencms.workplace.list.CmsListItemSelectionAction;
import org.opencms.workplace.list.CmsListMetadata;
import org.opencms.workplace.list.CmsListOrderEnum;
import org.opencms.workplace.list.CmsListRadioMultiAction;
import org.opencms.workplace.list.CmsListResourceIconAction;
import org.opencms.workplace.list.I_CmsListFormatter;
import org.opencms.workplace.tools.CmsToolDialog;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import org.apache.commons.logging.Log;
/**
* Displays the history of a file.<p>
*
* @author Jan Baudisch
* @author Armen Markarian
*
* @version $Revision: 1.9 $
*
* @since 6.0.2
*/
public class CmsHistoryList extends A_CmsListDialog {
/**
* Wrapper class for the version which is either an integer or the string "offline".<p>
*/
public static class CmsVersionWrapper implements Comparable {
/** the version. */
private Integer m_version;
/**
* Constructs a new version wrapper.<p>
*
* @param version the version of the file
*/
public CmsVersionWrapper(int version) {
m_version = new Integer(version);
}
/**
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object o) {
if (this == o) {
return 0;
}
if (o instanceof CmsVersionWrapper) {
CmsVersionWrapper version = (CmsVersionWrapper)o;
Integer v1 = m_version;
Integer v2 = version.getVersion();
if (v1.intValue() < 0) {
v1 = new Integer(-1 * v1.intValue());
}
if (v2.intValue() < 0) {
v2 = new Integer(-1 * v2.intValue());
}
return ((Comparable)v1).compareTo(v2);
}
return 0;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof CmsVersionWrapper) {
CmsVersionWrapper version = (CmsVersionWrapper)obj;
return getVersion().equals(version.getVersion());
}
return false;
}
/**
* Returns the version of the file.<p>
*
* @return the version of the file
*/
public Integer getVersion() {
return m_version;
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return getVersion().hashCode();
}
/**
*
* @see java.lang.Object#toString()
*/
public String toString() {
return m_version.toString();
}
}
/** list item detail id constant. */
public static final String GUI_LIST_HISTORY_DETAIL_PROJECT_0 = "lhdp";
/** List action export. */
public static final String LIST_ACTION_RESTORE = "ar";
/** list action id constant. */
public static final String LIST_ACTION_VIEW = "av";
/** list column id constant. */
public static final String LIST_COLUMN_DATE_LAST_MODIFIED = "cm";
/** list column id constant. */
public static final String LIST_COLUMN_DATE_PUBLISHED = "cdp";
/** list column id constant. */
public static final String LIST_COLUMN_FILE_TYPE = "ct";
/** list column id constant. */
public static final String LIST_COLUMN_ICON = "ci";
/** list column id constant. */
public static final String LIST_COLUMN_PUBLISH_TAG = "cbt";
/** list column id constant. */
public static final String LIST_COLUMN_RESOURCE_PATH = "crp";
/** List column delete. */
public static final String LIST_COLUMN_RESTORE = "cr";
/** list column id constant. */
public static final String LIST_COLUMN_SEL1 = "cs1";
/** list column id constant. */
public static final String LIST_COLUMN_SEL2 = "cs2";
/** list column id constant. */
public static final String LIST_COLUMN_SIZE = "cs";
/** list column id constant. */
public static final String LIST_COLUMN_STRUCTURE_ID = "csi";
/** List column export. */
public static final String LIST_COLUMN_USER = "cu";
/** list column id constant. */
public static final String LIST_COLUMN_VERSION = "cv";
/** List column export. */
public static final String LIST_COLUMN_VIEW = "cp";
/** list id constant. */
public static final String LIST_ID = "him";
/** list independent action id constant. */
public static final String LIST_RACTION_SEL1 = "rs1";
/** list independent action id constant. */
public static final String LIST_RACTION_SEL2 = "rs2";
/** parameter for the path of the first resource. */
public static final String PARAM_ID_1 = "id1";
/** parameter for the path of the second resource. */
public static final String PARAM_ID_2 = "id2";
/** parameter for the version of the first resource. */
public static final String PARAM_VERSION_1 = "version1";
/** parameter for the version of the second resource. */
public static final String PARAM_VERSION_2 = "version2";
/** Path to the list buttons. */
public static final String PATH_BUTTONS = "buttons/";
/** list multi action id constant. */
private static final String LIST_MACTION_COMPARE = "mc";
/** The log object for this class. */
private static final Log LOG = CmsLog.getLog(CmsHistoryList.class);
/**
* Public constructor.<p>
*
* @param jsp an initialized JSP action element
*/
public CmsHistoryList(CmsJspActionElement jsp) {
super(
jsp,
LIST_ID,
Messages.get().container(Messages.GUI_HISTORY_0),
LIST_COLUMN_VERSION,
CmsListOrderEnum.ORDER_DESCENDING,
null);
}
/**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?