Class CmsResourceTypeConfig

    • Field Detail

      • m_cms

        protected CmsObject m_cms
        The CMS object used for VFS operations.
    • Constructor Detail

      • CmsResourceTypeConfig

        public CmsResourceTypeConfig​(java.lang.String typeName,
                                     boolean disabled,
                                     CmsContentFolderDescriptor folder,
                                     java.lang.String pattern)
        Creates a new resource type configuration.

        Parameters:
        typeName - the resource type name
        disabled - true if this is a disabled configuration
        folder - the folder reference
        pattern - the name pattern
      • CmsResourceTypeConfig

        public CmsResourceTypeConfig​(java.lang.String typeName,
                                     boolean disabled,
                                     CmsContentFolderDescriptor folder,
                                     java.lang.String pattern,
                                     boolean detailPagesDisabled,
                                     boolean addDisabled,
                                     boolean createDisabled,
                                     boolean editDisabled,
                                     boolean enableInLists,
                                     boolean availabilityNotSet,
                                     CmsUUID elementView,
                                     java.lang.String localization,
                                     java.lang.Boolean showInDefaultView,
                                     java.lang.Boolean copyInModels,
                                     java.lang.Integer order,
                                     CmsCntPageData.ElementDeleteMode elementDeleteMode)
        Creates a new resource type configuration.

        Parameters:
        typeName - the resource type name
        disabled - true if this is a disabled configuration
        folder - the folder reference
        pattern - the name pattern
        detailPagesDisabled - true if detail page creation should be disabled for this type
        addDisabled - true if adding elements of this type via ADE should be disabled
        editDisabled - true if editing container elements of the type should be disabled
        enableInLists - true if the type should be enabled, but only for the direct edit buttons in lists and not ADE/drag/drop.
        createDisabled - true if creating elements of this type via ADE should be disabled
        availabilityNotSet - true if the availability has not been set
        elementView - the element view id
        localization - the base name of the bundle to add as workplace bundle for the resource type
        showInDefaultView - if true, the element type should be shown in the default element view even if it doesn't belong to it
        copyInModels - if elements of this type when used in models should be copied instead of reused
        order - the display order
        elementDeleteMode - the element delete mode
    • Method Detail

      • checkCreatable

        public boolean checkCreatable​(CmsObject cms,
                                      java.lang.String pageFolderRootPath)
                               throws CmsException
        Checks if this resource type is creatable.

        Parameters:
        cms - the current CMS context
        pageFolderRootPath - the root path of the folder containing the current container page
        Returns:
        true if the resource type is creatable
        Throws:
        CmsException - if something goes wrong
      • checkInitialized

        public void checkInitialized()
        Checks whether the object is initialized and throws an exception otherwise.

      • checkOffline

        public void checkOffline​(CmsObject cms)
        Checks whether the cms context is in the offline project and throws an exception otherwise.

        Parameters:
        cms - the cms context
      • checkViewable

        public boolean checkViewable​(CmsObject cms,
                                     java.lang.String referenceUri)
        Checks if a resource type is viewable for the current user. If not, this resource type should not be available at all within the ADE 'add-wizard'.

        Parameters:
        cms - the current CMS context
        referenceUri - the resource URI to check permissions for
        Returns:
        true if the resource type is viewable
      • configureCreateNewElement

        public void configureCreateNewElement​(CmsObject cms,
                                              java.lang.String pageFolderRootPath,
                                              CmsNewResourceBuilder builder)
                                       throws CmsException
        Similar to createNewElement, but just sets parameters on a resource builder instead of actually creating the resource.

        Parameters:
        cms - the CMS context
        pageFolderRootPath - the page folder root path
        builder - the resource builder
        Throws:
        CmsException - if something goes wrong
      • createNewElement

        public CmsResource createNewElement​(CmsObject userCms,
                                            CmsResource modelResource,
                                            java.lang.String pageFolderRootPath)
                                     throws CmsException
        Creates a new element.

        Parameters:
        userCms - the CMS context to use
        modelResource - the model resource to use
        pageFolderRootPath - the root path of the folder containing the current container page
        Returns:
        the created resource
        Throws:
        CmsException - if something goes wrong
      • createNewElement

        public CmsResource createNewElement​(CmsObject userCms,
                                            java.lang.String pageFolderRootPath)
                                     throws CmsException
        Creates a new element.

        Parameters:
        userCms - the CMS context to use
        pageFolderRootPath - root path of the folder containing the current container page
        Returns:
        the created resource
        Throws:
        CmsException - if something goes wrong
      • getConfiguredWorkplaceBundle

        public java.lang.String getConfiguredWorkplaceBundle()
        Returns the bundle that is configured as workplace bundle for the resource type, or null if none is configured.
        Returns:
        the bundle that is configured as workplace bundle for the resource type, or null if none is configured.
      • getElementView

        public CmsUUID getElementView()
        Returns the element view id.

        Returns:
        the element view id
      • getFolderPath

        public java.lang.String getFolderPath​(CmsObject cms,
                                              java.lang.String pageFolderRootPath)
        Computes the folder path for this resource type.

        Parameters:
        cms - the cms context to use
        pageFolderRootPath - root path of the folder containing the current container page
        Returns:
        the folder root path for this resource type
      • getNamePattern

        public java.lang.String getNamePattern​(boolean useDefaultIfEmpty)
        Gets the name pattern.

        Parameters:
        useDefaultIfEmpty - if true, uses a default value if the name pattern isn't set directly
        Returns:
        the name pattern
      • getOrder

        public int getOrder()
        Returns the number used for sorting module resource types.

        Returns:
        the number used for sorting module resource types
      • getTypeName

        public java.lang.String getTypeName()
        Returns the type name.

        Returns:
        the type name
      • initialize

        public void initialize​(CmsObject cms)
        Initializes this instance.

        Parameters:
        cms - the CMS context to use
      • isAddDisabled

        public boolean isAddDisabled()
        Returns true if adding elements of this type via ADE should be disabled.

        Returns:
        true if elements of this type shouldn't be added to the page
      • isCopyInModels

        public boolean isCopyInModels()
        Returns if elements of this type when used in models should be copied instead of reused.

        Returns:
        if elements of this type when used in models should be copied instead of reused
      • isCreateDisabled

        public boolean isCreateDisabled()
        Returns whether creating elements of this type via ADE should be disabled.

        Returns:
        true if creating elements of this type via ADE should be disabled
      • isDetailPagesDisabled

        public boolean isDetailPagesDisabled()
        True if the detail page creation should be disabled for this resource type.

        Returns:
        true if detail page creation should be disabled for this type
      • isEditDisabled

        public boolean isEditDisabled()
        Checks if editing should be disabled for container elements of this type.
        Returns:
        true if editing should be disabled for container elements of this type
      • isEnabledInLists

        public boolean isEnabledInLists()
        Checks if creating and editing resources of this type should be possible via the edit buttons generated by lists.
        Returns:
        true if creating/editing resources of this type in lists should be possible
      • isPageRelative

        public boolean isPageRelative()
        Returns true if this resource type is configured as 'page relative', i.e. elements of this type are to be stored with the container page on which they were created.

        Returns:
        true if this is a page relative type configuration
      • isShowInDefaultView

        public boolean isShowInDefaultView()
        Returns true if the type should be shown in the default view if it is not assigned to it.

        This defaults to 'false' if not set.

        Returns:
        true if the type should be shown in the default view event if it doens't belong to that element view
      • copy

        protected CmsResourceTypeConfig copy()
        Creates a shallow copy of this resource type configuration object.

        Returns:
        a copy of the resource type configuration object
      • copy

        protected CmsResourceTypeConfig copy​(boolean disabled)
        Creates a shallow copy of this resource type configuration object.

        Parameters:
        disabled - true if the copy should be disabled regardless of whether the original is disabled
        Returns:
        a copy of the resource type configuration object
      • getFolderOrName

        protected CmsContentFolderDescriptor getFolderOrName()
        Returns the folder bean from the configuration.

        Normally, you should use getFolderPath() instead.

        Returns:
        the folder bean from the configuration
      • getNamePattern

        protected java.lang.String getNamePattern()
        Gets the configured name pattern.

        Returns:
        the configured name pattern
      • rootCms

        protected CmsObject rootCms​(CmsObject cms)
                             throws CmsException
        Creates a new CMS object based on existing one and changes its site root to the site root.

        Parameters:
        cms - the CMS context
        Returns:
        the root site CMS context
        Throws:
        CmsException - if something goes wrong
      • tryToUnlock

        protected void tryToUnlock​(CmsObject cms,
                                   java.lang.String folderPath)
                            throws CmsException
        Tries to remove a lock on an ancestor of a given path owned by the current user.

        Parameters:
        cms - the CMS context
        folderPath - the path for which the lock should be removed
        Throws:
        CmsException - if something goes wrong
      • updateBasePath

        protected void updateBasePath​(java.lang.String basePath)
        Updates the base path for the folder information.

        Parameters:
        basePath - the new base path