掲示板

How to override LayoutImpl in liferay 7?

thumbnail
7年前 に Abhishek Jain によって更新されました。

How to override LayoutImpl in liferay 7?

Regular Member 投稿: 226 参加年月日: 16/08/20 最新の投稿
I want to override methods of LayoutImpl in liferay 7. I tried with service wrapper but there is no option for this class in the Service Name category. So please help me to override the same. How can I achieve that? Do I need ModelListener for this? Any help would be appreciated..thanx in advance..
thumbnail
7年前 に Olaf Kock によって更新されました。

RE: How to override LayoutImpl in liferay 7?

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Abhishek Jain:
I want to override methods of LayoutImpl in liferay 7. I tried with service wrapper but there is no option for this class in the Service Name category. So please help me to override the same. How can I achieve that? Do I need ModelListener for this? Any help would be appreciated..thanx in advance..


It would help to know what you actually want to achieve with this. There might be a better solution
thumbnail
7年前 に Abhishek Jain によって更新されました。

RE: How to override LayoutImpl in liferay 7?

Regular Member 投稿: 226 参加年月日: 16/08/20 最新の投稿
I want to make a custom screen name validator so that the symbols '@' and '&' are acceptable. For this, I tried making a hook for UserLocalServiceImpl using service wrapper to override validate() method but as it is protected I can't override this method. So I have to find another approach. I just want to override validateFriendlyUrl() method of class LayoutImpl so that the error "The screen name must produce a valid friendly url" does not come on saving the newly created user with screen name containing '&' and '@' characters. I also tried with overriding users.screen.name.special.characters property in the portal-ext.properties. But the above mentioned error regarding friendly url comes. Thats why I am taking this approach. I also think that this is not a healthy approach for screen name validation. Can you suggest me with some other approach. And thanks for your reply.. emoticon
thumbnail
7年前 に Olaf Kock によって更新されました。

RE: How to override LayoutImpl in liferay 7?

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Abhishek Jain:
I want to make a custom screen name validator so that the symbols '@' and '&' are acceptable.


As the screen name is specifically used to be part of the URL of the user's personal site, using characters that have special meanings in URLs is a recipe for disaster. IMHO it's not worth the effort, my prediction is that you'll run into issues not sooner or later, but sooner and later (and even later) with assumptions that the screenname doesn't need to be URL escaped (or will need to be).

If you have a customer who is willing to accept a very high price (in terms of these future issues that will need to be fixed): Go ahead and try. I'd let the business team know that these two additional accepted letters in the screen name are extremely expensive. Have the business side approve your budget. Otherwise trust that the infrastructure decision (Liferay's) to omit these characters has been done to make your life easier. I don't see a very high business value in these characters in the screen name, thus I guess nobody tried it yet.
thumbnail
7年前 に Jaydip Lakhatariya によって更新されました。

RE: How to override LayoutImpl in liferay 7?

Junior Member 投稿: 53 参加年月日: 13/04/18 最新の投稿
Hi Abhishek,

Based on your requirement I understand that you need validation against screen name which will not accept '&' and '@'. Let me know if I misunderstood anything.

You can achieve it through various ways like:
  • Override addUser/update method UserLocalService through hook and validate it before saving it to database.
  • Override createAccount jsp through hook and place javascript validation to avoid insertion of these characters.

Hope this helps !

Regards,
Jaydip