📄 cmsexportmoduledata.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/legacy/CmsExportModuledata.java,v $
* Date : $Date: 2006/03/27 14:53:03 $
* Version: $Revision: 1.13 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (C) 2002 Alkacon Software (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, 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 com.opencms.legacy;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsProperty;
import org.opencms.file.CmsPropertyDefinition;
import org.opencms.file.CmsResource;
import org.opencms.file.CmsResourceFilter;
import org.opencms.i18n.CmsMessageContainer;
import org.opencms.importexport.CmsExport;
import org.opencms.importexport.CmsImportExportException;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.main.OpenCms;
import org.opencms.report.I_CmsReport;
import org.opencms.util.CmsDateUtil;
import org.opencms.util.CmsXmlSaxWriter;
import com.opencms.defaults.master.*;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import java.util.zip.ZipEntry;
import org.apache.commons.logging.Log;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXWriter;
import org.xml.sax.SAXException;
/**
* Holds the functionaility to export channels and modulemasters from the cms
* to the filesystem.
*
* @author Alexander Kandzior (a.kandzior@alkacon.com)
* @author Michael Emmerich (m.emmerich@alkacon.com)
*
* @version $Revision: 1.13 $ $Date: 2006/03/27 14:53:03 $
*
* @deprecated Will not be supported past the OpenCms 6 release.
*/
public class CmsExportModuledata extends CmsExport implements Serializable {
/** Serial version UID required for safe serialization. */
private static final long serialVersionUID = -8416442909693060452L;
/** Manifest tag: master. */
public static String C_EXPORT_TAG_MASTER = "master";
/** Manifest tag: access_flags. */
public static String C_EXPORT_TAG_MASTER_ACCESSFLAGS = "access_flags";
/** Manifest tag: channelname. */
public static String C_EXPORT_TAG_MASTER_CHANNELNAME = "channelname";
/** Manifest tag: channelrelations. */
public static String C_EXPORT_TAG_MASTER_CHANNELREL = "channelrelations";
/** Manifest tag: creation_date. */
public static String C_EXPORT_TAG_MASTER_CREATEDATE = "create_date";
/** Manifest tag: data_big_. */
public static String C_EXPORT_TAG_MASTER_DATABIG = "data_big_";
/** Manifest tag: data_date_. */
public static String C_EXPORT_TAG_MASTER_DATADATE = "data_date_";
/** Manifest tag: data_int_. */
public static String C_EXPORT_TAG_MASTER_DATAINT = "data_int_";
/** Manifest tag: data_medium_. */
public static String C_EXPORT_TAG_MASTER_DATAMEDIUM = "data_medium_";
/** Manifest tag: data_reference_. */
public static String C_EXPORT_TAG_MASTER_DATAREFERENCE = "data_reference_";
/** Manifest tag: dataset. */
public static String C_EXPORT_TAG_MASTER_DATASET = "dataset";
/** Manifest tag: data_small_. */
public static String C_EXPORT_TAG_MASTER_DATASMALL = "data_small_";
/** Manifest tag: feed_filename. */
public static String C_EXPORT_TAG_MASTER_FEEDFILENAME = "feed_filename";
/** Manifest tag: feed_id. */
public static String C_EXPORT_TAG_MASTER_FEEDID = "feed_id";
/** Manifest tag: feed_reference. */
public static String C_EXPORT_TAG_MASTER_FEEDREFERENCE = "feed_reference";
/** Manifest tag: flags. */
public static String C_EXPORT_TAG_MASTER_FLAGS = "flags";
/** Manifest tag: group_name. */
public static String C_EXPORT_TAG_MASTER_GROUP = "group_name";
/** Manifest tag: master ID. */
public static String C_EXPORT_TAG_MASTER_ID = "master_id";
/** Manifest tag: media. */
public static String C_EXPORT_TAG_MASTER_MEDIA = "media";
/** Manifest tag: mediaset. */
public static String C_EXPORT_TAG_MASTER_MEDIASET = "mediaset";
/** Manifest tag: publication_date. */
public static String C_EXPORT_TAG_MASTER_PUBLICATIONDATE = "publication_date";
/** Manifest tag: purge_date. */
public static String C_EXPORT_TAG_MASTER_PURGEDATE = "purge_date";
/** Manifest tag: sub_id. */
public static String C_EXPORT_TAG_MASTER_SUBID = "sub_id";
/** Manifest tag: title. */
public static String C_EXPORT_TAG_MASTER_TITLE = "title";
/** Manifest tag: user_name. */
public static String C_EXPORT_TAG_MASTER_USER = "user_name";
/** Manifest tag: masters. */
public static String C_EXPORT_TAG_MASTERS = "masters";
/** Manifest tag: media_content. */
public static String C_EXPORT_TAG_MEDIA_CONTENT = "media_content";
/** Manifest tag: media_description. */
public static String C_EXPORT_TAG_MEDIA_DESCRIPTION = "media_description";
/** Manifest tag: media_height. */
public static String C_EXPORT_TAG_MEDIA_HEIGHT = "media_height";
/** Manifest tag: media_mimetype. */
public static String C_EXPORT_TAG_MEDIA_MIMETYPE = "media_mimetype";
/** Manifest tag: media_name. */
public static String C_EXPORT_TAG_MEDIA_NAME = "media_name";
/** Manifest tag: media_position. */
public static String C_EXPORT_TAG_MEDIA_POSITION = "media_position";
/** Manifest tag: media_size. */
public static String C_EXPORT_TAG_MEDIA_SIZE = "media_size";
/** Manifest tag: media_title. */
public static String C_EXPORT_TAG_MEDIA_TITLE = "media_title";
/** Manifest tag: media_type. */
public static String C_EXPORT_TAG_MEDIA_TYPE = "media_type";
/** Manifest tag: media_width. */
public static String C_EXPORT_TAG_MEDIA_WIDTH = "media_width";
/** The log object for this class. */
private static final Log LOG = CmsLog.getLog(CmsExportModuledata.class);
/** The channelid and the resourceobject of the exported channels. */
private Set m_exportedChannelIds;
/** Holds information about contents that have already been exported. */
private Vector m_exportedMasters = new Vector();
/**
* This constructs a new CmsExportModuledata-object which exports the channels and modulemasters.
*
* @param cms the cms-object to work with
* @param exportFile the filename of the zip to export to
* @param resourcesToExport the cos folders (channels) to export
* @param modulesToExport the modules to export
* @param report to write the progress information to
*
* @throws CmsImportExportException if something goes wrong
*/
public CmsExportModuledata(
CmsObject cms,
String exportFile,
String[] resourcesToExport,
String[] modulesToExport,
I_CmsReport report)
throws CmsImportExportException {
setCms(cms);
setReport(report);
setExportFileName(exportFile);
setExportedChannelIds(new HashSet());
// save the site root
getCms().getRequestContext().saveSiteRoot();
// open the export file
Element exportNode;
try {
exportNode = openExportFile();
// first export the cos folders (ie. channels)
getReport().println(
Messages.get().container(Messages.RPT_EXPORT_CHANNELS_BEGIN_0),
I_CmsReport.FORMAT_HEADLINE);
getCms().getRequestContext().setSiteRoot(CmsResource.VFS_FOLDER_CHANNELS);
// export all the resources
exportAllResources(exportNode, Arrays.asList(resourcesToExport));
getReport().println(
Messages.get().container(Messages.RPT_EXPORT_CHANNELS_END_0),
I_CmsReport.FORMAT_HEADLINE);
// get the modules to export
Vector modules = new Vector();
Vector moduleNames = new Vector();
for (int i = 0; i < modulesToExport.length; i++) {
String modName = modulesToExport[i];
if (modName != null && !"".equals(modName)) {
moduleNames.addElement(modulesToExport[i]);
}
}
List moduleExportables = CmsLegacyModuleAction.getLegacyModulePublishClasses();
// if there was no module selected then select all exportable modules,
// else get only the modules from Hashtable that were selected
if (moduleNames.size() == 0) {
if (resourcesToExport.length > 0) {
Iterator modElements = moduleExportables.iterator();
while (modElements.hasNext()) {
modules.add(modElements.next());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -