本文整理汇总了Java中com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java DDMTemplateLocalServiceUtil类的具体用法?Java DDMTemplateLocalServiceUtil怎么用?Java DDMTemplateLocalServiceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DDMTemplateLocalServiceUtil类属于com.liferay.portlet.dynamicdatamapping.service包,在下文中一共展示了DDMTemplateLocalServiceUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDDMTemplates
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void addDDMTemplates(
String ddmStructureKey, String fileName, InputStream inputStream)
throws Exception {
String ddmTemplateKey = getJournalId(fileName);
String name = FileUtil.stripExtension(fileName);
Map<Locale, String> nameMap = getMap(name);
String language = getDDMTemplateLanguage(fileName);
String xsl = StringUtil.read(inputStream);
xsl = replaceFileEntryURL(xsl);
setServiceContext(fileName);
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(JournalArticle.class),
ddmStructureKey);
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate(
userId, groupId, PortalUtil.getClassNameId(DDMStructure.class),
ddmStructure.getStructureId(), ddmTemplateKey, nameMap, null,
DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, language, xsl,
false, false, null, null, serviceContext);
addJournalArticles(
ddmStructureKey, ddmTemplate.getTemplateKey(),
_JOURNAL_ARTICLES_DIR_NAME + name);
}
示例2: addDDMTemplate
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void addDDMTemplate(
long templateGroupId, long ddmStructureId, String fileName,
String language, String script, String type, String mode)
throws Exception {
fileName = FileUtil.getShortFileName(fileName);
fileName = FileUtil.stripExtension(fileName);
String name = getName(fileName);
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(
groupId, PortalUtil.getClassNameId(DDMStructure.class),
getKey(fileName));
if (ddmTemplate != null) {
if (!developerModeEnabled) {
if (_log.isInfoEnabled()) {
_log.info(
"DDM template with name " + name + " and version " +
version + " already exists");
}
return;
}
DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate);
}
DDMTemplateLocalServiceUtil.addTemplate(
userId, templateGroupId,
PortalUtil.getClassNameId(DDMStructure.class), ddmStructureId,
getKey(fileName), getMap(name), null, type, mode, language, script,
false, false, StringPool.BLANK, null, serviceContext);
}
示例3: load
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
@Override
public DDMTemplate load(final PortletPreferences preferences, final String key, final String defaultValue) {
final String uuid = preferences.getValue(key, "");
if (StringUtils.isEmpty(uuid)) {
return null;
}
final long groupId = ServiceContextThreadLocal.getServiceContext().getScopeGroupId();
try {
return DDMTemplateLocalServiceUtil.fetchDDMTemplateByUuidAndGroupId(uuid, groupId);
} catch (final SystemException e) {
log.error("Could not load template {} from group {}", new Object[] { uuid, groupId, e });
return null;
}
}
示例4: addApplicationDisplayTemplate
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void addApplicationDisplayTemplate(
String script, File file, long classNameId)
throws PortalException, SystemException {
String fileName = FileUtil.stripExtension(file.getName());
String name = getName(fileName);
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(
groupId, classNameId, getKey(fileName));
if (ddmTemplate != null) {
if (!developerModeEnabled) {
if (_log.isInfoEnabled()) {
_log.info(
"DDM template with name " + name + " and version " +
version + " already exists");
}
return;
}
DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate);
}
DDMTemplateLocalServiceUtil.addTemplate(
userId, groupId, classNameId, 0, getKey(fileName), getMap(name),
null, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, StringPool.BLANK,
getDDMTemplateLanguage(name), script, false, false,
StringPool.BLANK, null, serviceContext);
}
示例5: addDDMTemplates
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void addDDMTemplates(
String ddmStructureKey, String fileName, InputStream inputStream)
throws Exception {
fileName = FileUtil.stripExtension(fileName);
String name = getName(fileName);
String xsl = StringUtil.read(inputStream);
setServiceContext(fileName);
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(
groupId, PortalUtil.getClassNameId(JournalArticle.class),
ddmStructureKey);
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(
groupId, PortalUtil.getClassNameId(DDMStructure.class),
getKey(fileName));
if (ddmTemplate != null) {
if (!developerModeEnabled) {
if (_log.isInfoEnabled()) {
_log.info(
"DDM template with name " + name + " and version " +
version + " already exists");
}
return;
}
DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate);
}
ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate(
userId, groupId, PortalUtil.getClassNameId(DDMStructure.class),
ddmStructure.getStructureId(), getKey(fileName), getMap(name), null,
DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null,
getDDMTemplateLanguage(fileName), replaceFileEntryURL(xsl), false,
false, null, null, serviceContext);
addJournalArticles(
ddmStructureKey, ddmTemplate.getTemplateKey(),
_JOURNAL_ARTICLES_DIR_NAME + fileName);
}
示例6: setupAssets
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void setupAssets(String fileName) throws Exception {
List<AssetTag> assetTags = AssetTagLocalServiceUtil.getGroupTags(
groupId);
for (AssetTag assetTag : assetTags) {
AssetTagLocalServiceUtil.deleteAssetTag(assetTag);
}
RepositoryLocalServiceUtil.deleteRepositories(groupId);
JournalArticleLocalServiceUtil.deleteArticles(groupId);
DDMTemplateLocalServiceUtil.deleteTemplates(groupId);
DDMStructureLocalServiceUtil.deleteStructures(groupId);
JSONObject jsonObject = getJSONObject(fileName);
if (jsonObject != null) {
JSONArray assetsJSONArray = jsonObject.getJSONArray("assets");
setupAssets(assetsJSONArray);
}
addDLFileEntries(_DL_DOCUMENTS_DIR_NAME);
addJournalArticles(
StringPool.BLANK, StringPool.BLANK, _JOURNAL_ARTICLES_DIR_NAME);
addDDMStructures(StringPool.BLANK, _JOURNAL_DDM_STRUCTURES_DIR_NAME);
addDDMTemplates(StringPool.BLANK, _JOURNAL_DDM_TEMPLATES_DIR_NAME);
}
示例7: setupAssets
import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; //导入依赖的package包/类
protected void setupAssets(String fileName) throws Exception {
if (!isCompanyGroup()) {
List<AssetTag> assetTags = AssetTagLocalServiceUtil.getGroupTags(
groupId);
for (AssetTag assetTag : assetTags) {
AssetTagLocalServiceUtil.deleteAssetTag(assetTag);
}
RepositoryLocalServiceUtil.deleteRepositories(groupId);
JournalArticleLocalServiceUtil.deleteArticles(groupId);
DDMTemplateLocalServiceUtil.deleteTemplates(groupId);
DDMStructureLocalServiceUtil.deleteStructures(groupId);
}
JSONObject jsonObject = getJSONObject(fileName);
if (jsonObject != null) {
JSONArray assetsJSONArray = jsonObject.getJSONArray("assets");
setupAssets(assetsJSONArray);
}
addDLFileEntries(_DL_DOCUMENTS_DIR_NAME);
addApplicationDisplayTemplates(_APPLICATION_DISPLAY_TEMPLATE_DIR_NAME);
addDDLStructures(_DDL_STRUCTURE_DIR_NAME);
addDDMStructures(StringPool.BLANK, _JOURNAL_DDM_STRUCTURES_DIR_NAME);
addDDMTemplates(StringPool.BLANK, _JOURNAL_DDM_TEMPLATES_DIR_NAME);
addJournalArticles(
StringPool.BLANK, StringPool.BLANK, _JOURNAL_ARTICLES_DIR_NAME);
addLayoutTemplate(_LAYOUT_TEMPLATE_DIR_NAME);
}