Today we will see how to write service wrapper in Liferay 6.2. We override User service getUserCount().Here we create a class that extend the particular wrapper class and just provide the entries of our custom class in liferay-hook.xml so that liferay use our services instead of Original.
Step 1:-Create a liferay Plug project
Right Click in Project Explorer and Click New -> Liferay plugin project. Now give the Project name and select hook in plugin type:-
Step 3:-Override the getUserCount()
Step 4:-Deploy the Hook
Deploy the hook and call getUsersCount() from your portlet .
Output:-This text is from getUsersCount
Thanks you for reading my blog. Please comment below if you like my post.
Right Click in Project Explorer and Click New -> Liferay plugin project. Now give the Project name and select hook in plugin type:-
Step 2:-Create a hook in the project
Right Click on Project ->New->Liferay Hook Configuration->Select Services
Click Next--->Click Add-->Select Service Type(UserLocalService)
For Impl Class
Click New-->Give Package Name and your Impl Class Name
Then Click Finish
This step automatically Create the entry in liferay-hook.xml.
<hook>
<service>
<service-type>com.liferay.portal.service.UserLocalService</service-type>
<service-impl>com.liferay.article.MyUserLocalService</service-impl>
</service>
</hook>
Open MyUserLocalService and override getUserCount()
Step 4:-Deploy the Hook
Deploy the hook and call getUsersCount() from your portlet .
Output:-This text is from getUsersCount
Thanks you for reading my blog. Please comment below if you like my post.
0 comments:
Post a Comment