Monday 8 February 2016

Sharing service layer

We can share our custom service layer in liferay if we want to use it in other portlets,hooks,ext,etc.
Step 1:
Create portlet X.And generate Service Layer.
Note:Use table and name attribute in entity tag before generating service layer.
Step 2:
If you want to make portlet X service layer available for whole portal then you want to create separate portlet (for ex: portlet Y) and create generate service layer as you created in portlet X.
Note:Here you should use table and name attribute in entity tag.Or else It  may affect portlet X service layer.
Step 3: Now check whether you got .jar file in portlet Y WEB-INF/lib
Step 4:Copy that jar file and paste it inside your server  /tomcat-7.0.42/lib/ext.And restart your server.
Note:You can use ext instead of directly pasting it in server.
Create ext and paste .jar file inside YourEXT/docroot/WEB-INF/ext-lib/global.Then do direct deploy.
Step 5:Now you can see that API's will be available for all portlets,hooks and ext.

No comments:

Post a Comment