001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (C) Alkacon Software (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.ade.galleries.shared;
029
030/**
031 * An enum that represents the possible search scope choices in the ADE gallery search tab.<p>
032 */
033public enum CmsGallerySearchScope {
034
035    /** Search everything. */
036    everything(true, true, true, "GUI_SCOPE_EVERYTHING_0"),
037
038    /** Search only in the shared folder. */
039    shared(false, false, true, "GUI_SCOPE_SHARED_0"),
040
041    /** Search in the current site. */
042    site(true, false, false, "GUI_SCOPE_SITE_0"),
043
044    /** Search in the current site and the shared folder. */
045    siteShared(true, false, true, "GUI_SCOPE_SITESHARED_0"),
046
047    /** Search in the current subsite. */
048    subSite(false, true, false, "GUI_SCOPE_SUBSITE_0"),
049
050    /** Search in the current subsite and the shared folder. */
051    subSiteShared(false, true, true, "GUI_SCOPE_SUBSITESHARED_0");
052
053    /** The localization key.*/
054    private final String m_key;
055
056    /** If true, search in the shared folder. */
057    private final boolean m_shared;
058
059    /** If true, search in the current site. */
060    private final boolean m_site;
061
062    /** If true, search in the current sub-site. */
063    private final boolean m_subSite;
064
065    /**
066     * Default constructor needed for serialization.<p>
067     */
068    CmsGallerySearchScope() {
069
070        m_subSite = false;
071        m_shared = false;
072        m_key = null;
073        m_site = false;
074    }
075
076    /**
077     * Creates a new search scope choice.<p>
078     *
079     * @param siteParam true if the current site should be searched
080     * @param subSiteParam true if the current subsite should be searched
081     * @param sharedParam true if the shared folder should be searched
082     * @param key the localization key for the choice
083     */
084    CmsGallerySearchScope(boolean siteParam, boolean subSiteParam, boolean sharedParam, String key) {
085
086        m_site = siteParam;
087        m_subSite = subSiteParam;
088        m_shared = sharedParam;
089        m_key = key;
090    }
091
092    /**
093     * Returns the localization key for the choice.<p>
094     *
095     * @return the localization key for the choice
096     */
097    public String getKey() {
098
099        return m_key;
100    }
101
102    /**
103     * Returns if this search scope includes the shared folder.<p>
104     *
105     * @return <code>true</code> if this search scope includes the shared folder
106     */
107    public boolean isIncludeShared() {
108
109        return m_shared;
110    }
111
112    /**
113     * Returns if this search scope includes the site folder.<p>
114     *
115     * @return <code>true</code> if this search scope includes the site folder
116     */
117    public boolean isIncludeSite() {
118
119        return m_site;
120    }
121
122    /**
123     * Returns if this search scope includes the sub site folder.<p>
124     *
125     * @return <code>true</code> if this search scope includes the sub site folder
126     */
127    public boolean isIncludeSubSite() {
128
129        return m_subSite;
130    }
131}