Sunday 27 May 2012

Calling Methods | Internal Liferay API

Liferay has a robust service-layer API for developers to use. However, sometimes there are cases when you need to use methods in the internal Liferay API. You can't use the internal API directly, but you can invoke it indirectly with the PortalClassInvoker class.


here is a example:
Stack<JournalArticle> recentArticleStack = (Stack<JournalArticle>)
PortalClassInvoker.invoke( false, "com.liferay.portlet.journal.util.JournalUtil", "getRecentArticles", new String[] {"javax.portlet.PortletRequest"},
actionRequest);
Here is the method signature for PortalClassInvoker.invoke( ) :
invoke(boolean newInstance, String className, String methodName, 
    String[] parameterTypeNames, Object... arguments) 

For more details visit : 

Note:
Use of "PortalClassInvoker" class should be the exception rather than the rule. Should always attempt to find a solution using the Liferay Service-Level API before resorting to the use of PortalClassInvoker.

5 comments:

  1. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating mulesoft Online Training

    ReplyDelete