0

I have just started working with Liferay and am trying to get up-to-speed. I have created a portlet project which calls a Notes database using REST and displays a list of recent mails.

The next task is to create a summary portlet which displays a number of different items including the number of unread mails. I would like to reuse some of the functions from the first portlet.

I have seen that there is a ServiceBuilder which looks interesting but the examples I've seen are for SQL databases.

Is there a way to expose other kinds of features this way or should I be looking at a different kind of solution?

paul
  • 13,312
  • 23
  • 81
  • 144
  • You know, that you can integrate more than one portlet into one portlet application? I mean, you can use the same "library functions" from more than one portlet, as long both belong to the same WAR-file. – Tobias Liefke Jun 09 '16 at 12:19
  • @TobiasLiefke - yes, I've done that. I have 2 portlet plugin projects: one for Notes mail, calendar, contacts etc; the other handles the interface to the telephone exchange (missed calls etc). I want to create a 3rd application to show a simple count of unread mails, up-coming appointments and missed calls (i.e. using functions from the other 2 portlet plugin projects). – paul Jun 09 '16 at 13:11
  • I was talking about two (or three) portlets in one portlet plugin project. It's difficult to access functions from a different web application (= portlet plugin project). One solution is IPC (inter portlet communication), but that's intended for event listening. Another is a shared resp. global library in your web container (e.g. `TOMCAT_HOME/lib/ext`). But I would try to integrate all portlets into a single plugin project, before building such a solution. – Tobias Liefke Jun 11 '16 at 08:08

1 Answers1

0

You can use service builder to make global service to use cross web applications or in liferay portal putting the service.jar in the tomcat/lib/ext. Building an empty entity it with not create the table in the db only the local and remote service. You can reference your entities or liferay entities in the xml configuration like this way.

    <entity name="MyService" local-service="true" remote-service="true">
        <reference entity="User" package-path="com.liferay.portal"  />
    </entity>

In this way we will have the MyServiceLocalUtil,MyServiceUtil and the json api to invoke.

Romeo Sheshi
  • 901
  • 5
  • 7