Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Sascha Jackson
Add approx. 100 users to liferay in about one rush...
24 de abril de 2007 23:04
Respuesta

Sascha Jackson

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Dear guys,

at the moment I'm evaluating liferay for our university...

Now I wonder if there's a way to add 100 users in like a scripting kind of way. I have those users in a xls-File. It's no prob to code the java class to read out the data. But how is it possible then to add those users to liferay (without accessing the database directly).

Greetz and thank you.
Jorge Ferrer
RE: Add approx. 100 users to liferay in about one rush...
26 de abril de 2007 11:34
Respuesta

Jorge Ferrer

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 2749

Fecha de incorporación: 31 de agosto de 2006

Mensajes recientes

Hi Sascha,

You can use the Liferay Service to do that. If you are accessing a running portal remotely you can user UserServiceHttp from a local class that reads the XLS file and invokes addUser (and optionally updateUser) for each user.
Suresh Nimmakayala
RE: Add approx. 100 users to liferay in about one rush...
16 de agosto de 2007 21:52
Respuesta

Suresh Nimmakayala

Ranking: Liferay Master

Mensajes: 558

Fecha de incorporación: 17 de agosto de 2004

Mensajes recientes

i am trying to add users using


String URL = "http://localhost";
HttpPrincipal httpPrincipal = new HttpPrincipal(URL, "liferay.com.1", "XXXXX");


1UserServiceHttp.addUser(HttpPrincipal httpPrincipal, java.lang.String companyId, boolean autoUserId, java.lang.String userId, boolean autoPassword, java.lang.String password1, java.lang.String password2, boolean passwordReset, java.lang.String emailAddress, java.util.Locale locale, java.lang.String firstName, java.lang.String middleName, java.lang.String lastName, java.lang.String nickName, java.lang.String prefixId, java.lang.String suffixId, boolean male, int birthdayMonth, int birthdayDay, int birthdayYear, java.lang.String jobTitle, java.lang.String organizationId, java.lang.String locationId);


i am getting error like this


04:44:11,011 ERROR RuntimeException in method: public abstract com.liferay.portal.model.User com.liferay.portal.service.UserLocalService.addUser(java.lang.String,java.lang.String,boolean,java.lang.String,boolean,java.lang.String,java.lang.String,boolean,java.lang.String,java.util.Locale,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,java.lang.String,java.lang.String,java.lang.String,boolean) throws com.liferay.portal.SystemException,com.liferay.portal.PortalException:
java.lang.NullPointerException
04:44:11,012 ERROR EJBException in method: public abstract com.liferay.portal.model.User com.liferay.portal.service.UserService.addUser(java.lang.String,boolean,java.lang.String,boolean,java.lang.String,java.lang.String,boolean,java.lang.String,java.util.Locale,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,java.lang.String,java.lang.String,java.lang.String) throws com.liferay.portal.SystemException,com.liferay.portal.PortalException,java.rmi.RemoteException, causedBy:
java.lang.NullPointerException
04:44:11,012 ERROR java.lang.reflect.InvocationTargetException
04:44:11,012 ERROR at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
04:44:11,012 ERROR at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
04:44:11,012 ERROR at java.lang.reflect.Method.invoke(Method.java:585)
04:44:11,012 ERROR at com.liferay.portal.kernel.util.MethodInvoker.invoke(MethodInvoker.java:150)
04:44:11,012 ERROR at com.liferay.portal.kernel.util.MethodInvoker.invoke(MethodInvoker.java:47)
04:44:11,012 ERROR at com.liferay.portal.servlet.TunnelServlet.doPost(TunnelServlet.java:91)
04:44:11,012 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
04:44:11,013 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
04:44:11,013 ERROR at com.liferay.portal.kernel.servlet.PortalServletWrapper.service(PortalServletWrapper.java:88)
04:44:11,013 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.jsr77.Jsr77Filter.doFilter(Jsr77Filter.java:77)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
04:44:11,013 ERROR at com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:143)
04:44:11,013 ERROR at com.liferay.portal.kernel.servlet.PortalFilterWrapper.doFilter(PortalFilterWrapper.java:80)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
04:44:11,013 ERROR at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
04:44:11,013 ERROR at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
04:44:11,013 ERROR at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
04:44:11,013 ERROR at org.mortbay.http.HttpServer.service(HttpServer.java:909)
04:44:11,013 ERROR at org.jboss.jetty.Jetty.service(Jetty.java:456)
04:44:11,013 ERROR at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
04:44:11,013 ERROR at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
04:44:11,013 ERROR at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
04:44:11,013 ERROR at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
04:44:11,013 ERROR at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
04:44:11,013 ERROR at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
04:44:11,014 ERROR Caused by: java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: RuntimeException
04:44:11,014 ERROR at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
04:44:11,014 ERROR at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
04:44:11,014 ERROR at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
04:44:11,014 ERROR at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
04:44:11,014 ERROR at org.jboss.ejb.Container.invoke(Container.java:954)
04:44:11,014 ERROR at sun.reflect.GeneratedMethodAccessor218.invoke(Unknown Source)
04:44:11,014 ERROR at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
04:44:11,014 ERROR at java.lang.reflect.Method.invoke(Method.java:585)
04:44:11,014 ERROR at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
04:44:11,014 ERROR at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
04:44:11,014 ERROR at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
04:44:11,014 ERROR at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
04:44:11,014 ERROR at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
04:44:11,014 ERROR at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
04:44:11,014 ERROR at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
04:44:11,014 ERROR at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
04:44:11,014 ERROR at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
04:44:11,015 ERROR at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
04:44:11,015 ERROR at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
04:44:11,015 ERROR at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
04:44:11,015 ERROR at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
04:44:11,015 ERROR at $Proxy311.addUser(Unknown Source)

Michal Fleischhans
RE: Add approx. 100 users to liferay in about one rush...
17 de agosto de 2007 1:00
Respuesta

Michal Fleischhans

Ranking: New Member

Mensajes: 11

Fecha de incorporación: 14 de febrero de 2007

Mensajes recientes

Sascha Jackson:
Dear guys,

at the moment I'm evaluating liferay for our university...

Now I wonder if there's a way to add 100 users in like a scripting kind of way. I have those users in a xls-File. It's no prob to code the java class to read out the data. But how is it possible then to add those users to liferay (without accessing the database directly).

Greetz and thank you.


Hi Sascha,
you can use liferay api to do that, but I wouldn't do so. Using liferay api you make your application portal dependent. I would use LDAP as an enterprise identity standard. You can fill it up programatically and liferay synchronizes with it. Another advantage is, that the same LDAP can be used in the future for another services like email, jabber, .......... and you still have your users at one place. I have portal with 30.000 users and this was the only way I considered.

sincerelly Michal
Jorge Ferrer
RE: Add approx. 100 users to liferay in about one rush...
24 de agosto de 2007 10:23
Respuesta

Jorge Ferrer

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 2749

Fecha de incorporación: 31 de agosto de 2006

Mensajes recientes

Hi Soori,

You have to authenticate as an admin user to be able to add new users. Use HTTP basic auth for example doing:

1
2String URL = "http://user:passwd@localhost";


edit (Aug28th): I was missing the '@' sign in the above sample URL.
Richard Sezov
RE: Add approx. 100 users to liferay in about one rush...
23 de agosto de 2007 13:57
Respuesta

Richard Sezov

LIFERAY STAFF

Ranking: Regular Member

Mensajes: 196

Fecha de incorporación: 7 de febrero de 2007

Mensajes recientes

I'm importing about 1500 users using Liferay's API and the extension environment. This makes it very easy if you don't have an LDAP infrastructure or don't want to use web services. If you do have an LDAP infrastructure, you can also use it to first import the users into Liferay, and then use Liferay to sync those users over to LDAP (which is how we're using it).

Since my users are coming from a legacy system, I can get them out of a different database. So once I've done that, there are basically two calls: one adds the Organization the users belong to, and then I loop through the user list and add all the users to that Organization.

Here are the two relevant calls:

1
2myOrg = OrganizationLocalServiceUtil.addOrganization(userId,                        parentOrg, "My Organization",                        regionId.longValue(), countryId.longValue(), 12017,                        false);


This code adds the Organization to Liferay's database. It returns an Organization object which holds all of the data about that organization, including the newly generated Organization ID.

1
2lrUser = UserLocalServiceUtil.addUser(userId,
3    companyId, false, "password", "password", true,
4    "", email, themeDisplay.getLocale(), firstName, "",
5    lastName, 0, 0, true,1, 1, 1970, "", nbmeOrg.getOrganizationId(), 0, false);


This code inserts the new user into Liferay.

Hope this helps!
Suresh Nimmakayala
RE: Add approx. 100 users to liferay in about one rush...
24 de agosto de 2007 18:57
Respuesta

Suresh Nimmakayala

Ranking: Liferay Master

Mensajes: 558

Fecha de incorporación: 17 de agosto de 2004

Mensajes recientes

That worked Jorge
Cheers Once again
Nagakiran Muddana
RE: Add approx. 100 users to liferay in about one rush...
20 de septiembre de 2010 12:43
Respuesta

Nagakiran Muddana

Ranking: New Member

Mensajes: 2

Fecha de incorporación: 14 de septiembre de 2010

Mensajes recientes

Hi Richard,
I am looking for the data load with life ray API.
Can you please share the procedure that you have done to accomplish the same.

Thanks in advance,
Nagakiran.
Richard Sezov
RE: Add approx. 100 users to liferay in about one rush...
22 de septiembre de 2010 13:07
Respuesta

Richard Sezov

LIFERAY STAFF

Ranking: Regular Member

Mensajes: 196

Fecha de incorporación: 7 de febrero de 2007

Mensajes recientes

Hi Nagakiran,

Wow, this post is over three years old, and was written before I was employed by Liferay (but I was using Liferay at my previous employer). Though the method call has likely changed from what I wrote above, the procedure will be the same. You'll want to use the API call UserLocalServiceUtil.addUser(...) to add users to Liferay. Of course, nowadays, it's best to do this with a portlet rather than with an Ext plugin. Otherwise, the procedure is the same:

1. Grab your users from wherever you're storing them (database, file, etc.).

2. Loop through them and add them to Liferay using the single call to UserLocalServiceUtil.addUser.

Unless I'm not understanding your question correctly, that's all there is to it.

--Rich
Kevin Britton
RE: Add approx. 100 users to liferay in about one rush...
23 de septiembre de 2010 13:33
Respuesta

Kevin Britton

Ranking: New Member

Mensajes: 9

Fecha de incorporación: 13 de septiembre de 2010

Mensajes recientes

Richard Sezov:
Hi Nagakiran,

Wow, this post is over three years old, and was written before I was employed by Liferay (but I was using Liferay at my previous employer). Though the method call has likely changed from what I wrote above, the procedure will be the same. You'll want to use the API call UserLocalServiceUtil.addUser(...) to add users to Liferay. Of course, nowadays, it's best to do this with a portlet rather than with an Ext plugin. Otherwise, the procedure is the same:

1. Grab your users from wherever you're storing them (database, file, etc.).

2. Loop through them and add them to Liferay using the single call to UserLocalServiceUtil.addUser.

Unless I'm not understanding your question correctly, that's all there is to it.

--Rich


Speaking for myself, thanks for resurrecting this thread!

I'm a newbie to LifeRay (v6.0), and looking to port over users from a legacy (homemade) system. I'm not a Java developer -- most of my programming background is in PHP. If I were approaching this in PHP, I'd query my list of users, loop through and create new INPUT queries in the right format. But LifeRay is a ton more complex than that, and I get the impression that wouldn't work 'atall.

I understand the concepts behind the steps you list above, but I'm stuck at step 1 when it comes to implementing it via the API. I've looked through a TON of posts on here for advice on a variety of topics, and I keep seeing references to the API, but all seem to require a certain pre-knowledge in how to invoke it. Is there a starter document I'm missing?

Once I get the users ported over, I'm confident in my abilities to navigate the GUI and build our site. But at this point, the API seems quite intimidating. Any pointers or links to documentation for API beginners you can provide would be helpful.

Thanks!

~KB
Paul Butenko
RE: Add approx. 100 users to liferay in about one rush...
13 de septiembre de 2012 5:36
Respuesta

Paul Butenko

Ranking: Junior Member

Mensajes: 38

Fecha de incorporación: 1 de julio de 2010

Mensajes recientes

Hello,
User import can be done by using UserLocalServiceUtil.
In short you can read some CSV file wich contains user's data and then store it to liferray.
Here you can find more detailed information.

BR,
Paul