Class CmsModelGroupHelper

java.lang.Object
org.opencms.ade.containerpage.CmsModelGroupHelper

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

  • Field Details

  • Constructor Details

    • 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 Details

    • createModelGroup

      public static CmsResource createModelGroup(CmsObject cms, CmsADEConfigData configData) throws CmsException
      Creates a new model group resource.

      Parameters:
      cms - the current cms context
      configData - the configuration data
      Returns:
      the new resource
      Throws:
      CmsException - in case creating the resource fails
    • 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, 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, String basePath, String baseContainerName) throws 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:
      IOException - in case writing to the response fails
    • prepareforModelGroupContent

      public CmsContainerPageBean prepareforModelGroupContent(Map<String,CmsContainerElementBean> elements, List<String> foundGroups, CmsContainerPageBean page, boolean alwaysCopy, Locale locale, 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
    • readModelGroups

      Reads the present model groups and merges their containers into the page.

      Parameters:
      page - the container page
      Returns:
      the resulting container page
    • removeModelGroupContainers

      Removes the model group containers.

      Parameters:
      page - the container page state
      Returns:
      the container page without the model group containers
    • saveModelGroups

      Saves the model groups of the given container page.

      Parameters:
      page - the container page
      pageResource - the model group resource
      Returns:
      the container page referencing the saved model groups
      Throws:
      CmsException - in case writing the page properties fails