Message Boards

How to create a simple plain service - API or Service ?

thumbnail
Victor Manea, modified 3 Years ago.

How to create a simple plain service - API or Service ?

New Member Posts: 11 Join Date: 10/23/20 Recent Posts

I have used so far a Service Builder (needed for exposing a service and then saving data in DB) and a Portlet (for displaying UI) for my project requirements. Now I am thinking of modularizing a little bit more - for example, I want to move file saving feature into a standalone Service and call it from Portlet when a new file is added.

I am still in the grey zone when this matters comes - I do not know if I need a Service Builder, an API, a Service, etc. For example, if I go with a Service Builder template, it also gives me the packages for persistence, which I do not need (and more than this); if I go with API template, it only gives me an interface; the Service template seems more of what I need, but from the start it creates me a class that extends OmniAdmin class - why this and not creating alredy a custom interface with a custom component class ?

In the meanwhile, I have created a module with Service Template type, then created a dummy interface which then I have implemented in the @Component class. - there was no method to implement, but the @Component class requires the "service" property, so I just created a dummy interface. Is this the way API/Services should be created ?

For a beginner in Liferay, there isn't enough documentation on the purpose of these template types and what is their intend. Any more details on this, or documentation that explains with more details when one should go with one pick or another, would be much appreciated.

Thanks !