Fórumok

Nyitólap » Liferay Portal » English » 3. Development

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
To import users in Liferay Ketkee A 2011. október 12. 3:33
RE: To import users in Liferay Sandeep Nair 2011. október 12. 3:38
RE: To import users in Liferay Ketkee A 2011. október 18. 3:17
RE: To import users in Liferay Ravi Kumar Gupta 2011. október 18. 3:32
RE: To import users in Liferay Hitoshi Ozawa 2011. október 18. 4:53
RE: To import users in Liferay Ketkee A 2011. október 20. 3:16
RE: To import users in Liferay Ketkee A 2011. október 20. 23:13
RE: To import users in Liferay Nisarg Parikh 2011. október 20. 23:31
RE: To import users in Liferay Hitoshi Ozawa 2011. október 21. 5:47
RE: To import users in Liferay Ketkee A 2011. október 24. 4:18
RE: To import users in Liferay Hitoshi Ozawa 2011. október 24. 4:43
RE: To import users in Liferay Ketkee A 2011. október 24. 5:25
RE: To import users in Liferay Hitoshi Ozawa 2011. október 24. 14:22
RE: To import users in Liferay Ketkee A 2011. október 24. 20:17
RE: To import users in Liferay Francois Fournel 2011. október 25. 3:18
RE: To import users in Liferay Hitoshi Ozawa 2011. október 25. 4:21
RE: To import users in Liferay sandeep tripathi 2012. május 30. 1:45
RE: To import users in Liferay Nagendra Kumar Busam 2012. május 30. 3:03
RE: To import users in Liferay Hitoshi Ozawa 2012. május 30. 15:50
RE: To import users in Liferay sandeep tripathi 2012. május 31. 22:23
RE: To import users in Liferay sandeep tripathi 2012. június 1. 3:52
RE: To import users in Liferay Hitoshi Ozawa 2012. június 1. 6:10
RE: To import users in Liferay sandeep tripathi 2012. június 4. 23:24
RE: To import users in Liferay sandeep tripathi 2012. június 6. 2:58
RE: To import users in Liferay sandeep tripathi 2012. június 8. 5:17
RE: To import users in Liferay Elijah Mangason 2012. augusztus 2. 13:40
RE: To import users in Liferay Hitoshi Ozawa 2012. augusztus 2. 14:53
Ketkee A
To import users in Liferay
2011. október 12. 3:33
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

Hi,

I want to import a users in bulk in Liferay database.

when I searched, found links which asks me to import users via LDAP.

but now, I have my users in an Excel sheet. Could you please let me know if there is an API in Liferay which will allow me to pick those users from excel sheet and save in liferay database?
Sandeep Nair
RE: To import users in Liferay
2011. október 12. 3:38
Válasz

Sandeep Nair

Rangsorolás: Liferay Legend

Hozzászólások: 1671

Csatlakozás dátuma: 2008. november 5.

Legújabb hozzászólások

There is no API available. But you can do it via coding. You just have to create a small portlet which reads rows of sheet in which details are there and insert using Liferay's API. The API method is UserLocalServiceUtil.addUser(

For reading the excel sheet you can make use of POI or JExcel.

Regards,
Sandeep
Ketkee A
RE: To import users in Liferay
2011. október 18. 3:17
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

Sorry for late reply.

Thank you Sandeep for your reply.

I have to ask here, that if the Excel is huge, will there be a performance issue reading it? I have used JExcel for the moment. But the excel as I get is huge. So just wanted to know about the performance by JExcel.

Please reply.

Thanks.
--Ketkee
Ravi Kumar Gupta
RE: To import users in Liferay
2011. október 18. 3:32
Válasz

Ravi Kumar Gupta

Rangsorolás: Liferay Legend

Hozzászólások: 1041

Csatlakozás dátuma: 2009. június 23.

Legújabb hozzászólások

I guess loading the users will be one time job so performance issue may not that big.. If you think that while loading into liferay is also time and performance critical.. then break the excel using jExcel or POI and then load those small files.. in that it should not be consuming much memory and processor.

HTH
Hitoshi Ozawa
RE: To import users in Liferay
2011. október 18. 4:53
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

I've made a sample code to upload csv file using web service. This is just a sample code and written to make it easier to read.
I really don't recommend it for production.
http://www.liferay.com/community/wiki/-/wiki/Main/Web+Service+samples

I've only recently developed a portlet to add, delete, modify, and export user data to csv. I'm using supercsv as in the above example.
Ketkee A
RE: To import users in Liferay
2011. október 20. 3:16
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

I would like to know which API to use for inserting user.

I see two methods:

UserLocalServiceUtil.addUser() -- takes in individual parameters, a very long list
UserLocalServiceUtil.addUser() -- takes in User object

The data that I obtained from Excel sheet is only ScreenName, LastName, FirstName, Email Address, PWD and Organization. So going by the first method, rest all fields will be empty. is it okay to insert a user with so many fields empty?

Also, along with the user_ table, what all other tables need to be updated?

Please let me know.
Ketkee A
RE: To import users in Liferay
2011. október 20. 23:13
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

Could anybody please guide me for the specific API to be used for inserting users into Liferay?

Need to know all tables which may be affected and which require entried to be done apart from user_ table.

Please reply soon.

Thanks.
Nisarg Parikh
RE: To import users in Liferay
2011. október 20. 23:31
Válasz

Nisarg Parikh

Rangsorolás: Regular Member

Hozzászólások: 244

Csatlakozás dátuma: 2009. december 30.

Legújabb hozzászólások

Hi Ketkee,

I have used Hitoshi's Web Service API for importing users. It works fine. I have modified it for multiple users.
If you use this API then you don't have to worry about the other tables as Liferay API will take care of it.

Hope that might help you.

-Nisarg
Hitoshi Ozawa
RE: To import users in Liferay
2011. október 21. 5:47
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

I've developed a portlet version and will make it public if my company will permit it. Unfortunately, I haven't internationalized it yet.
I've made the mapping of csv file fields to User class variable into a separate class to make it easier to change the mappings.

The local user method actually modifies several database tables including contact and user roles and user organizations, etc.
You really don't need to specify every fields to add an user.
Ketkee A
RE: To import users in Liferay
2011. október 24. 4:18
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

People,

Could you please tell me what defines the uniqueness of a Liferay User? I mean which attribute?

is there a single attribute which is unique for the User or multiple attributes?

I was using Liferay API search method to find if a user exists, and put andsearch as true. Please advise on this.

Thanks.
--Ketkee
Hitoshi Ozawa
RE: To import users in Liferay
2011. október 24. 4:43
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

If you look at the database table users_ or at service.xml file, you can find which fields are unique.
Off the top of my head, userId, screen name and email address are unique.
Ketkee A
RE: To import users in Liferay
2011. október 24. 5:25
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

Does that mean that EITHER "Screen Name" OR "Email address" can be picked up to identify teh user as unique?

or both of them as a combination is unique?

--Ketkee
Hitoshi Ozawa
RE: To import users in Liferay
2011. október 24. 14:22
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

Have you looked at the methods in UserLocalServiceUtil?
Check if a method is returning a User object or a List. It seems it's companyId + screenName that's unique.
(companyId can be thought of as Liferay instance.)

e.g.
public static com.liferay.portal.model.User getUserByContactId(
long contactId)

public static com.liferay.portal.model.User getUserByEmailAddress(
long companyId, java.lang.String emailAddress)

public static com.liferay.portal.model.User getUserByFacebookId(
long companyId, long facebookId)

public static com.liferay.portal.model.User getUserById(long companyId,
long userId)

public static com.liferay.portal.model.User getUserByScreenName(
long companyId, java.lang.String screenName)
Ketkee A
RE: To import users in Liferay
2011. október 24. 20:17
Válasz

Ketkee A

Rangsorolás: Junior Member

Hozzászólások: 77

Csatlakozás dátuma: 2011. március 10.

Legújabb hozzászólások

Hitoshi,

Thank you for your reply.

I checked the methods of UserLocalServiceUtil class and I was looking for searchcount and search methods. These methods return and int count (count of users) and an User object respectively.

The methods are:
UserLocalServiceUtil.search(companyId, firstName, middleName, lastName, screenName, emailAddress, active, params, andSearch, start, end, sort)

UserLocalServiceUtil.searchCount(companyId, firstName, middleName, lastName, screenName, emailAddress, active, params, andSearch)

I thought that the search or the searchCount methods would give me results which would help me identify whether the user I am going to insert exists already in Liferay database or not.

But as mentioned by you, would getUserBy* methods be more appropriate?

Please let me know.

Thanks.
--Ketkee
Francois Fournel
RE: To import users in Liferay
2011. október 25. 3:18
Válasz

Francois Fournel

Rangsorolás: Junior Member

Hozzászólások: 99

Csatlakozás dátuma: 2010. április 15.

Legújabb hozzászólások

Have a look at the sample code By Manish Kumar Gupta here :

http://www.liferay.com/community/forums/-/message_boards/message/2625709
Hitoshi Ozawa
RE: To import users in Liferay
2011. október 25. 4:21
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

I'm assuming most of the users in the csv files do not already exist in the database, so I'm just doing an add
and catching and looking for duplicate errors. On duplicates, I'm just doing an update.
sandeep tripathi
RE: To import users in Liferay
2012. május 30. 1:45
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

Hi Hitoshi ,

i had try to import user in liferay using the liferay-wstools_20110119 that u had shared , i was able to create organisation ,but was not able to create user in liferay i had modified the code of importing user but it give a error unauthorized and user is not created.

i had attach by code which i had modify .
Mellékletek: UserInfo.java (7,3k), UsersImport.java (3,9k), users1.csv (0,3k)
Nagendra Kumar Busam
RE: To import users in Liferay
2012. május 30. 3:03
Válasz

Nagendra Kumar Busam

Rangsorolás: Liferay Master

Hozzászólások: 567

Csatlakozás dátuma: 2009. július 7.

Legújabb hozzászólások

what is the liferay version you are using? Might be method signature might have changed - check it out
Hitoshi Ozawa
RE: To import users in Liferay
2012. május 30. 15:50
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

If you're using with Liferay 6.1.0, please get the latest version:liferay-wstools_6.1.0GA1_20120523.zip


http://www.liferay.com/community/wiki?p_p_id=36&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_count=1&_36_struts_action=%2Fwiki%2Fview_page_attachments&p_r_p_185834411_nodeName=Main&p_r_p_185834411_title=Web+Service+samples
sandeep tripathi
RE: To import users in Liferay
2012. május 31. 22:23
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

Hi

sorry for the late reply i am using Liferay Community Edition 6.0.5 CE
sandeep tripathi
RE: To import users in Liferay
2012. június 1. 3:52
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

hi
unauthorized error is solved the ws-setting was wrong i corrected it now there is not data format issue ,
now i am getting java.rmi.RemoteException when i use adduser method signature as

UserSoap usoap= soap.addUser(userInfo.getCompanyId(), userInfo.getAutoPassword(),userInfo.getPassword(),userInfo.getPassword(), userInfo.getAutoScreenName(), userInfo.getScreenName(),userInfo.getEmailAddress(),userInfo.getFacebookId(),userInfo.getOpenId(),userInfo.getLocale(),userInfo.getFirstName(),userInfo.getMiddleName(),userInfo.getLastName(),userInfo.getPrefixId(),userInfo.getSuffixId(),userInfo.getMale(),userInfo.getBirthdayMonth(),userInfo.getBirthdayDay(),userInfo.getBirthdayYear(), userInfo.getJobTitle(),userInfo.getGroupIds(),userInfo.getOrganizationIds(),userInfo.getRoleIds(),userInfo.getUserGroupIds(),userInfo.getSendEmail(),null,null,null,null,null,serviceContext);

and get java.rmi.RemoteException could not exceute jdbc batch update when i use adduser method signature as


UserSoap usoap= soap.addUser(userInfo.getCompanyId(), userInfo.getAutoPassword(),userInfo.getPassword(),userInfo.getPassword(), userInfo.getAutoScreenName(), userInfo.getScreenName(),userInfo.getEmailAddress(),userInfo.getFacebookId(),userInfo.getOpenId(),userInfo.getLocale(),userInfo.getFirstName(),userInfo.getMiddleName(),userInfo.getLastName(),userInfo.getPrefixId(),userInfo.getSuffixId(),userInfo.getMale(),userInfo.getBirthdayMonth(),userInfo.getBirthdayDay(),userInfo.getBirthdayYear(),userInfo.getJobTitle(),userInfo.getGroupIds(),userInfo.getOrganizationIds(),userInfo.getRoleIds(),userInfo.getUserGroupIds(),userInfo.getSendEmail(),serviceContext);

can any one help me out what is correct adduser method signature use for liferay6.0.5 ce?

Regards
Sandeep
Hitoshi Ozawa
RE: To import users in Liferay
2012. június 1. 6:10
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

sorry for the late reply i am using Liferay Community Edition 6.0.5 CE


Then the previous version able as an attachment to the wiki page should work because I've developed it as an example to my 6.0.5 user.
sandeep tripathi
RE: To import users in Liferay
2012. június 4. 23:24
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

hi
still not able to find what the problem is can anyone please help me out with it.
i had attach my code i am getting
java.rmi.RemoteException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update

regards
Sandeep
Mellékletek: UserInfo.java (7,6k), UsersImport.java (4,0k), users1.csv (0,1k)
sandeep tripathi
RE: To import users in Liferay
2012. június 6. 2:58
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

Hi Hitoshi,

i had downloaded the web service sample once again but it is still showing me the same error while importing user in liferay.
jdbc batch update exception 'incorrect string value for greeting column ' can u say on which file you had made changes because
code of userimport.java is same that i had modified . is there is any other file which u had change

i had also check the the method of userlocalserviceimpl where it set the value of greeting at the time of user creation
String greeting = LanguageUtil.format(locale, "welcome-x", (new StringBuilder(" ")).append(fullName).toString(), false);


pls help!!
sandeep tripathi
RE: To import users in Liferay
2012. június 8. 5:17
Válasz

sandeep tripathi

Rangsorolás: Regular Member

Hozzászólások: 100

Csatlakozás dátuma: 2011. október 19.

Legújabb hozzászólások

finally was able to import user in liferay .

thanks
Elijah Mangason
RE: To import users in Liferay
2012. augusztus 2. 13:40
Válasz

Elijah Mangason

Rangsorolás: Junior Member

Hozzászólások: 64

Csatlakozás dátuma: 2012. május 14.

Legújabb hozzászólások

I'm using the bulk import procedure that Hitoshi wrote to add users to the portal, and it works great. However, the users imported this way are not showing up in the portal's GUI even though they are clearly present in the database. I've also programmatically created teams and assigned some of the imported users to the teams - neither teams nor users are visible when logged into the portal as administrator. Is anyone else seeing this behaviour? Does anyone know why it's happening, and/or how to correct it?
Hitoshi Ozawa
RE: To import users in Liferay
2012. augusztus 2. 14:53
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

Users are not showing up because of the change in specs in liferay 6.1. The "status" is not set to active by default. You'll have to user.setStatus(0); after adding a user.