KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > file > types > CmsResourceTypeFolderExtended


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/file/types/CmsResourceTypeFolderExtended.java,v $
3  * Date : $Date: 2006/03/27 14:52:48 $
4  * Version: $Revision: 1.10 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.file.types;
33
34 import org.opencms.util.CmsStringUtil;
35
36 import java.util.Map JavaDoc;
37 import java.util.TreeMap JavaDoc;
38
39 /**
40  * Resource type descriptor for extended folder types (like for example the workplace galleries).<p>
41  *
42  * This type extends a folder but has a configurable type id and type name.
43  * Optionally, a workplace class name for the type and a parameter String can be provided.<p>
44  *
45  * @author Alexander Kandzior
46  * @author Andreas Zahner
47  *
48  * @version $Revision: 1.10 $
49  *
50  * @since 6.0.0
51  */

52 public class CmsResourceTypeFolderExtended extends A_CmsResourceTypeFolderBase {
53
54     /** Configuration key for the optional folder class name. */
55     public static final String JavaDoc CONFIGURATION_FOLDER_CLASS = "folder.class";
56
57     /** Configuration key for the optional folder class parameters. */
58     public static final String JavaDoc CONFIGURATION_FOLDER_CLASS_PARAMS = "folder.class.params";
59
60     /** The configured folder class name for this folder type. */
61     private String JavaDoc m_folderClassName;
62
63     /** The configured folder parameters for this folder type. */
64     private String JavaDoc m_folderClassParams;
65
66     /**
67      * @see org.opencms.file.types.A_CmsResourceType#addConfigurationParameter(java.lang.String, java.lang.String)
68      */

69     public void addConfigurationParameter(String JavaDoc paramName, String JavaDoc paramValue) {
70
71         super.addConfigurationParameter(paramName, paramValue);
72         if (CmsStringUtil.isNotEmpty(paramName) && CmsStringUtil.isNotEmpty(paramValue)) {
73             if (CONFIGURATION_FOLDER_CLASS.equalsIgnoreCase(paramName)) {
74                 m_folderClassName = paramValue.trim();
75             }
76             if (CONFIGURATION_FOLDER_CLASS_PARAMS.equalsIgnoreCase(paramName)) {
77                 m_folderClassParams = paramValue.trim();
78             }
79         }
80     }
81
82     /**
83      * @see org.opencms.file.types.A_CmsResourceType#getConfiguration()
84      */

85     public Map JavaDoc getConfiguration() {
86
87         Map JavaDoc result = new TreeMap JavaDoc();
88         if (CmsStringUtil.isNotEmpty(getFolderClassName())) {
89             result.put(CONFIGURATION_FOLDER_CLASS, getFolderClassName());
90         }
91         if (CmsStringUtil.isNotEmpty(getFolderClassParams())) {
92             result.put(CONFIGURATION_FOLDER_CLASS_PARAMS, getFolderClassParams());
93         }
94         Map JavaDoc additional = super.getConfiguration();
95         if ((additional != null) && (additional.size() > 0)) {
96             result.putAll(additional);
97         }
98         return result;
99     }
100
101     /**
102      * Returns the (optional) configured folder class name for this folder.<p>
103      *
104      * @return the (optional) configured folder class name for this folder
105      */

106     public String JavaDoc getFolderClassName() {
107
108         return m_folderClassName;
109     }
110
111     /**
112      * Returns the (optional) configured folder class parameters name for this folder.<p>
113      *
114      * @return the (optional) configured folder class parameters for this folder
115      */

116     public String JavaDoc getFolderClassParams() {
117
118         return m_folderClassParams;
119     }
120 }
Popular Tags