Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Chinnadurai Duraisami
Service hook for extending userLocalServiceWrapper not working for addUser
January 10, 2013 8:46 AM
Answer

Chinnadurai Duraisami

Rank: New Member

Posts: 20

Join Date: November 28, 2012

Recent Posts

Can someone help me on this post,

http://www.liferay.com/web/guest/community/forums/-/message_boards/view_message/19104909

regards,
Chinna
Sushil Saini
RE: Service hook for extending userLocalServiceWrapper not working for addU
January 14, 2013 8:13 PM
Answer

Sushil Saini

Rank: Regular Member

Posts: 104

Join Date: July 27, 2011

Recent Posts

Hi Chinna,

I have the following configuration for overriding the addUser method of UserLocalServiceWrapper. And it is working fine for me.

JAVA Code
 1
 2........................................
 3.......................................
 4public class CustomUserLocalService extends UserLocalServiceWrapper {
 5
 6...............................................
 7...............................................
 8
 9    public CustomUserLocalService (UserLocalService userLocalService) {
10        super(userLocalService);
11    }
12
13    @Override
14    public User addUser(long creatorUserId, long companyId, boolean autoPassword, String password1, String password2,
15            boolean autoScreenName, String screenName, String emailAddress, long facebookId, String openId,
16            Locale locale, String firstName, String middleName, String lastName, int prefixId, int suffixId,
17            boolean male, int birthdayMonth, int birthdayDay, int birthdayYear, String jobTitle, long[] groupIds,
18            long[] organizationIds, long[] roleIds, long[] userGroupIds, boolean sendEmail,
19            ServiceContext serviceContext) throws PortalException, SystemException {
20
21        System.out.println("Add User Method is overriden");
22
23        return super.addUser(creatorUserId, companyId, autoPassword, password1, password2, autoScreenName,
24                sanitisedScreenName, emailAddress, facebookId, openId, locale, firstName, middleName, lastName,
25                prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds,
26                organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
27    }
28...............................................
29...............................................
30}


liferay-hook.xml
 1
 2<?xml version="1.0"?>
 3<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.0.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_0_0.dtd">
 4
 5<hook>
 6    <service>
 7        <service-type>com.liferay.portal.service.UserLocalService</service-type>
 8        <service-impl>com.liferay.portal.service.CustomUserLocalService</service-impl>
 9    </service>
10</hook>


Hope it helps you.

Cheers
Sushil Saini
Chinnadurai Duraisami
RE: Service hook for extending userLocalServiceWrapper not working for addU
January 15, 2013 8:47 AM
Answer

Chinnadurai Duraisami

Rank: New Member

Posts: 20

Join Date: November 28, 2012

Recent Posts

Hi Sushil,
Thanks for your reply.
The addUser(..) method is not getting called for me during user registration. but, addUserWithWorlflow() gets called when you click Save button in user registration page. Could you please explain about your scenario when addUser() method gets called?.

thanks,
Chinna