4

I am aware that liferay concatenates the firstname with lastname for the username fields example the one found in table contact.

I need the username to be > 75 characters long (which is the default column length) as the first name and last name have to be at <= 40 characters long.

I tried to manually increase the column width but I get exceptions that another column related to length is too short. I am aware of the portal-model-hints.xml file to resize a column for example, but I am sure there is a better way to modify all the columns at one go.

Thanks.

cachiama
  • 590
  • 3
  • 19

3 Answers3

2

This should help you. Altering the DB once set up is done and adding a hook to change the validation logic. Refer the link provided.

Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
1

I believe you need to create EXT for this.

Please follow below steps to make changes.

1.Create file named as ext-model-hints.xml and put it into "ext-impl/src/META-INF/" folder of EXT.

2.Make the entry as mentioned below

   <model name="Fully Qualified path of Model">
       <field name="column name" type="String">
           <hint name="max-length">200</hint>
       </field>
   </model>
  1. deploy the EXT and restart the server.Changes should reflect.
Gautam
  • 3,276
  • 4
  • 31
  • 53
0

I wrote a FullNameGenerator and a ScreenNameGenerator to bypass the issue and set them to their respective factories via liferay's reflection utilities (PortalClassInvoker) as some portal classes are hidden due to some classloader restrictions.

cachiama
  • 590
  • 3
  • 19