gpt4 book ai didi

liferay - 如何在以编程方式创建时向期刊文章添加结构和模板

转载 作者:行者123 更新时间:2023-12-02 01:27:27 26 4
gpt4 key购买 nike

我已经通过门户用户界面创建了结构和模板。现在我正在操作类中以编程方式创建期刊文章。在操作类中创建期刊文章时,我想将现有结构和模板设置为该期刊文章。我正在尝试使用以下方法,但这里的 ddmStructureKey 和 ddmTemplateKey 是什么意思。

那些只与我的需求相关吗?

JournalArticleLocalServiceUtil.addArticle(userId, groupId, folderId, titleMap, descriptionMap, content, ddmStructureKey, ddmTemplateKey, serviceContext)

帮我解决这个未知的问题。谢谢。

最佳答案

我为回答上述问题而编写的以下代码对我来说很有效。感谢@Romeo Sheshi。我已经对一些东西进行了硬编码。根据您的要求,您可以做任何您想做的事情。

ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
Long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
DDMStructure ddmStructure=DDMStructureLocalServiceUtil.getDDMStructure(11515);
DDMTemplate ddmTemplate=DDMTemplateLocalServiceUtil.getDDMTemplate(11517);
Map<Locale,String> titleMap=new HashMap<Locale,String>();
titleMap.put(themeDisplay.getLocale(), "First Record");
String content=
"<root available-locales='en_US' default-locale='en_US'>"
+"<dynamic-element dataType='string' indexType='keyword' name='Title' readOnly='false' repeatable='false' required='false' showLabel='true' type='text' width='small'>"
+"<dynamic-content>FirstRecord</dynamic-content>"
+"</dynamic-element>"
+"<dynamic-element dataType='string' indexType='keyword' name='Description' readOnly='false' repeatable='false' required='false' showLabel='true' type='textarea' width='small'>"
+" <dynamic-content>This the first one doing by programatically</dynamic-content>"
+"</dynamic-element>"
+"<dynamic-element dataType='image' fieldNamespace='wcm' indexType='keyword' name='DamImage' readOnly='false' repeatable='false' required='false' showLabel='true' type='wcm-image' width=''>"
+" <dynamic-content>http://localhost:8080/documents/10184/0/welcome_community/0dc0adb1-b565-409a-b766-96d1e42b04fb?t=1459163274526</dynamic-content>"
+"</dynamic-element>"
+"<dynamic-element dataType='string' indexType='keyword' name='UserIdExcel' readOnly='false' repeatable='false' required='false' showLabel='true' type='text' width='small'>"
+" <dynamic-content>458155</dynamic-content>"
+"</dynamic-element>"
+"<dynamic-element dataType='string' indexType='keyword' name='Username' readOnly='false' repeatable='false' required='false' showLabel='true' type='text' width='small'>"
+" <dynamic-content>LaxmanDeepak</dynamic-content>"
+"</dynamic-element>"
+"<dynamic-element dataType='date' fieldNamespace='ddm' indexType='keyword' name='DateFromExcel' readOnly='false' repeatable='false' required='false' showLabel='true' type='ddm-date' width='small'>"
+"<dynamic-content>03/29/2016</dynamic-content>"
+"</dynamic-element>"
+"</root>";
ServiceContext serviceContext = new ServiceContext();
serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId());
serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);

JournalArticleLocalServiceUtil.addArticle(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), parentFolderId, titleMap, null, content, ddmStructure.getStructureKey(), ddmTemplate.getTemplateKey(), serviceContext);

关于liferay - 如何在以编程方式创建时向期刊文章添加结构和模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36275950/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com