Forums de discussion
Get JournalArticle created object in hooked processAction.
Raja Seth, modifié il y a 8 années.
Get JournalArticle created object in hooked processAction.
Regular Member Publications: 233 Date d'inscription: 18/08/11 Publications récentes
Hi All,
I had a requirement in which I needed to perform some operation after creation or adding JournalArticle, for which I created CustomEditArticleAction which hook the EditArticleAction class of Liferay. Below is the impl of my class :
Now, I want the JournalArticle object which is recently created or added. Do I have any option to get the JournalArticle object, or I need to bring the original implementation of EditArticleAction class of Liferay.
Please let me know!!
Thanks & Regards,
Raja
I had a requirement in which I needed to perform some operation after creation or adding JournalArticle, for which I created CustomEditArticleAction which hook the EditArticleAction class of Liferay. Below is the impl of my class :
public class CustomEditArticleAction extends BaseStrutsPortletAction {
@Override
public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig,
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
originalStrutsPortletAction.processAction(null, portletConfig,
actionRequest, actionResponse);
------------------------------------
------ My custom impl ------
------------------------------------
}
Now, I want the JournalArticle object which is recently created or added. Do I have any option to get the JournalArticle object, or I need to bring the original implementation of EditArticleAction class of Liferay.
Please let me know!!
Thanks & Regards,
Raja
Raja Seth, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Regular Member Publications: 233 Date d'inscription: 18/08/11 Publications récentes
Has anybody came across of this type of scenario or I need to fetch through dynamic query with the content data I am getting from the request?
Himanshu Bhandari, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Regular Member Publications: 148 Date d'inscription: 09/05/14 Publications récentes
Hi
I don't know for what purpose you have created hook and what operations you want to perform, but for this
you can try this code :
Thanks
I don't know for what purpose you have created hook and what operations you want to perform, but for this
I want the JournalArticle object which is recently created or added
you can try this code :
JournalArticleLocalServiceUtil.isLatestVersion(journal.getGroupId(), journal.getArticleId(), journal.getVersion()) &&
(!journal.isInTrash())&&
(!journal.isInactive())){}
Thanks
Raja Seth, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Regular Member Publications: 233 Date d'inscription: 18/08/11 Publications récentes
Hi Himanshu,
The approach you have mentioned requires an object of JournalArticle, but here if you see my above post I don't have an object. The snippet you have given is checking whether the article is of latest version or not.
Regards,
Raja
The approach you have mentioned requires an object of JournalArticle, but here if you see my above post I don't have an object. The snippet you have given is checking whether the article is of latest version or not.
Regards,
Raja
Himanshu Bhandari, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Regular Member Publications: 148 Date d'inscription: 09/05/14 Publications récentes
Hi
Yes off course, my approach will require to have an object of JournalArticle and if I am getting your question correctly that states
I am not getting any clue that without object How you will get recently added object.
Thanks
Yes off course, my approach will require to have an object of JournalArticle and if I am getting your question correctly that states
I want the JournalArticle object which is recently created or added.to get that I have used following code:
List<journalarticle> listJournalartArticles=JournalArticleLocalServiceUtil.getArticles(scopeGroupId);
for(JournalArticle journal : listJournalartArticles){...}</journalarticle>
I don't have an object.
I am not getting any clue that without object How you will get recently added object.
Thanks
Raja Seth, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Regular Member Publications: 233 Date d'inscription: 18/08/11 Publications récentes
Hi Himanshu,
If you see my action method, I have used the below method :
What this method do it executes the original processAction() first. So after the execution of this method I wouldn't have the JournalArticle object. If you check the existing code you would know that after this method execution if I want to get the same article it wouldn't be possible. So, is there any other possibility to get?
Thanks & Regards,
Raja
If you see my action method, I have used the below method :
originalStrutsPortletAction.processAction(null, portletConfig, actionRequest, actionResponse);
What this method do it executes the original processAction() first. So after the execution of this method I wouldn't have the JournalArticle object. If you check the existing code you would know that after this method execution if I want to get the same article it wouldn't be possible. So, is there any other possibility to get?
Thanks & Regards,
Raja
Harish Kumar, modifié il y a 8 années.
RE: Get JournalArticle created object in hooked processAction.
Expert Publications: 483 Date d'inscription: 31/07/10 Publications récentesRaja Seth:
Hi Himanshu,
If you see my action method, I have used the below method :originalStrutsPortletAction.processAction(null, portletConfig, actionRequest, actionResponse);
What this method do it executes the original processAction() first. So after the execution of this method I wouldn't have the JournalArticle object. If you check the existing code you would know that after this method execution if I want to get the same article it wouldn't be possible. So, is there any other possibility to get?
Thanks & Regards,
Raja
Hi
better you should use Model Listener.