留言板

Announcement difference in UserServiceImpl & UserLocalServiceImpl

Sourabh Lonikar,修改在7 年前。

Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl (答复)

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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,修改在7 年前。

RE: Announcement difference in UserServiceImpl & UserLocalServiceImpl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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.