Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Chinnadurai Duraisami
Hook service to extending userLocalServiceWrapper does not call addUser
January 10, 2013 8:00 AM
Answer

Chinnadurai Duraisami

Rank: New Member

Posts: 20

Join Date: November 28, 2012

Recent Posts

Hi,
I am developing a hook service which extends userLocalServiceWrapper. I am trying to modify addUser method and it never gets called. please find the code.

public class ExtUserLocalService extends UserLocalServiceWrapper {
/* (non-Java-doc)
* @see com.liferay.portal.service.UserLocalServiceWrapper#UserLocalServiceWrapper(UserLocalService userLocalService)
*/
public ExtUserLocalService(UserLocalService userLocalService) {
super(userLocalService);
}

public User getUserById(long userId)
throws PortalException, SystemException {
System.out.println( "## MyUserLocalServiceImpl.getUserById(" + userId + ")");
return super.getUserById(userId);
}

public User addUser(long creatorUserId, long companyId,
boolean autoPassword, String password1, String password2,
boolean autoScreenName, String screenName, String emailAddress,
long facebookId, String openId, Locale locale, String firstName,
String middleName, String lastName, int prefixId, int suffixId,
boolean male, int birthdayMonth, int birthdayDay, int birthdayYear,
String jobTitle, long[] groupIds, long[] organizationIds,
long[] roleIds, long[] userGroupIds, boolean sendEmail,
ServiceContext serviceContext) throws PortalException,
SystemException {

System.out.println("add user");

User user = super.addUser(creatorUserId, companyId, autoPassword, password1,
password2, autoScreenName, screenName, emailAddress, facebookId,
openId, locale, firstName, middleName, lastName, prefixId, suffixId,
male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds,
organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);

return user;
}

}

It seems this public User addUser(long creatorUserId, long companyId,... method is not getting called. System.out.println("add user") never gets printed, but public User getUserById(long userId) gets called and prints "## MyUserLocalServiceImpl.getUserById(" + userId + ")" in console.

this is the liferay-hook.xml
<hook>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
<service>
<service-type>com.liferay.portal.service.UserLocalService</service-type>
<service-impl>com.test.service.ExtUserLocalService</service-impl>
</service>
</hook>

I am using liferay-portal-6.1.1-ce-ga2 & liferay-plugins-sdk-6.1.1. Can someone please help me. It is really frustrating somuch.
S P
RE: Hook service to extending userLocalServiceWrapper does not call addUser
January 11, 2013 3:20 AM
Answer

S P

Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Hi,
could you please message which server you are trying to deploy.
I had faced similiar issue in weblogic so i have fixed the issue using proper deployment setup.
Akram MONCER
RE: Hook service to extending userLocalServiceWrapper does not call addUser
January 11, 2013 6:00 AM
Answer

Akram MONCER

Rank: Regular Member

Posts: 106

Join Date: September 25, 2012

Recent Posts

hi try to override this method "addUserWithWorkflow" i think it called while adding new user in liferay
Chinnadurai Duraisami
RE: Hook service to extending userLocalServiceWrapper does not call addUser
January 11, 2013 7:01 AM
Answer

Chinnadurai Duraisami

Rank: New Member

Posts: 20

Join Date: November 28, 2012

Recent Posts

I am using tomcat-7.0.27. I tried overriding addUserWithWorkFlow(), this is what getting called during user registration. How to get custom fields data from create_account page and update in user data?.

thanks for your suggestion.