Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Luca Andreatta
Web service update portlet preferences
16 juillet 2013 09:04
Réponse

Luca Andreatta

Rang: Junior Member

Publications: 28

Date d'inscription: 16 février 2009

Publications Récentes

Hi all,
I wanted to update portlet preferences using web service in Liferay 6.1.1.
There is a local service to do it (PortletPreferencesServiceWrapper.updateArchivePreferences), but it isn't exposed.

What is the best way to do it? Using a Hook or build a new webservice through service builder which calls the internal service?

Thank,
Luca
Antoine Comble
RE: Web service update portlet preferences
16 juillet 2013 09:19
Réponse

Antoine Comble

Rang: Regular Member

Publications: 204

Date d'inscription: 7 septembre 2012

Publications Récentes

Hi Luca,

In my opinion, you should create a new service using service builder.

Regards,

Antoine
David H Nebinger
RE: Web service update portlet preferences
16 juillet 2013 14:42
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 7024

Date d'inscription: 1 septembre 2006

Publications Récentes

In my opinion, you should forget about it...

The portlet prefs allow a portlet instance to update it's own prefs, typically as a result of the user tweaking the prefs dialog. It's also bound to the instance of the portlet on the page, not every single portlet of a type...

So why on earth would you want remote users to be able to change portlet instance prefs?
Luca Andreatta
RE: Web service update portlet preferences
17 juillet 2013 00:42
Réponse

Luca Andreatta

Rang: Junior Member

Publications: 28

Date d'inscription: 16 février 2009

Publications Récentes

Hi,
I wanted to create sites in Liferay from a Portlet. I want to use web services to be more adherent to the rest of the application, because it will create some folders also in Alfresco and a project in JIRA, just to clarify why on earth I want to do it...

I'm not sure to use the service builder, because I don't need all the chain from database to web service, but only to extend an internal service and then expose as a web service.
Luca Andreatta
RE: Web service update portlet preferences
18 juillet 2013 01:29
Réponse

Luca Andreatta

Rang: Junior Member

Publications: 28

Date d'inscription: 16 février 2009

Publications Récentes

I found that I cannot use a portlet plugin to expose the method PortletPreferencesServiceUtil.updateArchivePreferences(long userId, long groupId, String name, String portletId, PortletPreferences preferences) because I cannot use the Object com.liferay.portlet.PortletPreferencesImpl that resides in porta-impl.jar and if I add it to my portlet I get this error:
 1Detected inclusion of portal-impl.jar in WEB-INF/lib.
 2
 3portal-impl.jar is designed with a large number of singleton classes which are
 4instantiated on the basis that they will exist alone in the application server.
 5
 6While compile time issues may be resolved, portlets cannot be made to work by
 7simply adding portal-impl.jar, because doing so violates the above assumption,
 8and the resulting problems will be extremely difficult to debug.
 9
10Please find a solution that does not require portal-impl.jar.


So I tried to usa a Hook, but apparently it is not possible to do it in a Hook:
LPS-30487
Forum Message 17048822

How can I do it? Can I do it using an ext plugin?
Luca Andreatta
RE: Web service update portlet preferences
18 juillet 2013 01:42
Réponse

Luca Andreatta

Rang: Junior Member

Publications: 28

Date d'inscription: 16 février 2009

Publications Récentes

I still don't understand why on earth Liferay gives you the remote services to add sites, users, groups, pages, portlets but don't gives you the opportunity to configure these portlets?!?

And why a so called Liferay Legend suggest me to forget about it? I don't think my request is so awkward, I only want to create sites remotely in Liferay!
David H Nebinger:
In my opinion, you should forget about it...

The portlet prefs allow a portlet instance to update it's own prefs, typically as a result of the user tweaking the prefs dialog. It's also bound to the instance of the portlet on the page, not every single portlet of a type...

So why on earth would you want remote users to be able to change portlet instance prefs?