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.ade.sitemap.shared;
029
030import org.opencms.gwt.shared.CmsListInfoBean;
031import org.opencms.xml.content.CmsXmlContentProperty;
032
033import java.util.HashMap;
034import java.util.LinkedHashMap;
035import java.util.Map;
036
037import com.google.gwt.user.client.rpc.IsSerializable;
038
039/**
040 * The data needed by the sitemap attribute editor dialog in the sitemap editor.
041 */
042public class CmsSitemapAttributeData implements IsSerializable {
043
044    /** The attribute definitions. */
045    protected LinkedHashMap<String, CmsXmlContentProperty> m_attributeDefinitions;
046
047    /** The attribute values. */
048    protected Map<String, String> m_attributeValues;
049
050    /** The list info bean for the sitemap configuration file. */
051    protected CmsListInfoBean m_sitemapInfo;
052
053    /** The URL to call to unlock the sitemap configuration file. */
054    protected String m_unlockUrl;
055
056    /**
057     * Creates a new instance.
058     *
059     * @param sitemapInfo the list info bean for the sitemap configuration file
060     * @param attributeDefinitions the attribute definitions
061     * @param attributeValues the attribute values
062     * @param unlockUrl the URL used to unlock the configuration file
063     */
064    public CmsSitemapAttributeData(
065        CmsListInfoBean sitemapInfo,
066        Map<String, CmsXmlContentProperty> attributeDefinitions,
067        Map<String, String> attributeValues,
068        String unlockUrl) {
069
070        m_sitemapInfo = sitemapInfo;
071        m_attributeDefinitions = new LinkedHashMap<>(attributeDefinitions);
072        m_attributeValues = new HashMap<>(attributeValues);
073        m_unlockUrl = unlockUrl;
074    }
075
076    /**
077     * Default constructor for serialization.
078     */
079    protected CmsSitemapAttributeData() {
080
081        // empty
082    }
083
084    /**
085     * Gets the attribute definitions.
086     *
087     * @return the attribute definitions
088     */
089    public LinkedHashMap<String, CmsXmlContentProperty> getAttributeDefinitions() {
090
091        return m_attributeDefinitions;
092    }
093
094    /**
095     * Gets the attribute values
096     *
097     * @return the attribute values
098     */
099    public Map<String, String> getAttributeValues() {
100
101        return m_attributeValues;
102    }
103
104    /**
105     * Gets the list info for the sitemap configuration file.
106     *
107     * @return the list info for the sitemap configuration
108     */
109    public CmsListInfoBean getInfo() {
110
111        return m_sitemapInfo;
112
113    }
114
115    /**
116     * Gets the URL which should be called to unlock the sitemap configuration
117     *
118     * @return the URL to unlock the sitemap configuration
119     */
120    public String getUnlockUrl() {
121
122        return m_unlockUrl;
123    }
124
125    /**
126     * @see java.lang.Object#toString()
127     */
128    @Override
129    public String toString() {
130
131        return "[CmsSitemapAttributeData: definitions="
132            + m_attributeDefinitions
133            + ", values="
134            + m_attributeValues
135            + "]";
136    }
137
138}