Sunday 21 August 2016

Overriding liferay services in Liferay 7

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.



For more details on the above topic please go through the below video on my youtube channel.

RELATED POSTS

j\

6 comments:

  1. Hi.,
    I want to override RolesAdminPortlet.java from roles admin module how can i acheive this.?

    ReplyDelete
  2. Hi Reddy, it is not possible.

    If 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.

    ReplyDelete
    Replies
    1. Hi Mohd Danish,
      means do i need to build new module same as roles admin module.?

      Delete
  3. Hi Danish,
    I 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..?

    ReplyDelete
    Replies
    1. Try fetching it using the ServiceContext.
      serviceContext.getScopeGroupId();
      Should give you the required details.

      Delete
  4. Hi whats your phone number or contact?
    Thanks

    ReplyDelete

 

Copyright @ 2016 LiferayRevisited.