Fórumok

AdminUtil vs UserLocalServiceUtil

thumbnail
Thomas Berg, módosítva 8 év-val korábban

AdminUtil vs UserLocalServiceUtil

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hi,

I'm overriding the ViewAction of the language portlet by a struts action hook.

In the original ViewAction, the language change is persisted by calling AdminUtil.updateUser(). Since that class is a part of portal-impl.jar I cannot use it in my hook.

Just wondering if there's any special reason why AdminUtil is used instead of UserLocalServiceUtil?

For the record, I'm using the following code to persist the change of language:

user.setLanguageId(languageId);
UserLocalServiceUtil.updateUser(user);
thumbnail
David H Nebinger, módosítva 8 év-val korábban

RE: AdminUtil vs UserLocalServiceUtil

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
The source for the portal is out there so you can check it out yourself...

But it looks to me like it is a convenience method to get some values that are required by the UserLocalServiceUtil.updateUser() method but not required as parameters to AdminUtil.
thumbnail
Thomas Berg, módosítva 8 év-val korábban

RE: AdminUtil vs UserLocalServiceUtil

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Thanks David,
I know that the source is available. However, I don't find it self-explanatory.

Looking at ViewAction, AdminUtil and UserLocalServiceUtil does not give me information about why a call to UserLocalServiceUtil.updateUser(user) is not used in ViewAction since the user object is available.
Perhaps AdminUtil.updateUser() is faster, does not notify listeners and / or does not trigger re-indexing...

Sometimes it would just be nice not having to worry about whether my implementation will cause problems with performance or is not in accordance with best practice.
thumbnail
David H Nebinger, módosítva 8 év-val korábban

RE: AdminUtil vs UserLocalServiceUtil

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
I'm not sure what you're looking at, but the AdminUtil.updateUser() method I'm looking at calls UserServiceUtil.updateUser() so all of the listeners, etc. also get invoked.

As I said, it is just a utility method to simplify the front end coding. For example, AdminUtil.updateUser() does not have any of the parameters for groups, orgs, roles, etc. It just has the simple user stuff and passes null objects/arrays to UserServiceUtil.updateUser().