-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
MBMessageUserLocalServiceWrapper.java
78 lines (64 loc) · 2.83 KB
/
MBMessageUserLocalServiceWrapper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.message.boards.internal.service;
import com.liferay.message.boards.model.MBMessage;
import com.liferay.message.boards.service.MBMessageLocalService;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.UserGroupRole;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.ServiceWrapper;
import com.liferay.portal.kernel.service.UserLocalServiceWrapper;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import java.util.List;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Sergio González
*/
@Component(service = ServiceWrapper.class)
public class MBMessageUserLocalServiceWrapper extends UserLocalServiceWrapper {
@Override
public User updateUser(
long userId, String oldPassword, String newPassword1,
String newPassword2, boolean passwordReset,
String reminderQueryQuestion, String reminderQueryAnswer,
String screenName, String emailAddress, boolean portrait,
byte[] portraitBytes, String languageId, String timeZoneId,
String greeting, String comments, String firstName,
String middleName, String lastName, long prefixListTypeId,
long suffixListTypeId, boolean male, int birthdayMonth,
int birthdayDay, int birthdayYear, String smsSn, String facebookSn,
String jabberSn, String skypeSn, String twitterSn, String jobTitle,
long[] groupIds, long[] organizationIds, long[] roleIds,
List<UserGroupRole> userGroupRoles, long[] userGroupIds,
ServiceContext serviceContext)
throws PortalException {
User user = getUser(userId);
String oldFullName = user.getFullName();
User curUser = super.updateUser(
userId, oldPassword, newPassword1, newPassword2, passwordReset,
reminderQueryQuestion, reminderQueryAnswer, screenName,
emailAddress, portrait, portraitBytes, languageId, timeZoneId,
greeting, comments, firstName, middleName, lastName,
prefixListTypeId, suffixListTypeId, male, birthdayMonth,
birthdayDay, birthdayYear, smsSn, facebookSn, jabberSn, skypeSn,
twitterSn, jobTitle, groupIds, organizationIds, roleIds,
userGroupRoles, userGroupIds, serviceContext);
if (GetterUtil.getBoolean(
PropsUtil.get(
PropsKeys.USERS_UPDATE_USER_NAME +
MBMessage.class.getName())) &&
!oldFullName.equals(curUser.getFullName())) {
_mbMessageLocalService.updateUserName(
userId, curUser.getFullName());
}
return curUser;
}
@Reference
private MBMessageLocalService _mbMessageLocalService;
}