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.galleries.shared;
029
030import org.opencms.gwt.shared.CmsIconBean;
031import org.opencms.util.CmsUUID;
032
033import java.util.Date;
034import java.util.LinkedHashMap;
035import java.util.Map;
036
037/**
038 * This bean contains the preview content for the selected item.<p>
039 *
040 * @since 8.0.0
041 */
042public class CmsResourceInfoBean extends CmsIconBean {
043
044    /** The description of the resource. */
045    private String m_description;
046
047    /** The last modification date. */
048    private Date m_lastModified;
049
050    /** The nice names for the properties. */
051    private Map<String, String> m_niceNames;
052
053    /** The no edit reason. If empty editing is allowed. */
054    private String m_noEditReason;
055
056    /** The HTML content generated by the preview formatter. */
057    private String m_previewContent;
058
059    /** The main properties. */
060    private Map<String, String> m_properties;
061
062    /** The path to the selected resource. */
063    private String m_resourcePath;
064
065    /** The resource type name. */
066    private String m_resourceType;
067
068    /** The file size. */
069    private String m_size;
070
071    /** The structure id of the resource. */
072    private CmsUUID m_structureId;
073
074    /** The title of the resource. */
075    private String m_title;
076
077    /**
078     * The constructor.<p>
079     */
080    public CmsResourceInfoBean() {
081
082        m_properties = new LinkedHashMap<String, String>();
083    }
084
085    /**
086     * Returns the description of the resource.<p>
087     *
088     * @return the description
089     */
090    public String getDescription() {
091
092        return m_description;
093    }
094
095    /**
096     * Returns the last modification date.<p>
097     *
098     * @return the last modification date
099     */
100    public Date getLastModified() {
101
102        return m_lastModified;
103    }
104
105    /**
106     * Returns the no edit reason. If empty editing is allowed.<p>
107     *
108     * @return the no edit reason
109     */
110    public String getNoEditReason() {
111
112        return m_noEditReason;
113    }
114
115    /**
116     * Returns the preview content.<p>
117     *
118     * @return the preview content
119     */
120    public String getPreviewContent() {
121
122        return m_previewContent;
123    }
124
125    /**
126     * Returns the properties.<p>
127     *
128     * @return the properties
129     */
130    public Map<String, String> getProperties() {
131
132        return m_properties;
133    }
134
135    /**
136     * Gets the label to display for the given property.
137     *
138     * @param propName the property name
139     * @return the label to display
140     */
141    public String getPropertyLabel(String propName) {
142
143        String result = null;
144        if (m_niceNames != null) {
145            result = m_niceNames.get(propName);
146        }
147        if (result == null) {
148            result = propName;
149        }
150        return result;
151    }
152
153    /**
154     * Returns the resource path.<p>
155     *
156     * @return the resource path
157     */
158    public String getResourcePath() {
159
160        return m_resourcePath;
161    }
162
163    /**
164     * Returns the resource type name.<p>
165     *
166     * @return the resource type name
167     */
168    public String getResourceType() {
169
170        return m_resourceType;
171    }
172
173    /**
174     * Returns the file size.<p>
175     *
176     * @return the file size
177     */
178    public String getSize() {
179
180        return m_size;
181    }
182
183    /**
184     * Gets the structure id of the resource.<p>
185     * @return the structure id of the resource
186     */
187    public CmsUUID getStructureId() {
188
189        return m_structureId;
190    }
191
192    /**
193     * Returns the title of the resource.<p>
194     *
195     * @return the title
196     */
197    public String getTitle() {
198
199        return m_title;
200    }
201
202    /**
203     * Sets the description of the resource.<p>
204     *
205     * @param description the description to set
206     */
207    public void setDescription(String description) {
208
209        m_description = description;
210    }
211
212    /**
213     * Sets the last modification date.<p>
214     *
215     * @param lastModified the last modification date to set
216     */
217    public void setLastModified(Date lastModified) {
218
219        m_lastModified = lastModified;
220    }
221
222    /**
223     * Sets the no edit reason.<p>
224     *
225     * @param noEditReason the no edit reason to set
226     */
227    public void setNoEditReason(String noEditReason) {
228
229        m_noEditReason = noEditReason;
230    }
231
232    /**
233     * Sets the preview content.<p>
234     *
235     * @param previewContent the preview content to set
236     */
237    public void setPreviewContent(String previewContent) {
238
239        m_previewContent = previewContent;
240    }
241
242    /**
243     * Sets the propeties.<p>
244     *
245     * @param propeties the propeties to set
246     */
247    public void setProperties(Map<String, String> propeties) {
248
249        m_properties = propeties;
250    }
251
252    /**
253     * Sets the nice names for the properties.
254     *
255     * @param niceNames the nice names (keys are property names, values the corresponding nice names)
256     */
257    public void setPropertyNiceNames(Map<String, String> niceNames) {
258
259        m_niceNames = niceNames;
260    }
261
262    /**
263     * Sets the resource path.<p>
264     *
265     * @param resourcePath the resource path to set
266     */
267    public void setResourcePath(String resourcePath) {
268
269        m_resourcePath = resourcePath;
270    }
271
272    /**
273     * Sets the resource type name.<p>
274     *
275     * @param resourceType the resource type name to set
276     */
277    public void setResourceType(String resourceType) {
278
279        m_resourceType = resourceType;
280    }
281
282    /**
283     * Sets the file size.<p>
284     *
285     * @param size the file size to set
286     */
287    public void setSize(String size) {
288
289        m_size = size;
290    }
291
292    /**
293     * Sets the resource structure id.<p>
294     *
295     * @param structureId the resource structure id
296     */
297    public void setStructureId(CmsUUID structureId) {
298
299        m_structureId = structureId;
300    }
301
302    /**
303     * Sets the title of the resource.<p>
304     *
305     * @param title the title to set
306     */
307    public void setTitle(String title) {
308
309        m_title = title;
310    }
311
312}