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, 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.xml.containerpage;
029
030import org.opencms.file.CmsResource;
031
032/**
033 * A single item of the ADE file type configuration.<p>
034 *
035 * A configuration item describes which file should be used as a template for new
036 * content elements, and at which location in the VFS they should be created.<p>
037 *
038 * It does not contain a type, since the type is given by the type of the source file.<p>
039 *
040 * @since 7.6
041 */
042public class CmsConfigurationItem {
043
044    /** The destination folder. */
045    private final CmsResource m_folder;
046
047    /** Flag to indicate if this item is default for it's resource-type. */
048    private boolean m_isDefault;
049
050    /** The lazy folder object. */
051    private CmsLazyFolder m_lazyFolder;
052
053    /** The file pattern. */
054    private final String m_pattern;
055
056    /** The source file. */
057    private final CmsResource m_sourceFile;
058
059    /**
060     * Creates a new type configuration item.<p>
061     *
062     * @param sourceFile the source file
063     * @param destinationFolder the destination folder
064     * @param lazyFolder the lazy folder object
065     * @param pattern the file pattern
066     * @param isDefault <code>true</code> if this item is default for it's resource-type
067     **/
068    public CmsConfigurationItem(
069        CmsResource sourceFile,
070        CmsResource destinationFolder,
071        CmsLazyFolder lazyFolder,
072        String pattern,
073        boolean isDefault) {
074
075        m_isDefault = isDefault;
076        m_sourceFile = sourceFile;
077        m_folder = destinationFolder;
078        m_pattern = pattern;
079        m_lazyFolder = lazyFolder;
080    }
081
082    /**
083     * Returns the destination folder uri.<p>
084     *
085     * @return the destination folder uri
086     */
087    public CmsResource getFolder() {
088
089        return m_folder;
090    }
091
092    /**
093     * Returns a helper object which represents a folder which may still have to be created.<p>
094     *
095     * @return a lazy folder object
096     */
097    public CmsLazyFolder getLazyFolder() {
098
099        return m_lazyFolder;
100    }
101
102    /**
103     * Returns the file pattern.<p>
104     *
105     * @return the file pattern
106     */
107    public String getPattern() {
108
109        return m_pattern;
110    }
111
112    /**
113     * Gets the source file uri.<p>
114     *
115     * @return the source file uri
116     */
117    public CmsResource getSourceFile() {
118
119        return m_sourceFile;
120    }
121
122    /**
123     * Returns if this item is default for it's resource-type.<p>
124     *
125     * @return <code>true</code> if this item is default for it's resource-type
126     */
127    public boolean isDefault() {
128
129        return m_isDefault;
130    }
131}