Class TypeEntry

java.lang.Object
com.jalios.jcms.TypeEntry

public class TypeEntry extends Object
This class contains info about a Type.
Since:
jcms-3.0
Author:
Olivier Dedieu, Olivier Jaquemet
  • Field Details

    • xmlElt

      protected final org.jdom.Element xmlElt
    • className

      protected final String className
    • isAbstract

      protected final boolean isAbstract
    • plugin

      protected final Plugin plugin
    • labelMap

      protected Map<String,String> labelMap
    • descriptionMap

      protected Map<String,String> descriptionMap
    • titleLabelMap

      protected Map<String,String> titleLabelMap
    • titleDescriptionMap

      protected Map<String,String> titleDescriptionMap
    • tabMap

      protected Map<String,Map<String,String>> tabMap
    • templateMap

      protected Map<String,TypeTemplateEntry> templateMap
    • usageMap

      protected Map<String,Set<TypeTemplateEntry>> usageMap
    • isTitleML

      protected boolean isTitleML
    • isTitleSearchable

      protected boolean isTitleSearchable
    • isCategoryTab

      protected boolean isCategoryTab
    • isTemplateTab

      protected boolean isTemplateTab
    • isReadRightTab

      protected boolean isReadRightTab
    • isUpdateRightTab

      protected boolean isUpdateRightTab
    • isWorkflowTab

      protected boolean isWorkflowTab
    • isAdvancedTab

      protected boolean isAdvancedTab
    • isDebatable

      protected boolean isDebatable
    • isUnitFieldEdition

      protected boolean isUnitFieldEdition
    • isAudienced

      protected boolean isAudienced
    • categories

      protected String[] categories
    • groups

      protected String[] groups
    • containsHiddenFieldsComputed

      protected boolean containsHiddenFieldsComputed
    • containsHiddenFields

      protected boolean containsHiddenFields
    • typeDir

      protected String typeDir
    • isDatabase

      protected boolean isDatabase
    • isHbm

      protected boolean isHbm
    • isRevision

      protected boolean isRevision
  • Constructor Details

    • TypeEntry

      public TypeEntry(String className, Map<String,String> labelMap, Map<String,String> descriptionMap, Map<String,String> titleLabelMap, Map<String,String> titleDescriptionMap, boolean isTitleML, boolean isTitleSearchable, boolean isCategoryTab, boolean isTemplateTab, boolean isReadRightTab, boolean isUpdateRightTab, boolean isWorkflowTab, boolean isAdvancedTab, boolean isDebatable, boolean isAbstract, String[] categories, String[] groups)
      Constructor WITHOUT XML Element, to be used for JCMS core types.
      Parameters:
      className - the class name
      labelMap - the multilingual label map
      descriptionMap - the multilingual description map
      titleLabelMap - the multilingual title's label map
      titleDescriptionMap - the multilingual title's description map
      isTitleML - is the title multilingual ?
      isTitleSearchable - is the title searchable ?
      isCategoryTab - is the category tab shown ?
      isTemplateTab - is the template tab shown ?
      isReadRightTab - is the read rights tab shown ?
      isUpdateRightTab - is the update rights tab shown ?
      isWorkflowTab - is the workflow tab shown ?
      isAdvancedTab - is the advanced tab shown ?
      isDebatable - deprecated
      isAbstract - is this field used as abstract for this type ?
      categories - the default categories
      groups - the default groups for read rights
    • TypeEntry

      public TypeEntry(org.jdom.Element typeElt, String typeDir)
      Constructor XML Element, to be used for every JCMS types having an XML file.
      Parameters:
      typeElt - the JDOM XML Element corresponding to the "type" element
      typeDir - the path of directory in which the type JSP will be located, relative to webapp root, eg "types/Article/",
  • Method Details

    • getTypeClass

      public Class<?> getTypeClass()
      Retrieve the Class of the specified type
      Since:
      jcms-10.0.4 / JCMS-7831
    • supportsCategories

      public static boolean supportsCategories(Class<?> clazz)
      Checks if Categories are supported for the specified class
      Parameters:
      clazz - a publication class
      Returns:
      true if category are supported, false otherwise
      Since:
      jcms-10.0.4 / JCMS-7831
    • supportsTemplateTab

      public static boolean supportsTemplateTab(Class<?> clazz)
      Checks if template tab is supported for the specified class
      Parameters:
      clazz - a publication class
      Returns:
      true if template tab is supported, false otherwise
      Since:
      jcms-10.0.4 / JCMS-7831
    • supportsReadRights

      public static boolean supportsReadRights(Class<?> clazz)
      Checks if read rights are supported for the specified class
      Parameters:
      clazz - a publication class
      Returns:
      true if read rights are supported, false otherwise
      Since:
      jcms-10.0.4 / JCMS-7831
    • supportsUpdateRights

      public static boolean supportsUpdateRights(Class<?> clazz)
      Checks if update rights are supported for the specified class
      Parameters:
      clazz - a publication class
      Returns:
      true if update rights are supported, false otherwise
      Since:
      jcms-10.0.4 / JCMS-7831
    • reloadI18N

      public void reloadI18N()
      Reload all I18N informations for this type. This includes : label, description, title label, title description, tabs and templates.
      Since:
      jcms-8.0.2
    • addTemplate

      public void addTemplate(org.jdom.Element itElm, String typeDir)
      Add template to the TypeEntry from a List of XML Elements. Should only be used internally.
      Parameters:
      itElm - a JDom Elements
      typeDir - path to the template
      Since:
      jcms-6.0.0
    • addTemplateList

      public void addTemplateList(List<org.jdom.Element> templateList, String typeDir)
      Add templates to the TypeEntry from a List of XML Elements. Should only be used internally.
      Parameters:
      templateList - list of JDom Elements
      typeDir - path to the template
      Since:
      jcms-6.0.0
    • addTemplateEntry

      public void addTemplateEntry(TypeTemplateEntry tte)
      Add template to the TypeEntry from a TypeTemplateEntry. Should only be used internally.
      Parameters:
      tte - the TypeTemplateEntry
      Since:
      jcms-6.0.0
    • removeTemplateEntry

      public void removeTemplateEntry(TypeTemplateEntry tte)
      Remove the given TypeTemplateEntry
      Parameters:
      tte - the TypeTemplateEntry
      Since:
      jcms-10.0.0
    • getTemplateEntry

      public TypeTemplateEntry getTemplateEntry(String fullname)
      Returns a TypeTemplateEntry matching the given template name
      Parameters:
      fullname - the template name
      Returns:
      TypeTemplateEntry that describe template
      Since:
      jcms-6.0.0
    • getTemplateEntrySet

      public Set<TypeTemplateEntry> getTemplateEntrySet(String usage)
      Returns a new Set of TypeTemplateEntry matching the given usage
      Parameters:
      usage - the template usage
      Returns:
      Set of TypeTemplateEntry
      Since:
      jcms-6.0.0
    • getTemplateEntrySet

      public Set<TypeTemplateEntry> getTemplateEntrySet()
      Returns all template entries
      Returns:
      Set of TypeTemplateEntry
    • getDefaultTemplateEntry

      public TypeTemplateEntry getDefaultTemplateEntry(String usage)
      Returns a default TypeTemplateEntry matching the given usage for the current workspace
      Parameters:
      usage - the template usage
      Returns:
      Set of TypeTemplateEntry
      Since:
      jcms-6.0.0
    • getDefaultTemplateEntrySet

      public Set<TypeTemplateEntry> getDefaultTemplateEntrySet()
      Returns all default template entries
      Returns:
      Set of TypeTemplateEntry
      Since:
      jcms-6.0.0
    • getDefaultTemplateNameSet

      public Set<String> getDefaultTemplateNameSet()
      Returns all default template names
      Returns:
      Set of template names
      Since:
      jcms-6.0.0
    • getFirstTemplateEntry

      public TypeTemplateEntry getFirstTemplateEntry(String usage, String[] names)
      Returns the first TypeTemplateEntry from given names matching given usage If names is empty then return default entry
      Parameters:
      usage - the template usage
      names - an array of templates name
      Returns:
      TypeTemplateEntry matching
    • getTemplateUsageMap

      public Map<String,Set<TypeTemplateEntry>> getTemplateUsageMap()
      Returns internal cached Map of usage/Set of TypeTemplateEntry. Do not modify this Map
      Returns:
      Map of TypeTemplateEntry
    • getTemplateUsageSet

      public Set<String> getTemplateUsageSet()
      Returns a Set of all usage used by this type entry
      Returns:
      Set of usages
    • getEditTemplatePath

      public String getEditTemplatePath()
      Retrieve the path of the editMyType.jsp providing full edition of this type.
      Returns:
      a path such as types/Article/editArticle.jsp
      Since:
      11.0.0 / JCMS-11634
    • getEditModalSimpleTemplatePath

      public String getEditModalSimpleTemplatePath()
      Retrieve the path of the editMyTypeModal.jsp providing simple edition in modal for this type.
      Returns:
      a path such as types/Article/editArticleModalFull.jsp
      Since:
      11.0.0 / JCMS-11634
    • getEditModalFullTemplatePath

      public String getEditModalFullTemplatePath()
      Retrieve the path of the editMyTypeModalFull.jsp providing full edition in modal for this type.
      Returns:
      a path such as types/Article/editArticleModalFull.jsp
      Since:
      11.0.0 / JCMS-11634
    • getEditFormHandlerPath

      public String getEditFormHandlerPath()
      Retrieve the path of the doMyTypeFormHandler.jsp providing instanciation of the Java Bean (subclass of JcmsFormHandler) use to edit this type.
      Returns:
      a path such as types/Article/doArticleFormHandler.jsp
      Since:
      11.0.0 / JCMS-11634
    • getDoEditTemplatePath

      public String getDoEditTemplatePath()
      Retrieve the path of the doEditMyType.jsp providing fields edition for this type.
      Returns:
      a path such as types/Article/doEditArticle.jsp
      Since:
      11.0.0 / JCMS-11634
    • getDoEditModalTemplatePath

      public String getDoEditModalTemplatePath()
      Retrieve the path of the doEditMyTypeModal.jsp providing simple modal fields edition for this type.
      Returns:
      a path such as types/Article/doEditArticleModal.jsp
      Since:
      11.0.0 / JCMS-11634
    • containsHiddenFields

      public boolean containsHiddenFields()
      Returns true if this type contains at least one hidden field.
      Returns:
      true if this type contains at least one hidden field.
      Since:
      jcms-5.7.1
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getXmlElement

      public org.jdom.Element getXmlElement()
      XML Parsing: jdom Element for this type.
      Access, but do not modify.
      Returns:
      the Element of this type.
    • isAbstract

      public boolean isAbstract()
      Return true if this type is an abstract java Class.
      Returns:
      true if this type is an abstract java Class.
    • getLabel

      public String getLabel(String lang)
      Returns the label of this type in the given language.
      Parameters:
      lang - the language
      Returns:
      the label of this type in the given language.
      Since:
      jcms-5.7.0
    • getLabelMap

      public Map<String,String> getLabelMap()
      Returns the label map of this type ({lang, value}).
      Returns:
      the label map of this type ({lang, value}).
      Since:
      jcms-5.7.0
    • getDescription

      public String getDescription(String lang)
      Returns the description of this type in the given language.
      Parameters:
      lang - the language
      Returns:
      the description of this type in the given language.
      Since:
      jcms-5.7.0
    • getDescriptionMap

      public Map<String,String> getDescriptionMap()
      Returns the description map of this type ({lang, value}).
      Returns:
      the description map of this type ({lang, value}).
      Since:
      jcms-5.7.0
    • getTitleLabel

      public String getTitleLabel(String lang)
      Returns the title label of this type in the given language.
      Parameters:
      lang - the language
      Returns:
      the title label of this type in the given language.
      Since:
      jcms-5.7.0
    • getTitleLabelMap

      public Map<String,String> getTitleLabelMap()
      Returns the title label map of this type ({lang, value}).
      Returns:
      the title label map of this type ({lang, value}).
      Since:
      jcms-5.7.0
    • getTitleDescription

      public String getTitleDescription(String lang)
      Returns the title description of this type in the given language.
      Parameters:
      lang - the language
      Returns:
      the title description of this type in the given language.
      Since:
      jcms-5.7.0
    • getTitleDescriptionMap

      public Map<String,String> getTitleDescriptionMap()
      Returns the title description map of this type ({lang, value}).
      Returns:
      the title description map of this type ({lang, value}).
      Since:
      jcms-5.7.0
    • getTabMap

      public Map<String,Map<String,String>> getTabMap()
      Returns the tab map {tabId, map{lang, label}}
      Returns:
      the tab map {tabId, map{lang, label}}
      Since:
      jcms-5.7.0
    • getTabLabel

      public String getTabLabel(String tabId, String lang)
      Returns the localized label for the given tab identifier.
      Parameters:
      tabId - the tab identifier
      lang - the language
      Returns:
      the localized label for the given tab identifier.
      Since:
      jcms-5.7.0
    • isTitleML

      public boolean isTitleML()
      Return true if the title of this type is multilingual.
      Returns:
      true if the title of this type is multilingual.
    • isTitleSearchable

      public boolean isTitleSearchable()
      Return true if the title of this type is searchable.
      Returns:
      true if the title of this type is searchable.
    • isDebatable

      public boolean isDebatable()
      Return true if a forum can be created on intances of this type.
      Returns:
      true if instances of this type are debatable.
    • isUnitFieldEdition

      public boolean isUnitFieldEdition()
      Returns true if this type can be edited field by field on the front office.
      Returns:
      true if this type can be edited field by field on the front office.
    • isAudienced

      public boolean isAudienced()
      Returns true if this type is audienced using Audience Rights (if audience rights are enabled).
      Returns:
      true if this type is audienced using Audience Rights (if audience rights are enabled).
    • isCategoryTab

      public boolean isCategoryTab()
      Do we display category tab in the edit form of instance of this type?.
      Returns:
      true if category tab is displayed, false otherwise.
    • isTemplateTab

      public boolean isTemplateTab()
      Do we display template tab in the edit form of instance of this type?.
      Returns:
      true if template tab is displayed, false otherwise.
    • isReadRightTab

      public boolean isReadRightTab()
      Do we display Read Right tab in the edit form of instance of this type?.
      Returns:
      true if Read Right tab is displayed, false otherwise.
    • isUpdateRightTab

      public boolean isUpdateRightTab()
      Do we display Update Right tab in the edit form of instance of this type?.
      Returns:
      true if Update Right tab is displayed, false otherwise.
    • isWorkflowTab

      public boolean isWorkflowTab()
      Do we display Workflow tab in the edit form of instance of this type?.
      Returns:
      true if Workflow tab is displayed, false otherwise.
    • isAdvancedTab

      public boolean isAdvancedTab()
      Do we display Advanced tab in the edit form of instance of this type?.
      Returns:
      true if Advanced tab is displayed, false otherwise.
    • getCategories

      public String[] getCategories()
      Return default categories for this type
      Returns:
      String[] default categories
    • getGroups

      public String[] getGroups()
      Return default groups rights for this type
      Returns:
      String[] default groups
    • getClassName

      public String getClassName()
      Returns the name of the type
      Returns:
      String the name of the type
    • getFilesPathSet

      public Set<String> getFilesPathSet()
      Returns all files normally used by the current type. Current implementation returns following files:
      • JSP in types/Type/*.jsp
      • XML in WEB-INF/data/types/Type/Type.xml
      • XML in WEB-INF/data/types/Type/Type-template.xml
      • JAVA in WEB-INF/classes/generated/*Type*.java and .class
      • Generated HBM
      • Generated Revision
      It do not retrieve custom template files outside of these scopes. It do not check if file exists on disk
      Returns:
      Set a set of relative file path. FIXME: [Template] Should add new template declaration ?
    • getDirectoriesPathSet

      public Set<String> getDirectoriesPathSet()
      Returns roots folder for the given type Current implementation returns following files:
      • WEB-INF/data/types/Type/
      • types/Type/
      It do not return sub folders
      Returns:
      Set of path
    • getDefaultTypeTemplateEntryUsageMap

      public static Map<String,Set<TypeTemplateEntry>> getDefaultTypeTemplateEntryUsageMap(String className, String folderPath)
    • getDefaultTypeTemplateEntryMap

      public static Map<String,TypeTemplateEntry> getDefaultTypeTemplateEntryMap(String className, String folderPath)
    • setLabelMap

      public void setLabelMap(Map<String,String> labelMap)
    • setDescription

      public void setDescription(Map<String,String> descriptionMap)
    • setTitleLabelMap

      public void setTitleLabelMap(Map<String,String> titleLabelMap)
    • setTitleDescriptionMap

      public void setTitleDescriptionMap(Map<String,String> titleDescriptionMap)
    • setTabMap

      public void setTabMap(Map<String,Map<String,String>> tabMap)
    • setDebatable

      public void setDebatable(boolean isDebatable)
      Param true if a forum can be created on instances of this type.
      Parameters:
      isDebatable - true if instances of this type are debatable.
    • setCategoryTab

      public void setCategoryTab(boolean isCategoryTab)
      Do we display category tab in the edit form of instance of this type?.
      Parameters:
      isCategoryTab - true if category tab is displayed, false otherwise.
    • setTemplateTab

      public void setTemplateTab(boolean isTemplateTab)
      Do we display template tab in the edit form of instance of this type?.
      Parameters:
      isTemplateTab - true if template tab is displayed, false otherwise.
    • setReadRightTab

      public void setReadRightTab(boolean isReadRightTab)
      Do we display Read Right tab in the edit form of instance of this type?.
      Parameters:
      isReadRightTab - true if Read Right tab is displayed, false otherwise.
    • setUpdateRightTab

      public void setUpdateRightTab(boolean isUpdateRightTab)
      Do we display Update Right tab in the edit form of instance of this type?.
      Parameters:
      isUpdateRightTab - true if Update Right tab is displayed, false otherwise.
    • setWorkflowTab

      public void setWorkflowTab(boolean isWorkflowTab)
      Do we display Workflow tab in the edit form of instance of this type?.
      Parameters:
      isWorkflowTab - true if Workflow tab is displayed, false otherwise.
    • setAdvancedTab

      public void setAdvancedTab(boolean isAdvancedTab)
      Do we display Advanced tab in the edit form of instance of this type?.
      Parameters:
      isAdvancedTab - true if Advanced tab is displayed, false otherwise.
    • setCategories

      public void setCategories(String[] categories)
      Set default categories
      Parameters:
      categories - String[] of default category ids
    • setGroups

      public void setGroups(String[] groups)
      Set default groups right
      Parameters:
      groups - String[] of default group ids
    • getPlugin

      public Plugin getPlugin()
      Returns the plugin providing this type.
      Returns:
      the plugin providing this type.
      Since:
      jcms-10.0.0
    • isActive

      public boolean isActive()