private CmsContainerBean getContainerBeanToSave(CmsContainer container, String containerpageRootPath)
    throws CmsException {

        CmsObject cms = getCmsObject();
        List<CmsContainerElementBean> elements = new ArrayList<CmsContainerElementBean>();
        for (CmsContainerElement elementData : container.getElements()) {
            if (!elementData.isNew()) {
                CmsContainerElementBean newElementBean = getContainerElementBeanToSave(
                    cms,
                    containerpageRootPath,
                    container,
                    elementData);
                if (newElementBean != null) {
                    elements.add(newElementBean);
                }
            }
        }
        CmsContainerBean result = new CmsContainerBean(
            container.getName(),
            container.getType(),
            container.getParentInstanceId(),
            container.isRootContainer(),
            elements);
        return result;
    }
private CmsContainerBean getContainerBeanToSave ( CmsContainer container , String containerpageRootPath ) throws CmsException { CmsObject cms = getCmsObject ( ) ; List < CmsContainerElementBean > elements = new ArrayList < CmsContainerElementBean > ( ) ; for ( CmsContainerElement elementData : container . getElements ( ) ) { if ( ! elementData . isNew ( ) ) { CmsContainerElementBean newElementBean = getContainerElementBeanToSave ( cms , containerpageRootPath , container , elementData ) ; if ( newElementBean != null ) { elements . add ( newElementBean ) ; } } } CmsContainerBean result = new CmsContainerBean ( container . getName ( ) , container . getType ( ) , container . getParentInstanceId ( ) , container . isRootContainer ( ) , elements ) ; return result ; }
Helper method for converting a CmsContainer to a CmsContainerBean when saving a container page.<p>

@param container the container for which the CmsContainerBean should be created
@param containerpageRootPath the container page root path

@return a container bean

@throws CmsException in case generating the container data fails