Fórum
Liferay7 : Portlet developement, the new way
Armaz Mellati, modificado 7 Anos atrás.
Liferay7 : Portlet developement, the new way
Junior Member Postagens: 96 Data de Entrada: 30/10/09 Postagens Recentes
Hi
My goal is to create a sample portlet with its own Entities, the same way we used to get using the PluginSDK.
Following the documentation at https://dev.liferay.com/develop, I have managed to create the Workspace and the MVCPortlet. However it does not have any service.xml. It seems to me I am supposed to create another module using the "Servicebuilder" template.
Now I have done it, so I have a workspace with two Module projects. One mvcportlet and a Book-model (for instance), which consists of two sub-modules : an Book-api and a Book-service.
But how am I supposed to access the Book-Entitiy and services ? Have I missed some part of the documentation ?
PS! I try to use the Liferay IDE as much as possible.
My goal is to create a sample portlet with its own Entities, the same way we used to get using the PluginSDK.
Following the documentation at https://dev.liferay.com/develop, I have managed to create the Workspace and the MVCPortlet. However it does not have any service.xml. It seems to me I am supposed to create another module using the "Servicebuilder" template.
Now I have done it, so I have a workspace with two Module projects. One mvcportlet and a Book-model (for instance), which consists of two sub-modules : an Book-api and a Book-service.
But how am I supposed to access the Book-Entitiy and services ? Have I missed some part of the documentation ?
PS! I try to use the Liferay IDE as much as possible.
Gustavo Oliveira, modificado 7 Anos atrás.
RE: Liferay7 : Portlet developement, the new way (Resposta)
Junior Member Postagens: 98 Data de Entrada: 23/09/15 Postagens Recentes
You have to add the service module api as a depency on build.gradle.
Example:
And then use the Reference annotation to inject the service like this, the first one I created, the second is the native Counter:
Example:
compile project(":modules:persitencia:persitencia-api")
And then use the Reference annotation to inject the service like this, the first one I created, the second is the native Counter:
private TesteLocalService testeService;
private CounterLocalService counterService;
@Reference(unbind = "-")
public void setCounterService(CounterLocalService counterService) {
this.counterService = counterService;
}
@Reference(unbind = "-")
public void setTesteService(TesteLocalService testeService) {
this.testeService = testeService;
}
Armaz Mellati, modificado 7 Anos atrás.
RE: Liferay7 : Portlet developement, the new way
Junior Member Postagens: 96 Data de Entrada: 30/10/09 Postagens Recentes
Thanks alot. It did it.
However for the IDE to be able to compile, I had also to add the *-api project as a required project to the portlet-project. Otherwise the Eclipse shows a lot of errors.
However for the IDE to be able to compile, I had also to add the *-api project as a required project to the portlet-project. Otherwise the Eclipse shows a lot of errors.