掲示板

Get last version of last journal articles

thumbnail
12年前 に Pierpaolo Cira によって更新されました。

Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Hi all,

I need to show the last created journal artciles (filtering by articleTypes only).
But in this list (the articles list I'm speaking about), just the last article version should appear. (eg. if in the list there are two different version of the same article, only the last one will be shown).

I not found any portlet to help me.

So I'm trying to create a SDK portlet for my needs... but I don't know if a Service method can help me exists.
Have you any idea about? Or I need to write a new finder implementation?

Any suggestion'll be appreciated
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Another info to add: browsing the Liferay sourcecode, I see a method you can use to get all last articles... but the search is done querying the indexer and not the DB...
12年前 に Oliver Bayer によって更新されました。

RE: Get last version of last journal articles

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi,

not sure which method you've found but try using one of the "JournalArticleLocalServiceUtil.getLatestArticle(....)" methods. In the impl version of this class you can see that these methods are calling the JournalArticlePersistenceImpl class so they are quering the db directly.

HTH Oli
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Oliver Bayer:
Hi,

not sure which method you've found but try using one of the "JournalArticleLocalServiceUtil.getLatestArticle(....)" methods. In the impl version of this class you can see that these methods are calling the JournalArticlePersistenceImpl class so they are quering the db directly.

HTH Oli


I forget to write I'm using LR 5.1.2...
The only method matching you suggested are:
getLatestArticle(long groupId, String articleId);
getLatestArticle(long groupId, java.lang.String articleId, java.lang.Boolean approved);
So it give me the lastest article receving an Article ID... but I don't know the article ids: I need it also... because I'm searching for the last version of the last approved articles.
thumbnail
12年前 に Filip Rak によって更新されました。

RE: Get last version of last journal articles

New Member 投稿: 15 参加年月日: 10/02/10 最新の投稿
Hi,
you should look into SearchEngineUtil and create a query with Field.TYPE restriction sort by modifiyDate or displayDate - it's up to you. 'JournalArticle*Util' is ok (just ok), but can be a real pain in the ass ;)
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Filip Rak:
Hi,
you should look into SearchEngineUtil and create a query with Field.TYPE restriction sort by modifiyDate or displayDate - it's up to you. 'JournalArticle*Util' is ok (just ok), but can be a real pain in the ass ;)


Eheheh... using the SearchEngineUtil is a good idea... but I'm scaried to use it... because if the search engine (for a little bit of time also) doesn't work (it's installed on another machine not fault tolerant) my home page'll be empty.
Do you think is stupid to be scaried for that?
thumbnail
12年前 に Szymon Gołębiewski によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 246 参加年月日: 09/06/08 最新の投稿
You want to show latest version of an article or latest AND approved version of an article? Also, did you check Asset Pubsliher or Web Content Display portlets?
thumbnail
12年前 に Mayur Patel によって更新されました。

RE: Get last version of last journal articles

Expert 投稿: 358 参加年月日: 10/11/17 最新の投稿
I was also facing same issue once you can do it like when you are iterating list,
you can check that journalarticle with following mehtod

if(JournalArticleLocalServiceUtil.isLatestVersion(groupId,journalobj.getArticleId(),journalobj.getVersion())){
// here logic will come or you can create another list to add those articles with latest version
}

so Now List will contain only articles with latest version after filtering out

Hope this helps emoticon

Regards,
Mayur
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Mayur Patel:
I was also facing same issue once you can do it like when you are iterating list,
you can check that journalarticle with following mehtod

if(JournalArticleLocalServiceUtil.isLatestVersion(groupId,journalobj.getArticleId(),journalobj.getVersion())){
// here logic will come or you can create another list to add those articles with latest version
}

so Now List will contain only articles with latest version after filtering out

Hope this helps emoticon

Regards,
Mayur


Mu need to edit existing code of an old portlet, in wich its developer used a code like your.
The problem is that we have some thousands of record in ArticleJournal table... so, the "full" data transfer and the business logic (processing full recordset), need many resources. Infact I'm trying to edit this solution approach because, for a few hundreds of contemporary requests, the loading time became inexusable... 2-3 seconds emoticon
thumbnail
12年前 に Mayur Patel によって更新されました。

RE: Get last version of last journal articles

Expert 投稿: 358 参加年月日: 10/11/17 最新の投稿
Please provide your ideas if you have implemented that same thing in any other way,that will be helpful emoticon
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Mayur Patel:
Please provide your ideas if you have implemented that same thing in any other way,that will be helpful emoticon


I'm just deciding if use the SearchEngine solution.

An alternative way is to store (in a custom db tables, or in the application context for each cluster node) the data I need during the first request (I execute this code just for the first request)... a cache like system.
Then I can (write and) deploy a Hook listening the "Approve" action on JournalArticle and, if it concernes my cache data, modify my "cache system".
In this "cache" it isn't necessary to store all the content, but the interesting JournalArticle ids (and theyr latest version, to halve the DB access).

By the way, meanwhile I'm evaluating the best approch for our needs, I hope that someone can suggest me a better way... emoticon
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Szymon Gołębiewski:
You want to show latest version of an article or latest AND approved version of an article? Also, did you check Asset Pubsliher or Web Content Display portlets?


Yes, I need to show a list containing the last version of approved articles, ordered by time.

Using LR5.1, the Asset Publisher query settings use only tags to filter (I don't know if it's different for the new LR version)... but the contents existing in my portal are definided by Type of Categorization... and it isn't possible to filter by this parameter.
The second portlet you suggest, in LR5.1 doesn't exist emoticon
thumbnail
12年前 に Pierpaolo Cira によって更新されました。

RE: Get last version of last journal articles

Regular Member 投稿: 141 参加年月日: 10/02/26 最新の投稿
Apologies for the late answers... and, above all, thak you for your attenction.
I'm going to answer to any post. emoticon