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.workplace.tools;
029
030import java.util.HashMap;
031import java.util.Map;
032
033/**
034 * Store for some administration view parameters,
035 * for each user, used by the <code>{@link CmsToolManager}</code>.<p>
036 *
037 * @since 6.0.0
038 */
039public class CmsToolUserData {
040
041    /** base tool for the user, root-based. */
042    private Map<String, String> m_baseTools;
043
044    /** Current used tool paths, root-based. */
045    private Map<String, String> m_currentToolPaths;
046
047    /** root key for the user. */
048    private String m_rootKey;
049
050    /**
051     * Default Constructor.<p>
052     */
053    public CmsToolUserData() {
054
055        m_baseTools = new HashMap<String, String>();
056        m_currentToolPaths = new HashMap<String, String>();
057    }
058
059    /**
060     * Returns the base tool.<p>
061     *
062     * @param rootKey the tool root
063     *
064     * @return the base tool
065     */
066    public String getBaseTool(String rootKey) {
067
068        return m_baseTools.get(rootKey);
069    }
070
071    /**
072     * Returns the current tool path.<p>
073     *
074     * @param rootKey the tool root
075     *
076     * @return the current tool path
077     */
078    public String getCurrentToolPath(String rootKey) {
079
080        return m_currentToolPaths.get(rootKey);
081    }
082
083    /**
084     * Returns the root key.<p>
085     *
086     * @return the root key
087     */
088    public String getRootKey() {
089
090        return m_rootKey;
091    }
092
093    /**
094     * Sets the base tool.<p>
095     *
096     * @param rootKey the tool root
097     * @param baseTool the base tool to set
098     */
099    public void setBaseTool(String rootKey, String baseTool) {
100
101        m_baseTools.put(rootKey, baseTool);
102    }
103
104    /**
105     * Sets the current tool path.<p>
106     *
107     * @param rootKey the tool root
108     * @param currentToolPath the current tool path to set
109     */
110    public void setCurrentToolPath(String rootKey, String currentToolPath) {
111
112        m_currentToolPaths.put(rootKey, currentToolPath);
113    }
114
115    /**
116     * Sets the root key.<p>
117     *
118     * @param key the root key to set
119     */
120    public void setRootKey(String key) {
121
122        m_rootKey = key;
123    }
124
125}