001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.staticexport;
029
030import org.opencms.file.CmsResource;
031
032/**
033 * Provides a data structure for the result of an export request.<p>
034 *
035 * @since 6.0.0
036 */
037public class CmsStaticExportData {
038
039    /** Flag to indicate whether this is the export data for a detail page. */
040    private boolean m_isDetailPage;
041
042    /** The parameters. */
043    private String m_parameters;
044
045    /** The resource to export. */
046    private CmsResource m_resource;
047
048    /** The uri to export in the rfs. */
049    private String m_rfsName;
050
051    /** The uri in the vfs. */
052    private String m_vfsName;
053
054    /**
055     * Creates a new static export data object.<p>
056     *
057     * @param vfsName the vfs name of the resource
058     * @param rfsName the rfs name of the resource
059     * @param resource the resource object
060     * @param parameters the parameter string of a resource
061     */
062    public CmsStaticExportData(String vfsName, String rfsName, CmsResource resource, String parameters) {
063
064        m_vfsName = vfsName;
065        m_rfsName = rfsName;
066        m_resource = resource;
067        m_parameters = parameters;
068    }
069
070    /**
071     * Return the parameters of the resource to export.<p>
072     *
073     * @return the parameter map
074     */
075    public String getParameters() {
076
077        return m_parameters;
078    }
079
080    /**
081     * Returns the resource to export.<p>
082     *
083     * @return the resource to export
084     */
085    public CmsResource getResource() {
086
087        return m_resource;
088    }
089
090    /**
091     * Returns the rfs name of the resource to export.<p>
092     *
093     * @return the rfs name of the resource to export
094     */
095    public String getRfsName() {
096
097        return m_rfsName;
098    }
099
100    /**
101     * Returns the vfs name of the resource to export.<p>
102     *
103     * @return the vfs name of the resource to export
104     */
105    public String getVfsName() {
106
107        return m_vfsName;
108    }
109
110    /**
111     * Returns true if this is the static export data for a detail page.<p>
112     *
113     * @return true if this is the static export data for a detail page
114     */
115    public boolean isDetailPage() {
116
117        return m_isDetailPage;
118    }
119
120    /**
121     * @see java.lang.Object#toString()
122     */
123    @Override
124    public String toString() {
125
126        StringBuffer result = new StringBuffer();
127        result.append(this.getClass().getName());
128        result.append("[vfsName=");
129        result.append(m_vfsName);
130        result.append(", rfsName=");
131        result.append(m_rfsName);
132        if (m_resource != null) {
133            result.append(", structureId=");
134            result.append(m_resource.getStructureId());
135        }
136        result.append("]");
137        return result.toString();
138    }
139
140    /**
141     * Changes the 'is detail page' flag in this export data instance.<p>
142     *
143     * @param isDetailPage the new value for the flag
144     */
145    protected void setIsDetailPage(boolean isDetailPage) {
146
147        m_isDetailPage = isDetailPage;
148    }
149
150    /**
151     * Sets the parameters.<p>
152     *
153     * @param parameters the parameters to set
154     */
155    protected void setParameters(String parameters) {
156
157        m_parameters = parameters;
158    }
159
160    /**
161     * Sets the RFS name.<p>
162     *
163     * @param rfsName the RFS name to set
164     */
165    protected void setRfsName(String rfsName) {
166
167        m_rfsName = rfsName;
168    }
169}