Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Pierpaolo Cira
Staging and resources ID
April 19, 2013 7:41 AM
Answer

Pierpaolo Cira

Rank: Regular Member

Posts: 124

Join Date: February 26, 2010

Recent Posts

Hi all,
I'm writing a portlet that stores some articleId of JournalArticles, to use them in future (articleIds never changes with article versions).
It works fine.

But if I enable "staging mode" a problem occours: when LR is staging JournalArticles, it changes the "articleId" value for the article copy.
So, enabling staging, when LR tries to import existing articles for live area it says me something like "article with id XXX already exists, so the article will be imported(duplicated) using YYY as new id".

My question is: if I Can't avoid this behaviour... is it possible for me to know how to get the mapping between the same article inside these different areas (live and staging)?
What is the live-articleId correspondig to corresponding staging-articleId?

Thanks for any suggestion...
Brendan Johan Lee
RE: Staging and resources ID
June 6, 2013 8:43 AM
Answer

Brendan Johan Lee

Rank: Junior Member

Posts: 29

Join Date: February 29, 2012

Recent Posts

I had to find this type of mappings for a project I'm working on right now. It took me a some intense studying of the source code, but I found a solution.

To find the id of the article in live from the article in staging do the following:

1
2Group gr = GroupLocalServiceUtil.getGroup(article.getGroupId());
3if (gr.hasStagingGroup()) {
4                JournalArticleResource jar = JournalArticleResourceLocalServiceUtil.getJournalArticleResourceByUuidAndGroupId(article.getArticleResourceUuid(), gr.getStagingGroup().getGroupId());
5                _log.info("Corresponding article in Live " + jar.getArticleId());
6}


To find the id of the article in staging from the article in live, just to the reverse (hasLiveGroup())
Aldo De Vleeschauwer
RE: Staging and resources ID
October 22, 2013 6:36 AM
Answer

Aldo De Vleeschauwer

Rank: New Member

Posts: 23

Join Date: March 9, 2011

Recent Posts

I think this will only work when using Local staging.

Another approach is shortly described in Portlet preference moving from staging to live.