Class CmsModelGroupHelper


  • public class CmsModelGroupHelper
    extends java.lang.Object
    Handles all model group specific tasks.

    • Constructor Detail

      • CmsModelGroupHelper

        public CmsModelGroupHelper​(CmsObject cms,
                                   CmsADEConfigData configData,
                                   CmsADESessionCache sessionCache,
                                   boolean isEditingModelGroups)
        Constructor.

        Parameters:
        cms - the current cms context
        configData - the configuration data
        sessionCache - the session cache
        isEditingModelGroups - the edit model groups flag
    • Method Detail

      • isModelGroupResource

        public static boolean isModelGroupResource​(CmsResource resource)
        Returns if the given resource is a model group resource.

        Parameters:
        resource - the resource
        Returns:
        true if the given resource is a model group resource
      • updateModelGroupResource

        public static boolean updateModelGroupResource​(CmsObject cms,
                                                       CmsResource group,
                                                       java.lang.String baseContainerName)
        Updates a model group resource to the changed data structure.

        This step is necessary when updating from version 10.0.x to 10.5.x.

        Parameters:
        cms - the cms context
        group - the model group resource
        baseContainerName - the new base container name
        Returns:
        true if the resource was updated
      • updateModelGroupResources

        public static void updateModelGroupResources​(javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response,
                                                     java.lang.String basePath,
                                                     java.lang.String baseContainerName)
                                              throws java.io.IOException
        Updates model group resources to the changed data structure.

        This step is necessary when updating from version 10.0.x to 10.5.x.

        Parameters:
        request - the request
        response - the response
        basePath - the path to the model group, or the base path to search for model groups
        baseContainerName - the new base container name
        Throws:
        java.io.IOException - in case writing to the response fails
      • prepareforModelGroupContent

        public CmsContainerPageBean prepareforModelGroupContent​(java.util.Map<java.lang.String,​CmsContainerElementBean> elements,
                                                                java.util.List<java.lang.String> foundGroups,
                                                                CmsContainerPageBean page,
                                                                boolean alwaysCopy,
                                                                java.util.Locale locale,
                                                                java.lang.String createContextPath)
                                                         throws CmsException
        Adds the model group elements to the page.

        Parameters:
        elements - the requested elements
        foundGroups - list to add the found group element client ids to
        page - the page
        alwaysCopy - true to create element copies in case of non model groups and createNew is set
        locale - the content locale
        createContextPath - the context path to pass to CmsResourceTypeConfig#createNewElement
        Returns:
        the adjusted page
        Throws:
        CmsException - in case something goes wrong