001/* 002 * Copyright 2013 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.cms.contenttype; 017 018import java.util.List; 019import java.util.Set; 020 021import org.ametys.core.ui.ClientSideElement.ScriptFile; 022import org.ametys.runtime.i18n.I18nizableText; 023 024/** 025 * This class represents a descriptor for content type 026 */ 027public interface ContentTypeDescriptor 028{ 029 /** 030 * Retrieves the id of the content type. 031 * @return the id. 032 */ 033 String getId(); 034 035 /** 036 * Retrieves the name of the plugin declaring this content type. 037 * @return the name of the plugin. 038 */ 039 String getPluginName(); 040 041 /** 042 * Retrieves the label of the content type. 043 * @return the label. 044 */ 045 I18nizableText getLabel(); 046 047 /** 048 * Retrieves the description of the content type. 049 * @return the description. 050 */ 051 I18nizableText getDescription(); 052 053 /** 054 * Retrieves the default title of the content type. 055 * @return the default title. 056 */ 057 I18nizableText getDefaultTitle(); 058 059 /** 060 * Retrieves the category of the content type. 061 * @return the category. 062 */ 063 I18nizableText getCategory(); 064 065 /** 066 * Retrieves the super type's ids. 067 * @return the super type's ids, or empty if this content type doesn't extend a specific content type. 068 */ 069 String[] getSupertypeIds(); 070 071 /** 072 * Retrieves the CSS class to use for glyph icon 073 * @return the glyph name. 074 */ 075 String getIconGlyph(); 076 077 /** 078 * Retrieves the CSS class to use for decorator above the main icon 079 * @return the glyph name. 080 */ 081 String getIconDecorator(); 082 083 /** 084 * Retrieves the URL of the icon without the context path. 085 * @return the icon URL for the small image 16x16. 086 */ 087 String getSmallIcon(); 088 089 /** 090 * Retrieves the URL of the icon without the context path. 091 * @return the icon URL for the medium sized image 32x32. 092 */ 093 String getMediumIcon(); 094 095 /** 096 * Retrieves the URL of the icon without the context path. 097 * @return the icon URL for the large image 48x48. 098 */ 099 String getLargeIcon(); 100 101 /** 102 * Returns all names of "view" metadataSets. 103 * @param includeInternal if the result should include internal metadataSets. 104 * @return all names of "view" metadataSets. 105 * @deprecated Use {@link ContentType#getViewNames()} instead 106 */ 107 @Deprecated 108 Set<String> getViewMetadataSetNames(boolean includeInternal); 109 110 /** 111 * Returns all names of "edition" metadataSets. 112 * @param includeInternal if the result should include internal metadataSets. 113 * @return all names of "edition" metadataSets. 114 * @deprecated Use {@link ContentType#getViewNames()} instead 115 */ 116 @Deprecated 117 Set<String> getEditionMetadataSetNames(boolean includeInternal); 118 119 /** 120 * Retrieves the metadata set name for view. 121 * @param metadataSetName the metadata set name. 122 * @return the metadata definition. 123 * @deprecated Use {@link ContentType#getView(String)} instead 124 */ 125 @Deprecated 126 MetadataSet getMetadataSetForView(String metadataSetName); 127 128 /** 129 * Retrieves the metadata set name for edition. 130 * @param metadataSetName the metadata set name. 131 * @return the metadata set. 132 * @deprecated Use {@link ContentType#getView(String)} instead 133 */ 134 @Deprecated 135 MetadataSet getMetadataSetForEdition(String metadataSetName); 136 137 /** 138 * Returns the list of CSS files needed to correctly display the content's in BO, such as the content's icon 139 * @return The list of CSS files needed. Must not be null. 140 */ 141 List<ScriptFile> getCSSFiles(); 142 143 /** 144 * Returns the default i18n catalog for this content type. 145 * @return the default i18n catalog for this content type. 146 */ 147 public default String getDefaultCatalog() 148 { 149 return "plugin." + getPluginName(); 150 } 151 152 /** 153 * Returns the path for icons 154 * @param pluginName the configured plugin 155 * @return the path for icons 156 */ 157 public default String getIconPath(String pluginName) 158 { 159 return "/plugins/" + pluginName + "/resources/"; 160 } 161}