Get Liferay-specific Web Content Article

I started developing portlets with Liferay, and I would like to show one (or more) web content article with the specified structure.

For example, suppose I have an β€œA” structure, so how can I get the latest web content article that is created using this structure?

This

+4
source share
1 answer

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

In short, you will 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) 

They rely on knowing the identifier of the structure from which your content was created, if you do not know what it is, 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 search for journal articles using 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, if you have any questions, or if this answers your question, click the "Accept Answer" button. Thanks!

+6
source

All Articles