Forums de discussion

Announcement difference in UserServiceImpl & UserLocalServiceImpl

Sourabh Lonikar, modifié il y a 7 années.

Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Hi everyone,
Liferay uses ServiceBuilder to build DB classes. There seems to be significant difference in UserServiceImpl.java & UserLocalServiceImpl.java including method signature.


addUserWithWorkflow(long creatorUserId, long companyId, ....,long[] userGroupIds, boolean sendEmail, ServiceContext serviceContext))

addUserWithWorkflow(long companyId, boolean autoPassword, ..., List<AnnouncementsDelivery> announcementsDelivers, boolean sendEmail, ServiceContext serviceContext)

I need to modify UserServiceImpl .java class but we have internally used UserLocalServiceImpl.java in our hook, hence I am wondering why announcements for user are not updated in UserLocalServiceImpl. I am specifically referring to List<AnnouncementsDelivery> announcementsDelivers variable.

1. Can someone explain why such difference in both classes ? Are all remote and local classes different functionally ?
2. Why no announcement object is referred in Local service class ? Are announcements not updated when user is edited in UserLocalServiceImpl.java ?


Regards,
Sourabh
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl (Réponse)

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
The concept is that if you are using the local services, you are okay with handling each of the steps manually, including those of adding the announcement deliveries.

The remote option, well those tend to be all inclusive because they are intended to be called from web service endpoints (JSON or SOAP), so having them include everything makes it easier for remotes to do everything in one call.
Sourabh Lonikar, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Hi David,
Thanks for explaining principle conceptually. Can you point out code in liferay where they actually set Announcement Notification option for new user during user creation process? I am unable to find it in UserLocalServiceImpl.java class.

I thought it might be set when user logs in forst time, though no concrete relation.

Regards,
Sourabh
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
You're connecting the wrong things...

The announcement notifications is just for registering contact methods for the user, but it does not mean the user is going to be self-notified if they have registered notification contact methods.

The new user account email thing, if that's what you're after, well that is auto-sent during user account completion and that is a) enabled via a portal-ext.properties setting and b) will be delivered to the email address tied to the user account (not the announcement notifications address(es)).
Sourabh Lonikar, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Hi David,
I was not clear about my requirement.
David H Nebinger:
The announcement notifications is just for registering contact methods for the user, but it does not mean the user is going to be self-notified if they have registered notification contact methods.


I am actually referring to announcement notification via email option for each user. If we refer Announcement option in User Account section for each user, we are provided with 3 notification paths : email, sms, web. Out of these, web is enabled by default for all users. Now since I would like same for email option, I wanted to check exactly where in code is web enabled and stored by default.

The new user account creation notification email is working fine as you mentioned, but that is not my related to my requirement.

Thanks for responding,
Sourabh
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Other than the one addUserWithWorkflow() method defined in the UserService interface, all other management of the announcements is manual. This means you'll need to invoke the AnnouncementsDelivery(Local)Service yourself.
Sourabh Lonikar, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Hi David,
I was just curious where in code exactly was Liferay handling setting default web=enabled user case in code, so I can insert email=enabled @ same place.

But I can manually add it in any other file too.

Thanks for responding,
Sourabh
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
I wouldn't try to hack the Liferay code this way.

Instead I'd just create a User ModelListener implementation and in the onAfterCreate() method you could call the AD service to add your additional value.