本文整理汇总了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());
}
示例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;
}
示例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);
}
}
示例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());
}