Package org.opencms.ade.containerpage
Class CmsModelGroupHelper
- java.lang.Object
-
- org.opencms.ade.containerpage.CmsModelGroupHelper
-
public class CmsModelGroupHelper extends java.lang.Object
Handles all model group specific tasks.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMODEL_GROUP_BASE_CONTAINERThe name of the container storing the groups base element.
-
Constructor Summary
Constructors Constructor Description CmsModelGroupHelper(CmsObject cms, CmsADEConfigData configData, CmsADESessionCache sessionCache, boolean isEditingModelGroups)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsResourcecreateModelGroup(CmsObject cms, CmsADEConfigData configData)Creates a new model group resource.static booleanisModelGroupResource(CmsResource resource)Returns if the given resource is a model group resource.CmsContainerPageBeanprepareforModelGroupContent(java.util.Map<java.lang.String,CmsContainerElementBean> elements, java.util.List<java.lang.String> foundGroups, CmsContainerPageBean page, boolean alwaysCopy, java.util.Locale locale)Adds the model group elements to the page.CmsContainerPageBeanreadModelGroups(CmsContainerPageBean page)Reads the present model groups and merges their containers into the page.CmsContainerPageBeanremoveModelGroupContainers(CmsContainerPageBean page)Removes the model group containers.CmsContainerPageBeansaveModelGroups(CmsContainerPageBean page, CmsResource pageResource)Saves the model groups of the given container page.static booleanupdateModelGroupResource(CmsObject cms, CmsResource group, java.lang.String baseContainerName)Updates a model group resource to the changed data structure.static voidupdateModelGroupResources(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String basePath, java.lang.String baseContainerName)Updates model group resources to the changed data structure.
-
-
-
Field Detail
-
MODEL_GROUP_BASE_CONTAINER
public static final java.lang.String MODEL_GROUP_BASE_CONTAINER
The name of the container storing the groups base element.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsModelGroupHelper
public CmsModelGroupHelper(CmsObject cms, CmsADEConfigData configData, CmsADESessionCache sessionCache, boolean isEditingModelGroups)
Constructor.- Parameters:
cms- the current cms contextconfigData- the configuration datasessionCache- the session cacheisEditingModelGroups- the edit model groups flag
-
-
Method Detail
-
createModelGroup
public static CmsResource createModelGroup(CmsObject cms, CmsADEConfigData configData) throws CmsException
Creates a new model group resource.- Parameters:
cms- the current cms contextconfigData- 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:
trueif 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 contextgroup- the model group resourcebaseContainerName- the new base container name- Returns:
trueif 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 requestresponse- the responsebasePath- the path to the model group, or the base path to search for model groupsbaseContainerName- 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) throws CmsException
Adds the model group elements to the page.- Parameters:
elements- the requested elementsfoundGroups- list to add the found group element client ids topage- the pagealwaysCopy-trueto create element copies in case of non model groups and createNew is setlocale- the content locale- Returns:
- the adjusted page
- Throws:
CmsException- in case something goes wrong
-
readModelGroups
public CmsContainerPageBean readModelGroups(CmsContainerPageBean page)
Reads the present model groups and merges their containers into the page.- Parameters:
page- the container page- Returns:
- the resulting container page
-
removeModelGroupContainers
public CmsContainerPageBean removeModelGroupContainers(CmsContainerPageBean page)
Removes the model group containers.- Parameters:
page- the container page state- Returns:
- the container page without the model group containers
-
saveModelGroups
public CmsContainerPageBean saveModelGroups(CmsContainerPageBean page, CmsResource pageResource) throws CmsException
Saves the model groups of the given container page.- Parameters:
page- the container pagepageResource- the model group resource- Returns:
- the container page referencing the saved model groups
- Throws:
CmsException- in case writing the page properties fails
-
-