Foros de discusión

How to override LayoutImpl in liferay 7?

thumbnail
Abhishek Jain, modificado hace 7 años.

How to override LayoutImpl in liferay 7?

Regular Member Mensajes: 226 Fecha de incorporación: 20/08/16 Mensajes recientes
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
Olaf Kock, modificado hace 7 años.

RE: How to override LayoutImpl in liferay 7?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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
Abhishek Jain, modificado hace 7 años.

RE: How to override LayoutImpl in liferay 7?

Regular Member Mensajes: 226 Fecha de incorporación: 20/08/16 Mensajes recientes
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
Olaf Kock, modificado hace 7 años.

RE: How to override LayoutImpl in liferay 7?

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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
Jaydip Lakhatariya, modificado hace 7 años.

RE: How to override LayoutImpl in liferay 7?

Junior Member Mensajes: 53 Fecha de incorporación: 18/04/13 Mensajes recientes
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