Returns the group container bean for the given locale.<p>

@param cms the cms context

@return the group container bean
346768
public CmsGroupContainerBean getGroupContainer(CmsObject cms) {

        if (m_groupContainers.containsKey(CmsLocaleManager.MASTER_LOCALE)) {
            return m_groupContainers.get(CmsLocaleManager.MASTER_LOCALE);
        } else if (!m_groupContainers.isEmpty()) {
            return m_groupContainers.get(m_groupContainers.keySet().iterator().next());
        } else {
            return null;
        }
    }
1006678
protected String getLocaleSpecificTitle(Locale locale) {

        String result = null;

        try {

            if (isDetailRequest()) {
                // this is a request to a detail page
                CmsResource res = getDetailContent();
                CmsFile file = m_cms.readFile(res);
                CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
                result = content.getHandler().getTitleMapping(m_cms, content, m_cms.getRequestContext().getLocale());
                if (result == null) {
                    // title not found, maybe no mapping OR not available in the current locale
                    // read the title of the detail resource as fall back (may contain mapping from another locale)
                    result = m_cms.readPropertyObject(
                        res,
                        CmsPropertyDefinition.PROPERTY_TITLE,
                        false,
                        locale).getValue();
                }
            }
            if (result == null) {
                // read the title of the requested resource as fall back
                result = m_cms.readPropertyObject(
                    m_cms.getRequestContext().getUri(),
                    CmsPropertyDefinition.PROPERTY_TITLE,
                    true,
                    locale).getValue();
            }
        } catch (CmsException e) {
            LOG.debug(e.getLocalizedMessage(), e);
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) {
            result = "";
        }

        return result;
    }
1367219
public Element getLocaleNode(Locale locale) throws CmsRuntimeException {

        String localeStr = locale.toString();
        Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(m_document.getRootElement());
        while (i.hasNext()) {
            Element element = i.next();
            if (localeStr.equals(element.attributeValue(CmsXmlContentDefinition.XSD_ATTRIBUTE_VALUE_LANGUAGE))) {
                // language element found, return it
                return element;
            }
        }
        // language element was not found
        throw new CmsRuntimeException(Messages.get().container(Messages.ERR_XMLCONTENT_MISSING_LOCALE_1, locale));
    }
1174537
private LinkedHashMap<String, String> getAvailableLocales(CmsResource resource) {

        LinkedHashMap<String, String> result = null;
        List<Locale> locales = null;
        try {
            if (CmsResourceTypeXmlPage.isXmlPage(resource)) {
                locales = CmsXmlPageFactory.unmarshal(getCmsObject(), resource, getRequest()).getLocales();
            } else if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                locales = CmsXmlContentFactory.unmarshal(getCmsObject(), resource, getRequest()).getLocales();
            } else if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
                locales = CmsXmlContainerPageFactory.unmarshal(getCmsObject(), resource).getLocales();
            }
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        if (locales != null) {
            Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject());
            result = new LinkedHashMap<String, String>();
            for (Locale locale : locales) {
                result.put(locale.toString(), locale.getDisplayName(wpLocale));
            }
        }
        return result;
    }
580437
public static List<CmsContainerElementBean> loadInheritContainerElements(CmsObject cms, CmsResource resource) {

        CmsInheritanceReferenceParser parser = new CmsInheritanceReferenceParser(cms);
        try {
            parser.parse(resource);
            CmsInheritanceReference ref = parser.getReference(cms.getRequestContext().getLocale());
            if (ref != null) {
                String name = ref.getName();
                CmsADEManager adeManager = OpenCms.getADEManager();
                CmsInheritedContainerState result = adeManager.getInheritedContainerState(
                    cms,
                    cms.getRequestContext().getRootUri(),
                    name);
                return result.getElements(false);
            }
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        return Collections.emptyList();
    }
1039461
public I_CmsDataView createViewInstance(CmsObject cms, Locale locale) {

        try {
            Class<?> cls = Class.forName(m_viewClass);
            Object viewObj = cls.newInstance();
            I_CmsDataView dataView = (I_CmsDataView)viewObj;
            dataView.initialize(cms, m_viewArg, locale);
            return dataView;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }
    }
1140973
private Locale getWorkplaceLocale(CmsObject cms) {

        if (m_workplaceLocale == null) {
            m_workplaceLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
        }
        return m_workplaceLocale;
    }
85815
private String getPreviewContent(CmsObject cms, CmsResource resource, Locale locale) {

        return getPreviewContent(getRequest(), getResponse(), cms, resource, locale);
    }
862670
public static ListConfigurationBean parseListConfiguration(CmsObject cms, CmsResource res) {

        ListConfigurationBean result = new ListConfigurationBean();
        try {
            CmsFile configFile = cms.readFile(res);
            CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, configFile);
            Locale locale = CmsLocaleManager.MASTER_LOCALE;

            if (!content.hasLocale(locale)) {
                locale = content.getLocales().get(0);
            }
            for (String field : PARAMETER_FIELDS) {
                String val = content.getStringValue(cms, field, locale);
                if (N_CATEGORY.equals(field)) {
                    if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) {
                        result.setCategories(Arrays.asList(val.split(",")));
                    } else {
                        result.setCategories(Collections.<String> emptyList());
                    }
                } else {
                    result.setParameterValue(field, val);
                }
            }

            I_CmsXmlContentValue restrictValue = content.getValue(N_DATE_RESTRICTION, locale);
            if (restrictValue != null) {
                CmsDateRestrictionParser parser = new CmsDateRestrictionParser(cms);
                I_CmsListDateRestriction restriction = parser.parse(new CmsXmlContentValueLocation(restrictValue));
                if (restriction == null) {
                    LOG.warn(
                        "Improper date restriction configuration in content "
                            + content.getFile().getRootPath()
                            + ", online="
                            + cms.getRequestContext().getCurrentProject().isOnlineProject());
                }
                result.setDateRestriction(restriction);
            }

            I_CmsXmlContentValue categoryModeVal = content.getValue(N_CATEGORY_MODE, locale);
            CategoryMode categoryMode = CategoryMode.OR;
            if (categoryModeVal != null) {
                try {
                    categoryMode = CategoryMode.valueOf(categoryModeVal.getStringValue(cms));
                } catch (Exception e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            result.setCategoryMode(categoryMode);

            LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
            for (I_CmsXmlContentValue parameter : content.getValues(N_PARAMETER, locale)) {
                I_CmsXmlContentValue keyVal = content.getValue(parameter.getPath() + "/" + N_KEY, locale);
                I_CmsXmlContentValue valueVal = content.getValue(parameter.getPath() + "/" + N_VALUE, locale);
                if ((keyVal != null)
                    && CmsStringUtil.isNotEmptyOrWhitespaceOnly(keyVal.getStringValue(cms))
                    && (valueVal != null)) {
                    parameters.put(keyVal.getStringValue(cms), valueVal.getStringValue(cms));
                }
            }
            result.setAdditionalParameters(parameters);
            List<String> displayTypes = new ArrayList<String>();
            List<I_CmsXmlContentValue> typeValues = content.getValues(N_DISPLAY_TYPE, locale);
            if (!typeValues.isEmpty()) {
                for (I_CmsXmlContentValue value : typeValues) {
                    displayTypes.add(value.getStringValue(cms));
                }
            }
            result.setDisplayTypes(displayTypes);
            List<String> folders = new ArrayList<String>();
            List<I_CmsXmlContentValue> folderValues = content.getValues(N_SEARCH_FOLDER, locale);
            if (!folderValues.isEmpty()) {
                for (I_CmsXmlContentValue value : folderValues) {
                    CmsLink val = ((CmsXmlVfsFileValue)value).getLink(cms);
                    if (val != null) {
                        // we are using root paths
                        folders.add(cms.getRequestContext().addSiteRoot(val.getSitePath(cms)));
                    }
                }
            }
            result.setFolders(folders);
            List<CmsUUID> blackList = new ArrayList<CmsUUID>();
            List<I_CmsXmlContentValue> blacklistValues = content.getValues(N_BLACKLIST, locale);
            if (!blacklistValues.isEmpty()) {
                for (I_CmsXmlContentValue value : blacklistValues) {
                    CmsLink link = ((CmsXmlVfsFileValue)value).getLink(cms);
                    if (link != null) {
                        blackList.add(link.getStructureId());
                    }
                }
            }
            result.setBlacklist(blackList);
        } catch (CmsException e) {
            e.printStackTrace();
        }
        return result;
    }
1165849
private Locale getLocale() throws CmsException {

        getDocument();
        List<Locale> locales = m_document.getLocales();
        if (locales.contains(Locale.ENGLISH) || locales.isEmpty()) {
            return Locale.ENGLISH;
        }
        return locales.get(0);
    }
1332540
protected CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException {

        CmsJlanRepository repository = ((CmsJlanDeviceContext)connection.getContext()).getRepository();
        CmsObjectWrapper result = repository.getCms(session, connection);
        return result;
    }
31098
public CmsJspDateSeriesBean getParentSeries() {

        if ((m_parentSeries == null) && getIsExtractedDate()) {
            CmsObject cms = m_value.getCmsObject();
            try {
                CmsResource res = cms.readResource(m_seriesDefinition.getParentSeriesId());
                CmsJspContentAccessBean content = new CmsJspContentAccessBean(cms, m_value.getLocale(), res);
                CmsJspContentAccessValueWrapper value = content.getValue().get(m_value.getPath());
                return new CmsJspDateSeriesBean(value, m_locale);
            } catch (NullPointerException | CmsException e) {
                LOG.warn("Parent series with id " + m_seriesDefinition.getParentSeriesId() + " could not be read.", e);
            }

        }
        return null;
    }
174575
private CmsObject getCmsObject() {

        CmsObject cms;
        try {
            cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
            //m_cms.getRequestContext().setSiteRoot("");
        } catch (CmsException e) {
            cms = A_CmsUI.getCmsObject();
        }
        return cms;
    }
926219
private CmsResource getMessageBundle() {

        OpenCms.getLocaleManager();
        String localString = CmsLocaleManager.getDefaultLocale().toString();
        List<String> moduleResource = m_module.getResources();
        for (String resourcePath : moduleResource) {
            if (resourcePath.contains(PATH_I18N) && resourcePath.endsWith(localString)) {
                try {
                    return m_cms.readResource(resourcePath);
                } catch (CmsException e) {
                    LOG.error("Can not read message bundle", e);
                }
            }
        }
        String moduleFolder = getModuleFolder(m_module.getName());
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(moduleFolder)) {
            return null;
        }
        String bundlePath = CmsStringUtil.joinPaths(
            moduleFolder,
            PATH_I18N,
            m_module.getName() + SUFFIX_BUNDLE_FILE + "_" + localString);
        if (m_cms.existsResource(bundlePath)) {
            try {
                return m_cms.readResource(bundlePath);
            } catch (CmsException e) {
                LOG.error("No bundle found for module", e);
            }
        }
        return null;
    }
810184
public String getLabel(CmsObject cms, String key) {

        CmsMessages messages = Messages.get().getBundle(getLocale(cms));
        return messages.key(key);
    }
86787
public static CmsResource createModelGroup(CmsObject cms, CmsADEConfigData configData) throws CmsException {

        CmsResourceTypeConfig typeConfig = configData.getResourceType(
            CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
        return typeConfig.createNewElement(cms, configData.getBasePath());
    }
1296336
private Map<String, String> getContentsByContainerName(
        CmsContainerElementBean element,
        Collection<CmsContainer> containers) {

        CmsFormatterConfiguration configs = getFormatterConfiguration(element.getResource());
        Map<String, String> result = new HashMap<String, String>();
        for (CmsContainer container : containers) {
            String content = getContentByContainer(element, container, configs);
            if (content != null) {
                content = removeScriptTags(content);
            }
            result.put(container.getName(), content);
        }
        return result;
    }