How to customize liferay services in Liferay 7/Overriding liferay services in liferay 7
How to override the liferay services?
As we used to work in the LR 6.2, we can override the liferay services using the servicewrapper template of blade CLI.
Following are the steps to do so.
First we will be creating a new Liferay Module as shown below.
Fill in the Name of the project and select the template as servicewrapper now click next.
In the next step fill in the package and the your custom class. Click on the button next to service and select the service wrapper that you need to override. In our case we are going to override the UserLocalServiceWrapper.
Override the required methods in the MyUserLocalServiceOverride and deploy the project using gradel deploy.
Now try to login and you can see that the methods are being called and system trace is getting printed out.
RELATED POSTS
Hi.,
ReplyDeleteI want to override RolesAdminPortlet.java from roles admin module how can i acheive this.?
Hi Reddy, it is not possible.
ReplyDeleteIf you really need to do this, your only option is to build your own roles admin portlet by copying all of the code of role admin portlet.
Hi Mohd Danish,
Deletemeans do i need to build new module same as roles admin module.?
Hi Danish,
ReplyDeleteI want to roleId and Organization Id in My custom table. for that i overriden Roles Service Wrapper.but to store Org Id and Role Id in My custom table i need org Id how can i ger org Id in Service Wrapper module..?
Try fetching it using the ServiceContext.
DeleteserviceContext.getScopeGroupId();
Should give you the required details.
Hi whats your phone number or contact?
ReplyDeleteThanks