001/* 002 * Copyright 2018 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; 023import org.ametys.runtime.model.ModelItem; 024import org.ametys.runtime.model.View; 025 026/** 027 * This class represents a type of content 028 */ 029public class ContentTypeDefinition implements ContentTypeDescriptor 030{ 031 private String _id; 032 private String _pluginName; 033 private I18nizableText _label; 034 private I18nizableText _description; 035 private I18nizableText _defaultTitle; 036 private I18nizableText _category; 037 private String[] _supertypeIds; 038 private boolean _isAbstract; 039 private String _iconGlyph; 040 private String _iconDecorator; 041 private String _largeIcon; 042 private String _mediumIcon; 043 private String _right; 044 private Set<String> _tags; 045 private List<ScriptFile> _cssFiles; 046 private List<ModelItem> _modelItems; 047 private List<View> _views; 048 private String _parentRef; 049 050 /** 051 * Constructs a new representative of a content type 052 * @param id id of content type 053 */ 054 public ContentTypeDefinition(String id) 055 { 056 this._id = id; 057 } 058 059 public String getId() 060 { 061 return this._id; 062 } 063 064 public String getPluginName() 065 { 066 return this._pluginName; 067 } 068 069 public I18nizableText getLabel() 070 { 071 return this._label; 072 } 073 074 public I18nizableText getDescription() 075 { 076 return this._description; 077 } 078 079 public I18nizableText getDefaultTitle() 080 { 081 return this._defaultTitle; 082 } 083 084 public I18nizableText getCategory() 085 { 086 return this._category; 087 } 088 089 public String[] getSupertypeIds() 090 { 091 return this._supertypeIds; 092 } 093 094 /** 095 * Indicates if the content type is abstract 096 * 097 * @return True if the content type is abstract, false otherwise. 098 */ 099 public boolean isAbstract() 100 { 101 return this._isAbstract; 102 } 103 104 public String getIconGlyph() 105 { 106 return this._iconGlyph; 107 } 108 109 public String getIconDecorator() 110 { 111 return this._iconDecorator; 112 } 113 114 public String getSmallIcon() 115 { 116 return this.getSmallIcon(); 117 } 118 119 public String getMediumIcon() 120 { 121 return this._mediumIcon; 122 } 123 124 public String getLargeIcon() 125 { 126 return this._largeIcon; 127 } 128 129 public Set<String> getViewMetadataSetNames(boolean includeInternal) 130 { 131 // TODO Auto-generated method stub 132 return null; 133 } 134 135 public Set<String> getEditionMetadataSetNames(boolean includeInternal) 136 { 137 // TODO Auto-generated method stub 138 return null; 139 } 140 141 public MetadataSet getMetadataSetForView(String metadataSetName) 142 { 143 // TODO Auto-generated method stub 144 return null; 145 } 146 147 public MetadataSet getMetadataSetForEdition(String metadataSetName) 148 { 149 // TODO Auto-generated method stub 150 return null; 151 } 152 153 public List<ScriptFile> getCSSFiles() 154 { 155 return this._cssFiles; 156 } 157 158 /** 159 * Get the right of the content type 160 * 161 * @return the right of the content type 162 */ 163 public String getRight() 164 { 165 return this._right; 166 } 167 168 /** 169 * Get tags of content type 170 * 171 * @return tags of content type 172 */ 173 public Set<String> getTags() 174 { 175 return this._tags; 176 } 177 178 /** 179 * Get metadataSet of content type 180 * 181 * @return metadataset of content type 182 */ 183 public List<View> getViews() 184 { 185 return this._views; 186 } 187 188 /** 189 * Get metadata of content type 190 * 191 * @return metadata of content type 192 */ 193 public List<ModelItem> getModelItems() 194 { 195 return this._modelItems; 196 } 197 198 /** 199 * Get the parent reference of content type 200 * 201 * @return the parent reference of content type 202 */ 203 public String getParentRef() 204 { 205 return this._parentRef; 206 } 207 208 /** 209 * Set the right of content type 210 * 211 * @param right the right to set 212 */ 213 public void setRight(String right) 214 { 215 this._right = right; 216 } 217 218 /** 219 * Set tags of content type 220 * 221 * @param tags tags to set 222 */ 223 public void setTags(Set<String> tags) 224 { 225 this._tags = tags; 226 } 227 228 /** 229 * Set model items of content type 230 * 231 * @param modelItems model items to set 232 */ 233 public void setModelItems(List<ModelItem> modelItems) 234 { 235 this._modelItems = modelItems; 236 } 237 238 /** 239 * Set views of content type 240 * 241 * @param views views to set 242 */ 243 public void setViews(List<View> views) 244 { 245 this._views = views; 246 } 247 248 /** 249 * Set id of content type 250 * 251 * @param id the id to set 252 */ 253 public void setId(String id) 254 { 255 this._id = id; 256 } 257 258 /** 259 * Set the plugin name of content type 260 * 261 * @param pluginName the plugin name to set 262 */ 263 public void setPluginName(String pluginName) 264 { 265 this._pluginName = pluginName; 266 } 267 268 /** 269 * Set the label of content type 270 * 271 * @param label the label to set 272 */ 273 public void setLabel(I18nizableText label) 274 { 275 this._label = label; 276 } 277 278 /** 279 * Set the description of content type 280 * 281 * @param description the description to set 282 */ 283 public void setDescription(I18nizableText description) 284 { 285 this._description = description; 286 } 287 288 /** 289 * Set the default title of content type 290 * 291 * @param defaultTitle the default title to set 292 */ 293 public void setDefaultTitle(I18nizableText defaultTitle) 294 { 295 this._defaultTitle = defaultTitle; 296 } 297 298 /** 299 * Set the category of content type 300 * 301 * @param category the category of content type 302 */ 303 public void setCategory(I18nizableText category) 304 { 305 this._category = category; 306 } 307 308 /** 309 * Set supertypes of content type 310 * 311 * @param supertypeIds supertypes to set 312 */ 313 public void setSupertypeIds(String[] supertypeIds) 314 { 315 this._supertypeIds = supertypeIds; 316 } 317 318 /** 319 * Set icon glyph of content type 320 * 321 * @param iconGlyph icon glyph to set 322 */ 323 public void setIconGlyph(String iconGlyph) 324 { 325 this._iconGlyph = iconGlyph; 326 } 327 328 /** 329 * Set icon decorator of content type 330 * 331 * @param iconDecorator icon decorator to set 332 */ 333 public void setIconDecorator(String iconDecorator) 334 { 335 this._iconDecorator = iconDecorator; 336 } 337 338 /** 339 * Set large icon of content type 340 * 341 * @param largeIcon large icon to set 342 */ 343 public void setLargeIcon(String largeIcon) 344 { 345 this._largeIcon = largeIcon; 346 } 347 348 /** 349 * Set medium icon of content type 350 * 351 * @param mediumIcon medium icon to set 352 */ 353 public void setMediumIcon(String mediumIcon) 354 { 355 this._mediumIcon = mediumIcon; 356 } 357 358 /** 359 * Set CSS files of content type 360 * 361 * @param cSSFiles css files to set 362 */ 363 public void setCSSFiles(List<ScriptFile> cSSFiles) 364 { 365 this._cssFiles = cSSFiles; 366 } 367 368 /** 369 * Set if content type is abstract 370 * 371 * @param isAbstract the boolean to set 372 * 373 */ 374 public void setIsAbstract(boolean isAbstract) 375 { 376 this._isAbstract = isAbstract; 377 } 378 379 /** 380 * Set the parent reference of content type 381 * 382 * @param parentRef the parent reference to set 383 */ 384 public void setParentRef(String parentRef) 385 { 386 this._parentRef = parentRef; 387 } 388 389}