4

我已经开始使用 Liferay 开发 portlet,我想展示一篇(或多篇)具有指定结构的 Web 内容文章。

例如,假设我有一个结构“A”,那么我怎样才能获得使用该结构创建的最后一篇网络内容文章?

本文解释了如何获取带有 a但不带有 a 的文章tagstructure

谢谢

4

1 回答 1

6

The Liferay API Docs (this is for 6.1, as I don't know what version you're using) are your friend as is the Liferay source code.

In short you'll want to use one of the following API methods:

JournalArticleLocalServiceUtil.getStructureArticles(long groupId, String structureId);
JournalArticleLocalServiceUtil.getStructureArticles(long groupId, String structureId, int start, int end, OrderByComparator obc) 

These rely on knowing the ID of the structure from which your content was generated, if you don't know what it is then you can use the following API method to get a list of all of them for your current Community:

JournalStructureLocalServiceUtil.getStructures(long groupId) 

You can also use similar methods to find Journal Articles by the JournalTemplate that they use:

JournalTemplateLocalServiceUtil.getStructureTemplates(long groupId, String structureId); 

JournalArticleLocalServiceUtil.getTemplateArticles(long groupId, String templateId);
JournalArticleLocalServiceUtil.getTemplateArticles(long groupId, String templateId, int start, int end, OrderByComparator obc) 

Comment back if you have any questions, or if this answers your question please hit the "Accept answer" button tick! Thanks!

于 2012-11-28T08:02:16.747 回答