Fórum

Import 60.000 users

Gabriel BZ, modificado 13 Anos atrás.

Import 60.000 users

New Member Postagens: 8 Data de Entrada: 09/03/10 Postagens Recentes
Hi,

I need to imnport about 60.000 users from excel. I saw is possible by web service (tunnel-web/axis), but the performance (with SOAP) may not be good.

I know insert directly in database strategy may infer in data consistency cause relations and lucene index will be affected.

What better solution in this case?

thanks!
Eliseu Rocha, modificado 13 Anos atrás.

RE: Import 60.000 users

New Member Postagens: 3 Data de Entrada: 03/11/10 Postagens Recentes
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha
Gabriel BZ, modificado 13 Anos atrás.

RE: Import 60.000 users

New Member Postagens: 8 Data de Entrada: 09/03/10 Postagens Recentes
Hi Eliseu, thanks for reply,

I can do this, i will make a test, but I'm not sure about performance, there are too many users!

[]'s
thumbnail
Peter Shin, modificado 13 Anos atrás.

RE: Import 60.000 users

Regular Member Postagens: 121 Data de Entrada: 24/09/07 Postagens Recentes
regarding performance, this may speed things up a lil

BatchSessionUtil.setEnabled(true);

try {
	// your code here
}
finally {
	BatchSessionUtil.setEnabled(false);
}
Gabriel BZ, modificado 13 Anos atrás.

RE: Import 60.000 users

New Member Postagens: 8 Data de Entrada: 09/03/10 Postagens Recentes
Thanks Peter,

I have imported 40.000 users (120.000 records in database, considering tables contact_, group_ e user_) in 2 hours. I think performance was very good.

[]'s
thumbnail
Ahmed Hasan, modificado 10 Anos atrás.

RE: Import 60.000 users

Expert Postagens: 306 Data de Entrada: 13/04/07 Postagens Recentes
Hi Gabriel,

I am sure you've gone with the WS approach. I liked the portlet approach as it will greatly improve the performance. But since this is a one time activity, you should go ahead writing a simple java program that does this by iterating thru the records of the excel sheet and uploading the user by invoking the web service.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
thumbnail
technology evangelist, modificado 10 Anos atrás.

RE: Import 60.000 users

Junior Member Postagens: 35 Data de Entrada: 02/08/13 Postagens Recentes
Eliseu Rocha:
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha



HI Eliseu Rocha,
Check Below forum post and give suggestion to clear my task

https://www.liferay.com/community/forums/-/message_boards/message/15591927