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.file.types; 029 030import org.opencms.configuration.CmsParameterConfiguration; 031import org.opencms.util.CmsStringUtil; 032 033/** 034 * Resource type descriptor for extended folder types (like for example the workplace galleries).<p> 035 * 036 * This type extends a folder but has a configurable type id and type name. 037 * Optionally, a workplace class name for the type and a parameter String can be provided.<p> 038 * 039 * @since 7.6.0 040 */ 041public class CmsRecourceTypeFolderGallery extends CmsResourceTypeFolderExtended { 042 043 /** Configuration key for the optional folder class name. */ 044 public static final String CONFIGURATION_FOLDER_CONTENT_TYPES = "folder.content.types"; 045 046 /** The serial version id. */ 047 private static final long serialVersionUID = 2506038491426404878L; 048 049 /** The resource-types of the folder content. */ 050 private String m_folderContentTypes; 051 052 /** 053 * @see org.opencms.file.types.A_CmsResourceType#addConfigurationParameter(java.lang.String, java.lang.String) 054 */ 055 @Override 056 public void addConfigurationParameter(String paramName, String paramValue) { 057 058 super.addConfigurationParameter(paramName, paramValue); 059 if (CmsStringUtil.isNotEmpty(paramName) && CmsStringUtil.isNotEmpty(paramValue)) { 060 if (CONFIGURATION_FOLDER_CONTENT_TYPES.equalsIgnoreCase(paramName)) { 061 m_folderContentTypes = paramValue.trim(); 062 } 063 064 } 065 } 066 067 /** 068 * @see org.opencms.file.types.A_CmsResourceType#getConfiguration() 069 */ 070 @Override 071 public CmsParameterConfiguration getConfiguration() { 072 073 CmsParameterConfiguration result = new CmsParameterConfiguration(); 074 if (CmsStringUtil.isNotEmpty(getFolderContentTypes())) { 075 result.add(CONFIGURATION_FOLDER_CONTENT_TYPES, getFolderContentTypes()); 076 } 077 CmsParameterConfiguration additional = super.getConfiguration(); 078 if ((additional != null) && (additional.size() > 0)) { 079 result.putAll(additional); 080 } 081 return result; 082 } 083 084 /** 085 * Returns the folder content types.<p> 086 * 087 * @return the folder content types 088 */ 089 public String getFolderContentTypes() { 090 091 return m_folderContentTypes; 092 } 093 094}