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.xml.containerpage; 029 030import org.opencms.file.CmsObject; 031import org.opencms.file.CmsResource; 032import org.opencms.main.CmsException; 033 034import java.util.Collection; 035import java.util.Locale; 036 037import javax.servlet.ServletRequest; 038 039/** 040 * Configurable & expandable configuration.<p> 041 * 042 * @since 7.6 043 */ 044public interface I_CmsADEConfiguration { 045 046 /** 047 * Creates a new element of a given type at the configured location.<p> 048 * 049 * @param cms the current opencms context 050 * @param cntPageUri the container page uri 051 * @param request the current request 052 * @param type the type of the element to be created 053 * @param locale the content locale 054 * 055 * @return the CmsResource representing the newly created element 056 * 057 * @throws CmsException if something goes wrong 058 */ 059 CmsResource createNewElement(CmsObject cms, String cntPageUri, ServletRequest request, String type, Locale locale) 060 throws CmsException; 061 062 /** 063 * Returns the list of creatable elements.<p> 064 * 065 * @param cms the current opencms context 066 * @param cntPageUri the container page uri 067 * @param request the current request 068 * 069 * @return the list of creatable elements 070 * 071 * @throws CmsException if something goes wrong 072 */ 073 Collection<CmsResource> getCreatableElements(CmsObject cms, String cntPageUri, ServletRequest request) 074 throws CmsException; 075 076 /** 077 * Returns the maximal size of the favorite list.<p> 078 * 079 * @param cms the current opencms context 080 * 081 * @return the maximal size of the favorite list 082 * 083 * @throws CmsException if something goes wrong 084 */ 085 int getFavoriteListMaxSize(CmsObject cms) throws CmsException; 086 087 /** 088 * Returns the formatter configuration for a given resource.<p> 089 * 090 * @param cms the OpenCms user context 091 * @param containerPageRootPath the root path to the container page that includes the element resource 092 * @param res the container page element resource 093 * 094 * @return the formatter configuration for a given resource 095 * 096 * @throws CmsException if something goes wrong 097 */ 098 CmsFormatterConfiguration getFormattersForResource(CmsObject cms, String containerPageRootPath, CmsResource res) 099 throws CmsException; 100 101 /** 102 * Returns the name of the next new file of the given type to be created.<p> 103 * 104 * @param cms the current opencms context 105 * @param cntPageUri the container page uri 106 * @param request the current request 107 * @param type the resource type name 108 * 109 * @return the name of the next new file of the given type to be created 110 * 111 * @throws CmsException if something goes wrong 112 */ 113 String getNextNewFileName(CmsObject cms, String cntPageUri, ServletRequest request, String type) 114 throws CmsException; 115 116 /** 117 * Returns the maximal size of the recent list.<p> 118 * 119 * @param cms the current opencms context 120 * 121 * @return the maximal size of the recent list 122 * 123 * @throws CmsException if something goes wrong 124 */ 125 int getRecentListMaxSize(CmsObject cms) throws CmsException; 126 127 /** 128 * Returns the list of searchable resource types.<p> 129 * 130 * @param cms the current opencms context 131 * @param cntPageUri the container page uri 132 * @param request the current request 133 * 134 * @return the list of searchable resource types, identified by a sample resource 135 * 136 * @throws CmsException if something goes wrong 137 */ 138 Collection<CmsResource> getSearchableResourceTypes(CmsObject cms, String cntPageUri, ServletRequest request) 139 throws CmsException; 140 141 /** 142 * Initializes the configuration.<p> 143 * 144 * @param cms the CMS object 145 */ 146 void init(CmsObject cms); 147 148 /** 149 * Returns if the given type has a valid configuration to be created.<p> 150 * 151 * @param cms the CMS context 152 * @param currentUri the current URI 153 * @param typeName the resource type name 154 * 155 * @return <code>true</code> if the type can be created as new 156 * 157 * @throws CmsException if something goes wrong 158 */ 159 boolean isCreatableType(CmsObject cms, String currentUri, String typeName) throws CmsException; 160 161}