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.gwt.shared.property;
029
030import org.opencms.gwt.shared.CmsListInfoBean;
031import org.opencms.util.CmsUUID;
032import org.opencms.xml.content.CmsXmlContentProperty;
033
034import java.util.List;
035import java.util.Map;
036
037import com.google.gwt.user.client.rpc.IsSerializable;
038
039/**
040 * A bean containing the information needed to edit the properties of a resource.<p>
041 *
042 * @since 8.0.0
043 */
044public class CmsPropertiesBean implements IsSerializable {
045
046    /** A list of all property names. */
047    private List<String> m_allProperties;
048
049    /** The map of inherited properties of the resource. */
050    private Map<String, CmsClientProperty> m_inheritedProperties;
051
052    /** Indicates if the resource is a container page. */
053    private boolean m_isContainerPage;
054
055    /** Indicates if the resource is a folder. */
056    private boolean m_isFolder;
057
058    /** A map of the resource's own properties. */
059    private Map<String, CmsClientProperty> m_ownProperties;
060
061    /** Page information for displaying a list item representing the resource. */
062    private CmsListInfoBean m_pageInfo;
063
064    /** A map of configured properties. */
065    private Map<String, CmsXmlContentProperty> m_propertyDefinitions;
066
067    /** The site path of the resource. */
068    private String m_sitePath;
069
070    /** The structure id of the resource. */
071    private CmsUUID m_structureId;
072
073    /** The map of available templates. */
074    private Map<String, CmsClientTemplateBean> m_templates;
075
076    /** Flag which indicates whether the properties are read-only. */
077    private boolean m_isReadOnly;
078
079    /**
080     * Creates a new instance.<p>
081     */
082    public CmsPropertiesBean() {
083
084        // do nothing
085    }
086
087    /**
088     * Returns a list of all property names.<p>
089     *
090     * @return a list of all property names
091     */
092    public List<String> getAllProperties() {
093
094        return m_allProperties;
095    }
096
097    /**
098     * Returns a map of the inherited properties.<p>
099     *
100     * @return a map of inherited properties
101     */
102    public Map<String, CmsClientProperty> getInheritedProperties() {
103
104        return m_inheritedProperties;
105    }
106
107    /**
108     * Gets a map of the resource's own properties.<p>
109     *
110     * @return the resource's own properties
111     */
112    public Map<String, CmsClientProperty> getOwnProperties() {
113
114        return m_ownProperties;
115    }
116
117    /**
118     * Gets the list info bean for the resource.<p>
119     *
120     * @return a list info bean
121     */
122    public CmsListInfoBean getPageInfo() {
123
124        return m_pageInfo;
125    }
126
127    /**
128     * Gets a map of the configured properties.<p>
129     *
130     * @return the configured properties as a map
131     */
132    public Map<String, CmsXmlContentProperty> getPropertyDefinitions() {
133
134        return m_propertyDefinitions;
135    }
136
137    /**
138     * Gets the site path of the resource.<p>
139     *
140     * @return the site path of the resource
141     */
142    public String getSitePath() {
143
144        return m_sitePath;
145    }
146
147    /**
148     * Gets the structure id of the resource.<p>
149     *
150     * @return the structure id of the resource
151     */
152    public CmsUUID getStructureId() {
153
154        return m_structureId;
155    }
156
157    /**
158     * Gets a map of the available templates.<p>
159     *
160     * @return the available templates
161     */
162    public Map<String, CmsClientTemplateBean> getTemplates() {
163
164        return m_templates;
165    }
166
167    /**
168     * Returns the if the resource is a container page.<p>
169     *
170     * @return the if the resource is a container page
171     */
172    public boolean isContainerPage() {
173
174        return m_isContainerPage;
175    }
176
177    /**
178     * Returns the if the resource is a folder.<p>
179     *
180     * @return the if the resource is a folder
181     */
182    public boolean isFolder() {
183
184        return m_isFolder;
185    }
186
187    /**
188     * If true, the properties can't be modified.<p>
189     *
190     * @return true if the properties can't be modified
191     */
192    public boolean isReadOnly() {
193
194        return m_isReadOnly;
195    }
196
197    /**
198     * Sets the list of property names.<p>
199     *
200     * @param allProperties the list of property names
201     */
202    public void setAllProperties(List<String> allProperties) {
203
204        m_allProperties = allProperties;
205    }
206
207    /**
208     * Sets if the resource is a container page.<p>
209     *
210     * @param isContainerPage <code>true</code> if the resource is a container page
211     */
212    public void setContainerPage(boolean isContainerPage) {
213
214        m_isContainerPage = isContainerPage;
215    }
216
217    /**
218     * Sets if the resource is a folder.<p>
219     *
220     * @param isFolder <code>true</code> if the resource is a folder
221     */
222    public void setFolder(boolean isFolder) {
223
224        m_isFolder = isFolder;
225    }
226
227    /**
228     * Sets the inherited properties.<p>
229     *
230     * @param inheritedProperties the inherited properties
231     */
232    public void setInheritedProperties(Map<String, CmsClientProperty> inheritedProperties) {
233
234        m_inheritedProperties = inheritedProperties;
235    }
236
237    /**
238     * Sets the resource's own properties.<p>
239     *
240     * @param ownProperties the resource's own properties
241     */
242    public void setOwnProperties(Map<String, CmsClientProperty> ownProperties) {
243
244        m_ownProperties = ownProperties;
245    }
246
247    /**
248     * Sets the page info.<p>
249     *
250     * @param pageInfo the page info
251     */
252    public void setPageInfo(CmsListInfoBean pageInfo) {
253
254        m_pageInfo = pageInfo;
255    }
256
257    /**
258     * Sets the property configuration.<p>
259     *
260     * @param propertyDefinitions the property configuration
261     */
262    public void setPropertyDefinitions(Map<String, CmsXmlContentProperty> propertyDefinitions) {
263
264        m_propertyDefinitions = propertyDefinitions;
265    }
266
267    /**
268     * Sets "readonly mode".<p>
269     *
270     * @param isReadOnly true if "readonly mode" should be enabled
271     */
272    public void setReadOnly(boolean isReadOnly) {
273
274        m_isReadOnly = isReadOnly;
275    }
276
277    /**
278     * Sets the site path.<p>
279     * @param sitePath
280     */
281    public void setSitePath(String sitePath) {
282
283        m_sitePath = sitePath;
284    }
285
286    /**
287     * Sets the structure id.<p>
288     *
289     * @param structureId the structure id
290     */
291    public void setStructureId(CmsUUID structureId) {
292
293        m_structureId = structureId;
294    }
295
296    /**
297     * Sets the available templates.<p>
298     *
299     * @param templates the available templates
300     */
301    public void setTemplates(Map<String, CmsClientTemplateBean> templates) {
302
303        m_templates = templates;
304    }
305}