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.client;
029
030import org.opencms.gwt.client.util.CmsEditableDataUtil;
031import org.opencms.gwt.shared.I_CmsEditableDataExtensions;
032import org.opencms.util.CmsUUID;
033
034/**
035 * Bean holding data needed to open the xml content editor.<p>
036 *
037 * @since 8.0.1
038 */
039public class CmsEditableData implements I_CmsEditableData {
040
041    /** The context id, identifying the collector list  instance. */
042    private String m_contextId;
043
044    /** The edit id. */
045    private String m_editId;
046
047    /** The element id. */
048    private String m_elementId;
049
050    /** The element language. */
051    private String m_elementLanguage;
052
053    /** The element name. */
054    private String m_elementName;
055
056    /** The extended attributes. */
057    private I_CmsEditableDataExtensions m_extensions;
058
059    /** Indicates the availability of an edit handler for the content resource type. */
060    private boolean m_hasEditHandler;
061
062    /** True if there is a resource for the editable element. */
063    private boolean m_hasResource;
064
065    /** The main language to copy in case the element language node does not exist yet. */
066    private String m_mainLanguage;
067
068    /** The new link. */
069    private String m_newLink;
070
071    /** The new title. */
072    private String m_newTitle;
073
074    /** The no edit reason. */
075    private String m_noEditReason;
076
077    /** The optional class name of a post-create handler. */
078    private String m_postCreateHandler;
079
080    /** The site path. */
081    private String m_sitePath;
082
083    /** The structure id. */
084    private CmsUUID m_structureId;
085
086    /** The unreleased or expired flag. */
087    private boolean m_unreleaseOrExpired;
088
089    /**
090     * Default constructor.<p>
091     */
092    public CmsEditableData() {
093
094        m_extensions = CmsEditableDataUtil.parseExtensions("{}");
095    }
096
097    /**
098     * Copy constructor.<p>
099     *
100     * @param source the source to copy
101     */
102    public CmsEditableData(I_CmsEditableData source) {
103
104        m_extensions = source.getExtensions();
105        m_contextId = source.getContextId();
106        m_editId = source.getEditId();
107        m_elementLanguage = source.getElementLanguage();
108        m_elementName = source.getElementName();
109        m_hasEditHandler = source.hasEditHandler();
110        m_newLink = source.getNewLink();
111        m_newTitle = source.getNewTitle();
112        m_noEditReason = source.getNoEditReason();
113        m_postCreateHandler = source.getPostCreateHandler();
114        m_sitePath = source.getSitePath();
115        m_structureId = source.getStructureId();
116        m_unreleaseOrExpired = source.isUnreleasedOrExpired();
117        m_hasResource = source.hasResource();
118        m_elementId = source.getElementId();
119    }
120
121    /**
122     * @see org.opencms.gwt.client.I_CmsEditableData#getContextId()
123     */
124    public String getContextId() {
125
126        return m_contextId;
127    }
128
129    /**
130     * @see org.opencms.gwt.client.I_CmsEditableData#getEditId()
131     */
132    public String getEditId() {
133
134        return m_editId;
135    }
136
137    /**
138     * @see org.opencms.gwt.client.I_CmsEditableData#getElementId()
139     */
140    public String getElementId() {
141
142        return m_elementId;
143    }
144
145    /**
146     * @see org.opencms.gwt.client.I_CmsEditableData#getElementLanguage()
147     */
148    public String getElementLanguage() {
149
150        return m_elementLanguage;
151    }
152
153    /**
154     * @see org.opencms.gwt.client.I_CmsEditableData#getElementName()
155     */
156    public String getElementName() {
157
158        return m_elementName;
159    }
160
161    /**
162     * @see org.opencms.gwt.client.I_CmsEditableData#getExtensions()
163     */
164    public I_CmsEditableDataExtensions getExtensions() {
165
166        return m_extensions;
167    }
168
169    /**
170     * Returns the main language to copy in case the element language node does not exist yet.<p>
171     *
172     * @return the main language to copy in case the element language node does not exist yet
173     */
174    public String getMainLanguage() {
175
176        return m_mainLanguage;
177    }
178
179    /**
180     * @see org.opencms.gwt.client.I_CmsEditableData#getNewLink()
181     */
182    public String getNewLink() {
183
184        return m_newLink;
185    }
186
187    /**
188     * @see org.opencms.gwt.client.I_CmsEditableData#getNewTitle()
189     */
190    public String getNewTitle() {
191
192        return m_newTitle;
193    }
194
195    /**
196     * @see org.opencms.gwt.client.I_CmsEditableData#getNoEditReason()
197     */
198    public String getNoEditReason() {
199
200        return m_noEditReason;
201    }
202
203    /**
204     * @see org.opencms.gwt.client.I_CmsEditableData#getPostCreateHandler()
205     */
206    public String getPostCreateHandler() {
207
208        return m_postCreateHandler;
209    }
210
211    /**
212     * @see org.opencms.gwt.client.I_CmsEditableData#getSitePath()
213     */
214    public String getSitePath() {
215
216        return m_sitePath;
217    }
218
219    /**
220     * @see org.opencms.gwt.client.I_CmsEditableData#getStructureId()
221     */
222    public CmsUUID getStructureId() {
223
224        return m_structureId;
225    }
226
227    /**
228     * @see org.opencms.gwt.client.I_CmsEditableData#hasEditHandler()
229     */
230    public boolean hasEditHandler() {
231
232        return m_hasEditHandler;
233    }
234
235    /**
236     * @see org.opencms.gwt.client.I_CmsEditableData#hasResource()
237     */
238    public boolean hasResource() {
239
240        return m_hasResource;
241    }
242
243    /**
244     * @see org.opencms.gwt.client.I_CmsEditableData#isUnreleasedOrExpired()
245     */
246    public boolean isUnreleasedOrExpired() {
247
248        return m_unreleaseOrExpired;
249    }
250
251    /**
252     * Sets  the collector context id.<p>
253     *
254     * @param id the collector context id
255     */
256    public void setContextId(String id) {
257
258        m_contextId = id;
259
260    }
261
262    /**
263     * Sets the edit id.<p>
264     *
265     * @param editId the edit id to set
266     */
267    public void setEditId(String editId) {
268
269        m_editId = editId;
270    }
271
272    /**
273     * Sets the element language.<p>
274     *
275     * @param elementLanguage the element language to set
276     */
277    public void setElementLanguage(String elementLanguage) {
278
279        m_elementLanguage = elementLanguage;
280    }
281
282    /**
283     * Sets the element name.<p>
284     *
285     * @param elementName the element name to set
286     */
287    public void setElementName(String elementName) {
288
289        m_elementName = elementName;
290    }
291
292    /**
293     * Sets the hasEditHandler.<p>
294     *
295     * @param hasEditHandler the hasEditHandler to set
296     */
297    public void setHasEditHandler(boolean hasEditHandler) {
298
299        m_hasEditHandler = hasEditHandler;
300    }
301
302    /**
303     * Sets the 'has resource' property.<p>
304     *
305     * @param hasResource the value for the 'has resource' property
306     */
307    public void setHasResource(boolean hasResource) {
308
309        m_hasResource = hasResource;
310    }
311
312    /**
313     * Sets the main language to copy in case the element language node does not exist yet.<p>
314     *
315     * @param mainLanguage the main language to copy in case the element language node does not exist yet
316     */
317    public void setMainLanguage(String mainLanguage) {
318
319        m_mainLanguage = mainLanguage;
320    }
321
322    /**
323     * Sets the new link.<p>
324     *
325     * @param newLink the new link to set
326     */
327    public void setNewLink(String newLink) {
328
329        m_newLink = newLink;
330    }
331
332    /**
333     * Sets the new title.<p>
334     *
335     * @param newTitle the new title to set
336     */
337    public void setNewTitle(String newTitle) {
338
339        m_newTitle = newTitle;
340    }
341
342    /**
343     * Sets the no edit reason.<p>
344     *
345     * @param noEditReason the no edit reason to set
346     */
347    public void setNoEditReason(String noEditReason) {
348
349        m_noEditReason = noEditReason;
350    }
351
352    /**
353     * @see org.opencms.gwt.client.I_CmsEditableData#setSitePath(java.lang.String)
354     */
355    public void setSitePath(String sitePath) {
356
357        m_sitePath = sitePath;
358
359    }
360
361    /**
362     * Sets the structure id.<p>
363     *
364     * @param structureId the structure id to set
365     */
366    public void setStructureId(CmsUUID structureId) {
367
368        m_structureId = structureId;
369    }
370
371    /**
372     * Sets the unreleased or expired flag.<p>
373     *
374     * @param unreleaseOrExpired the unreleased or expired flag
375     */
376    public void setUnreleaseOrExpired(boolean unreleaseOrExpired) {
377
378        m_unreleaseOrExpired = unreleaseOrExpired;
379    }
380}