Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nadine R
Service Builder
December 16, 2009 1:50 AM
Answer

Nadine R

Rank: Junior Member

Posts: 26

Join Date: July 30, 2009

Recent Posts

Hi all,

I use the service builder to generate my portlets in SDK and I was wondering what was the difference between the localservice and service classes.

Cheers,
Nadine
Minhchau Dang
RE: Service Builder
December 17, 2009 6:09 PM
Answer

Minhchau Dang

LIFERAY STAFF

Rank: Expert

Posts: 349

Join Date: October 22, 2007

Recent Posts

By default, Service* calls have a permission check to verify that the user in the current request has the appropriate permissions against the model / persistence layer being accessed (more information is available in this wiki article) and will throw an error if there is no current user (if you use them from a startup action, for example).

LocalService* calls do not have this permission check by default.
Shagul Khajamohideen
RE: Service Builder
December 18, 2009 2:46 PM
Answer

Shagul Khajamohideen

Rank: Liferay Master

Posts: 759

Join Date: September 27, 2007

Recent Posts

Adding to Minhchau's reply, all the Service classes have access to the current user context and all methods in PrincipalBean class. This class is extended by the base service Impl.

Take a look at some of the classes in the portal source. GroupServiceImpl is one good example.


Best Regards,
Shagul
CHARFI Sofien
RE: Service Builder
March 16, 2011 4:38 PM
Answer

CHARFI Sofien

Rank: New Member

Posts: 2

Join Date: May 20, 2009

Recent Posts

Hello
I m working with liferay 6 And I have a problem with the service builder
how can we make a relation ship betwwen 2 custum entity
this mys sample

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="com.exemple">
<author>admin</author>
<namespace>exemple</namespace>
<entity name="Nationalite" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="idNationalite" type="long" primary="true" />
<!-- Other fields -->
<column name="name" type="String" />

<!-- Order -->
<order>
<order-column name="idNationalite" order-by="asc" />
</order>

<!-- Finder methods -->
<finder name="name" return-type="Collection">
<finder-column name="name" />
</finder>

</entity>

<entity name="Client" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="idClient" type="long" primary="true" />
<!-- Other fields -->
<column name="name" type="String" />
<column name="age" type="String" />
<column name="nationalite" type="Collection" entity="Nationalite" mapping-key="idNationalite" />

<!-- Order -->
<order>
<order-column name="idClient" order-by="asc" />
</order>

<!-- Finder methods -->
<finder name="name" return-type="Collection">
<finder-column name="name" />
<finder-column name="age" />
</finder>

</entity>
</service-builder>


Thanks
MICHAIL MOUDATSOS
RE: Service Builder
November 28, 2011 6:35 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

@Minhchau Dang

Minhchau Dang:
By default, Service* calls have a permission check to verify that the user in the current request has the appropriate permissions against the model / persistence layer being accessed


where is this "permission against the model/persistence layer being accessed" defined? I read the article yet is a bit vague how this differs from accessibility permissions defined through Liferay administration GUI capabilities? Is it something different or is it just a programmable alternative? (Programmable in the sense that you can define permissions at code) I havent search the *ServiceUtil API to be honest. I always use the *LocalServiceUtil to do my job so I wanted an intuitive answer to imply whether I m doing something really wrong there or not

Thank you in advance
Jan Gregor
RE: Service Builder
November 29, 2011 3:07 AM
Answer

Jan Gregor

Rank: Regular Member

Posts: 224

Join Date: October 20, 2010

Recent Posts

Hi Michal,

The answer is pretty easy and I think that guys gave you too much for beginning emoticon

Basically if you are using any service from Liferay from your portlet, or hook , or any other modul running in the same JVM, use local services. Once you are accessing these services from an external source, you must use one of existing interfaces like rest, soap or json. In this case the remote services will be called and the permission check will be triggered extra for security reasons.

Regards,
Jan.