0
votes

Following is my requirement :

Whenever site is created, with help of GroupListener we are adding some custom attributes to created site.

So assume that you are crating "Liferay Test" site then it will have some fix custom attribute "XYZ" with value set in GroupListeners onAfterCreate method.

I can see this value in custom fields under site settings. Now based on this values, we are creating groups in another system(out of liferay, using webservices).

So far so good.

Whenever we are deleting the site we need to remove the equivalent groups from other system via web service. But while deleting site, in GroupListener we are not able to retrieve the custom attributes.

On further debug by adding expando listener, I observed that Expando listeners are getting called first and then delete method of GroupLocalService/GroupListener.

And hence we are not able to delete the groups present in another system.

So I was wondering if we can have ordering defined for listeneres.

Note: Since we were not getting custom attributes in listeners we implemented GroupLocalServiceImpl and with this we are getting custom attributes in delete method on local environment but not on our stage environment which has clustering.
1

1 Answers

0
votes

You shouldn't use the ModelListeners for this kind of change, rather create ServiceWrappers, e.g. wrap the interesting methods in GroupLocalService (for creation as well as deletion).

This will also enable you to react to failures to create records in your external system etc.