当前位置: 首页>>代码示例>>Java>>正文


Java PortalUtil.getSiteDefaultLocale方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.util.PortalUtil.getSiteDefaultLocale方法的典型用法代码示例。如果您正苦于以下问题:Java PortalUtil.getSiteDefaultLocale方法的具体用法?Java PortalUtil.getSiteDefaultLocale怎么用?Java PortalUtil.getSiteDefaultLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.util.PortalUtil的用法示例。


在下文中一共展示了PortalUtil.getSiteDefaultLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDDLRecordSet

import com.liferay.portal.kernel.util.PortalUtil; //导入方法依赖的package包/类
private static void addDDLRecordSet(final DdlRecordset recordSet, final long groupId)
        throws SystemException, PortalException {
    LOG.info("Adding DDLRecordSet " + recordSet.getName());
    Map<Locale, String> nameMap = new HashMap<>();
    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    nameMap.put(siteDefaultLocale, recordSet.getName());
    Map<Locale, String> descMap = new HashMap<>();
    descMap.put(siteDefaultLocale, recordSet.getDescription());
    DDLRecordSet ddlRecordSet = null;
    try {
        ddlRecordSet = DDLRecordSetLocalServiceUtil.fetchRecordSet(groupId, recordSet.getKey());
    } catch (SystemException e) {
        LOG.error("Error while trying to find DDLRecordSet with key: " + recordSet.getKey(), e);
    }

    if (ddlRecordSet != null) {
        LOG.info("DDLRecordSet already exists and will be overwritten.");
        ddlRecordSet.setNameMap(nameMap);
        ddlRecordSet.setDescriptionMap(descMap);
        ddlRecordSet.setDDMStructureId(ResolverUtil
                .getStructureId(recordSet.getDdlStructureKey(), groupId, DDLRecordSet.class, false));
        DDLRecordSetLocalServiceUtil.updateDDLRecordSet(ddlRecordSet);
        LOG.info("DDLRecordSet successfully updated: " + recordSet.getName());
        return;
    }

    DDLRecordSet newDDLRecordSet = DDLRecordSetLocalServiceUtil.addRecordSet(
            LiferaySetup.getRunAsUserId(), groupId,
            ResolverUtil.getStructureId(recordSet.getDdlStructureKey(), groupId,
                    DDLRecordSet.class, false),
            recordSet.getDdlStructureKey(), nameMap, descMap, MIN_DISPLAY_ROWS, 0,
            new ServiceContext());
    LOG.info("Added DDLRecordSet: " + newDDLRecordSet.getName());
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:35,代码来源:SetupArticles.java

示例2: getDefaultLocale

import com.liferay.portal.kernel.util.PortalUtil; //导入方法依赖的package包/类
public static Locale getDefaultLocale(final long groupId, final String locationHint) {
    Locale siteDefaultLocale = null;
    try {
        siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    } catch (PortalException | SystemException e) {
        LOG.error("Error Reading Locale while for " + locationHint);
    }
    return siteDefaultLocale;
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:10,代码来源:TitleMapUtil.java

示例3: setupVocabularies

import com.liferay.portal.kernel.util.PortalUtil; //导入方法依赖的package包/类
public static void setupVocabularies(final Site site, final long groupId)
        throws SystemException, PortalException {
    List<Vocabulary> vocabularies = site.getVocabulary();

    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);

    LOG.info("Setting up vocabularies");

    for (Vocabulary vocabulary : vocabularies) {
        setupVocabulary(vocabulary, site, groupId, siteDefaultLocale);
    }
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:13,代码来源:SetupCategorization.java

示例4: addDDMTemplate

import com.liferay.portal.kernel.util.PortalUtil; //导入方法依赖的package包/类
public static void addDDMTemplate(final Adt template, final long groupId)
        throws SystemException, PortalException, IOException, URISyntaxException {

    LOG.info("Adding ADT " + template.getName());
    long classNameId = PortalUtil.getClassNameId(template.getClassName());
    long resourceClassnameId = ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class);

    Map<Locale, String> nameMap = new HashMap<Locale, String>();

    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    String name = template.getName();
    if (name == null) {
        name = template.getTemplateKey();
    }
    nameMap.put(siteDefaultLocale, name);

    Map<Locale, String> descriptionMap = new HashMap<Locale, String>();
    descriptionMap.put(siteDefaultLocale, template.getDescription());

    DDMTemplate ddmTemplate = null;
    try {
        ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(groupId, classNameId,
                template.getTemplateKey());
    } catch (SystemException e) {
        LOG.error("Error while trying to find ADT with key: " + template.getTemplateKey());
    }

    String script = ResourcesUtil.getFileContent(template.getPath());

    if (ddmTemplate != null) {
        LOG.info("Template already exists and will be overwritten.");
        ddmTemplate.setLanguage(template.getLanguage());
        ddmTemplate.setNameMap(nameMap);
        ddmTemplate.setDescriptionMap(descriptionMap);
        ddmTemplate.setClassName(template.getClassName());
        ddmTemplate.setCacheable(template.isCacheable());
        ddmTemplate.setScript(script);

        DDMTemplateLocalServiceUtil.updateDDMTemplate(ddmTemplate);
        LOG.info("ADT successfully updated: " + ddmTemplate.getName());
        return;
    }

    DDMTemplate newTemplate = DDMTemplateLocalServiceUtil.addTemplate(
            LiferaySetup.getRunAsUserId(), groupId, classNameId, 0, resourceClassnameId, template.getTemplateKey(),
            nameMap, descriptionMap, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, template.getLanguage(), script, true, false,
            null, null, new ServiceContext());
    LOG.info("Added ADT: " + newTemplate.getName());
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:50,代码来源:SetupArticles.java


注:本文中的com.liferay.portal.kernel.util.PortalUtil.getSiteDefaultLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。