Fórumok
Get JournalArticle created object in hooked processAction.
Raja Seth, módosítva 8 év-val korábban
Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 233 Csatlakozás dátuma: 2011.08.18. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 233 Csatlakozás dátuma: 2011.08.18. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 148 Csatlakozás dátuma: 2014.05.09. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 233 Csatlakozás dátuma: 2011.08.18. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 148 Csatlakozás dátuma: 2014.05.09. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Regular Member Bejegyzések: 233 Csatlakozás dátuma: 2011.08.18. Legújabb bejegyzések
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, módosítva 8 év-val korábban
RE: Get JournalArticle created object in hooked processAction.
Expert Bejegyzések: 483 Csatlakozás dátuma: 2010.07.31. Legújabb bejegyzésekRaja 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.