Builds the container page bean.<p>

@return the container page bean
551666
public CmsContainerPageBean build() {

        List<CmsContainerBean> containers = Lists.newArrayList();
        for (String containerName : m_containerInfos.keySet()) {
            CmsContainerBean containerBean = buildContainerBean(m_containerInfos.get(containerName));
            containers.add(containerBean);
        }
        return new CmsContainerPageBean(containers);
    }
1099982
public CmsContainerElementData getElementData(
        CmsResource page,
        CmsContainerElementBean element,
        Collection<CmsContainer> containers)
    throws CmsException {

        Locale requestLocale = m_cms.getRequestContext().getLocale();
        m_cms.getRequestContext().setLocale(m_locale);
        element.initResource(m_cms);
        if (element.getResource().isFolder()) {
            return null;
        }
        CmsContainerElementData elementData = getBaseElementData(page, element);
        CmsFormatterConfiguration formatterConfiguraton = getFormatterConfiguration(element.getResource());
        Map<String, String> contents = new HashMap<String, String>();
        if (element.isGroupContainer(m_cms)) {
            Map<String, CmsContainer> containersByName = new HashMap<String, CmsContainer>();
            for (CmsContainer container : containers) {
                containersByName.put(container.getName(), container);
            }
            CmsXmlGroupContainer xmlGroupContainer = CmsXmlGroupContainerFactory.unmarshal(
                m_cms,
                element.getResource(),
                m_req);
            CmsGroupContainerBean groupContainer = xmlGroupContainer.getGroupContainer(m_cms);
            // make sure to use the content title and not the property title
            elementData.setTitle(groupContainer.getTitle());
            elementData.setTypes(groupContainer.getTypes());
            elementData.setDescription(groupContainer.getDescription());
            if (groupContainer.getTypes().isEmpty()) {
                if (groupContainer.getElements().isEmpty()) {
                    String emptySub = "<div>NEW AND EMPTY</div>";
                    for (CmsContainer cont : containersByName.values()) {
                        if (formatterConfiguraton.hasFormatter(cont.getType(), cont.getWidth())) {
                            contents.put(cont.getName(), emptySub);
                        }
                    }
                } else {
                    // TODO: throw appropriate exception
                    return null;
                }
            } else {

                // add formatter and content entries for the supported types
                for (CmsContainer cnt : containersByName.values()) {

                    String type = cnt.getType();
                    if (checkGroupAllowed(type, groupContainer)) {
                        contents.put(cnt.getName(), "<div>should not be used</div>");
                    }
                }
            }
            // add subitems
            List<String> subItems = new ArrayList<String>();

            for (CmsContainerElementBean subElement : groupContainer.getElements()) {
                // collect ids
                subItems.add(subElement.editorHash());
            }
            elementData.setSubItems(subItems);
        } else if (element.isInheritedContainer(m_cms)) {
            CmsInheritanceReferenceParser parser = new CmsInheritanceReferenceParser(m_cms);
            parser.parse(element.getResource());
            CmsInheritanceReference ref = parser.getReference(m_locale);
            String name = null;
            // check for new inheritance reference
            if (ref != null) {
                name = ref.getName();
                elementData.setDescription(ref.getDescription());
                elementData.setTitle(ref.getTitle());
            }
            for (CmsContainer container : containers) {
                if (formatterConfiguraton.hasFormatter(container.getType(), container.getWidth())) {
                    contents.put(container.getName(), "<div>should not be used</div>");
                }
            }

            List<CmsInheritanceInfo> inheritanceInfos = new ArrayList<CmsInheritanceInfo>();
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(name)) {
                CmsInheritedContainerState result = OpenCms.getADEManager().getInheritedContainerState(
                    m_cms,
                    m_cms.addSiteRoot(m_currentPageUri),
                    name);
                for (CmsContainerElementBean subElement : result.getElements(true)) {
                    CmsInheritanceInfo inheritanceInfo = subElement.getInheritanceInfo();
                    inheritanceInfo.setClientId(subElement.editorHash());
                    inheritanceInfos.add(inheritanceInfo);
                }
            } else {
                // setting a new id for name, will be persisted once the inheritance reference is edited and saved.
                // use the structure id so it will always be the same for the resource
                name = element.getResource().getStructureId().toString();
            }
            elementData.setInheritanceInfos(inheritanceInfos);
            elementData.setInheritanceName(name);
        } else {

            for (CmsContainer cnt : containers) {
                boolean missesFormatterSetting = !elementData.getSettings().containsKey(
                    CmsFormatterConfig.getSettingsKeyForContainer(cnt.getName()));
                if (missesFormatterSetting) {
                    if (element.getFormatterId() == null) {
                        I_CmsFormatterBean formatter = getStartFormatter(
                            m_cms,
                            cnt,
                            m_adeConfig,
                            element,
                            CmsADESessionCache.getCache(m_req, m_cms));
                        if (formatter != null) {
                            elementData.getSettings().put(
                                CmsFormatterConfig.getSettingsKeyForContainer(cnt.getName()),
                                formatter.getId());
                            element.addFormatterSetting(cnt.getName(), formatter.getId());
                        }
                    } else {
                        Map<String, I_CmsFormatterBean> formatterSelection = formatterConfiguraton.getFormatterSelection(
                            cnt.getType(),
                            cnt.getWidth());
                        for (Entry<String, I_CmsFormatterBean> formatterEntry : formatterSelection.entrySet()) {
                            I_CmsFormatterBean formatter = formatterEntry.getValue();
                            String id = formatterEntry.getKey();
                            if (element.getFormatterId().equals(formatter.getJspStructureId())) {
                                elementData.getSettings().put(
                                    CmsFormatterConfig.getSettingsKeyForContainer(cnt.getName()),
                                    id);
                                break;
                            }
                        }
                    }
                }
            }
            // get the formatter configuration
            Map<String, String> contentsByName = getContentsByContainerName(element, containers);
            contents = contentsByName;
        }
        elementData.setContents(contents);
        m_cms.getRequestContext().setLocale(requestLocale);
        return elementData;
    }
1001463
public CmsContainerPageBean getContainerPage(CmsObject cms) {

        Locale masterLocale = CmsLocaleManager.MASTER_LOCALE;
        Locale localeToLoad = null;
        // always use master locale if possible, otherwise use the first locale.
        // this is important for 'legacy' container pages which were created before container pages became locale independent
        if (m_cntPages.containsKey(masterLocale)) {
            localeToLoad = masterLocale;
        } else if (!m_cntPages.isEmpty()) {
            localeToLoad = m_cntPages.keySet().iterator().next();
        }
        if (localeToLoad == null) {
            return null;
        } else {
            CmsContainerPageBean result = m_cntPages.get(localeToLoad);
            return result;
        }
    }
718200
@Override
	public PageSection build() {
		final PageSectionStyle style = new PageSectionStyle(this.marginsBuilder.build(),
				this.minHeight);
		final PageSectionContent header = new SimpleFooterHeader(
				this.curRegionBox.get());
		return new PageSection(header, style);
	}
344862
private CmsSearchIndexSource createDummyIndexSource() {

        CmsSearchIndexSource result = new CmsSearchIndexSource();
        result.setName("default");
        result.setIndexerClassName("org.opencms.search.CmsVfsIndexer");
        result.addDocumentType("html");
        result.addDocumentType("generic");
        result.addDocumentType("pdf");
        // add search index source to config:
        m_searchManager.addSearchIndexSource(result);
        return result;
    }
184330
public Node build() {
        ContainerNode ret = null;

        if (nodeType == NodeType.Component) {
            ret = new Component();
            ((Component) ret).setComponentType(componentType);
        } else if (nodeType == NodeType.Consumer) {
            ret = new Consumer();
            ((Consumer) ret).setEndpointType(endpointType);
        } else if (nodeType == NodeType.Producer) {
            ret = new Producer();
            ((Producer) ret).setEndpointType(endpointType);
        }
        ret.setCorrelationIds(correlationIds);
        ret.setOperation(operation);
        ret.setProperties(properties);
        ret.setUri(uri);
        ret.setDuration(duration);
        ret.setTimestamp(timestamp);

        for (int i = 0; i < nodes.size(); i++) {
            ret.getNodes().add(nodes.get(i).build());
        }

        // Check if template has been supplied for URI
        NodeUtil.rewriteURI(ret);

        return ret;
    }
105416
public Map<CmsUUID, Boolean> getContainsElement() {

        if (m_containsElement == null) {
            m_containsElement = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {

                public Object transform(Object input) {

                    return Boolean.valueOf(containsElement((CmsUUID)input));
                }
            });
        }
        return m_containsElement;
    }
399895
public CmsContainerPageBean getPage(Object page, Object locale) {

        CmsResource pageResource = null;
        CmsContainerPageBean result = null;
        if (m_cms != null) {
            try {
                pageResource = CmsJspElFunctions.convertRawResource(m_cms, page);
                Locale l = CmsJspElFunctions.convertLocale(locale);
                result = getPage(pageResource);
                if (result != null) {
                    CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(
                        m_cms,
                        pageResource.getRootPath());
                    for (CmsContainerBean container : result.getContainers().values()) {
                        for (CmsContainerElementBean element : container.getElements()) {
                            boolean isGroupContainer = element.isGroupContainer(m_cms);
                            boolean isInheritedContainer = element.isInheritedContainer(m_cms);
                            I_CmsFormatterBean formatterConfig = null;
                            if (!isGroupContainer && !isInheritedContainer) {
                                element.initResource(m_cms);
                                // ensure that the formatter configuration id is added to the element settings, so it will be persisted on save
                                formatterConfig = CmsJspTagContainer.getFormatterConfigurationForElement(
                                    m_cms,
                                    element,
                                    adeConfig,
                                    container.getName(),
                                    "",
                                    0);
                                if (formatterConfig != null) {
                                    element.initSettings(m_cms, formatterConfig, l, m_request, null);
                                }
                            }
                        }
                    }
                }
            } catch (Exception e) {
                LOG.warn(e.getLocalizedMessage(), e);
            }

        }
        return result;
    }
1288840
public Map<String, CmsContainerBean> getParentContainers() {

        if (m_parentContainers == null) {
            initPageData();
        }
        return Collections.unmodifiableMap(m_parentContainers);
    }
1179228
public CmsJspResourceWrapper getPageResource() {

        try {
            if (m_pageResource == null) {
                // get the container page itself, checking the history first
                m_pageResource = CmsJspResourceWrapper.wrap(
                    m_cms,
                    (CmsResource)CmsHistoryResourceHandler.getHistoryResource(m_request));
                if (m_pageResource == null) {
                    m_pageResource = CmsJspResourceWrapper.wrap(
                        m_cms,
                        m_cms.readResource(m_cms.getRequestContext().getUri()));
                }
            }
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        return m_pageResource;
    }
872591
public Document buildPage(ContentElement content) {
    Document doc = documentBuilder.newDocument();
    Element jcrRoot = createJcrRoot(doc, NT_PAGE);
    Element jcrContent = createJcrContent(doc, jcrRoot, NT_PAGE_CONTENT);

    exportPayload(doc, jcrContent, content);

    return doc;
  }
1060777
@SuppressWarnings("unchecked")
    public <P> P createBean(final Class<P> clazz) {
        return (P) beanFactory.create(clazz);
    }
316760
public Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> getContainerTargets() {

        Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> result = new HashMap<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer>();
        for (Entry<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> entry : m_targetContainers.entrySet()) {
            if (entry.getValue().isEditable()
                && (!isDetailPage() || (entry.getValue().isDetailOnly() || entry.getValue().isDetailView()))) {
                result.put(entry.getKey(), entry.getValue());
            }
        }
        return result;
    }
277177
public CmsContainerElementBean getCurrentElement(ServletRequest req) throws CmsException {

        CmsJspStandardContextBean sCBean = CmsJspStandardContextBean.getInstance(req);
        CmsContainerElementBean element = sCBean.getElement();
        if (element == null) {
            throw new CmsException(
                Messages.get().container(
                    Messages.ERR_READING_ELEMENT_FROM_REQUEST_1,
                    sCBean.getRequestContext().getUri()));
        }
        return element;
    }
1126261
public CmsSite toCmsSite() {

        m_siteRoot = m_siteRoot.endsWith("/") ? m_siteRoot.substring(0, m_siteRoot.length() - 1) : m_siteRoot;
        CmsSiteMatcher matcher = CmsStringUtil.isNotEmpty(m_secureUrl) ? new CmsSiteMatcher(m_secureUrl) : null;
        CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(m_siteRoot);
        CmsUUID uuid = new CmsUUID();
        if ((site != null) && (site.getSiteMatcher() != null)) {
            uuid = (CmsUUID)site.getSiteRootUUID().clone();
        }
        String errorPage = CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_errorPage) ? m_errorPage : null;
        List<CmsSiteMatcher> aliases = new ArrayList<CmsSiteMatcher>();
        for (String alias : m_aliases) {
            CmsSiteMatcher aliasMatcher = new CmsSiteMatcher(alias);
            aliasMatcher.setRedirect(m_redirectAliases.contains(alias));
            aliases.add(aliasMatcher);
        }
        CmsSite result = new CmsSite(
            m_siteRoot,
            uuid,
            m_title,
            new CmsSiteMatcher(m_server),
            String.valueOf(m_position),
            errorPage,
            matcher,
            m_exclusiveUrl,
            m_exclusiveError,
            m_webserver,
            aliases);
        result.setParameters(m_parameters);
        try {
            result.setSSLMode(CmsSSLMode.valueOf(m_mode));
        } catch (Exception e) {
            result.setSSLMode(CmsSSLMode.NO);
            LOG.error(e.getLocalizedMessage(), e);
        }
        return result;

    }
278595
private CmsJspStandardContextBean getStandardContext(CmsObject cms, HttpServletRequest req) throws CmsException {

        CmsJspStandardContextBean standardContext = CmsJspStandardContextBean.getInstance(req);
        standardContext.initPage();
        return standardContext;
    }
1118751
public Map<String, CmsClientTemplateBean> getTemplates() throws CmsException {

        Map<String, CmsClientTemplateBean> result = new HashMap<String, CmsClientTemplateBean>();
        CmsObject cms = getCmsObject();

        // find current site templates
        int templateId = OpenCms.getResourceManager().getResourceType(
            CmsResourceTypeJsp.getContainerPageTemplateTypeName()).getTypeId();
        List<CmsResource> templates = cms.readResources(
            "/",
            CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(templateId),
            true);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(cms.getRequestContext().getSiteRoot())) {
            // if not in the root site, also add template under /system/
            templates.addAll(
                cms.readResources(
                    CmsWorkplace.VFS_PATH_SYSTEM,
                    CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(templateId),
                    true));
        }
        // convert resources to template beans
        for (CmsResource template : templates) {
            CmsClientTemplateBean templateBean = getTemplateBean(cms, template);
            result.put(templateBean.getSitePath(), templateBean);
        }
        return result;
    }