Synyx GmbH & Co. KG Homepage Welcome Guest   | Login
  Search  
  Index  | Recent Threads  | Who's Online  | User List  | Register  | Search  | Help  | RSS feeds
OpenCms 7.0.4 Live-CD available!

Synyx created an OpenCms 7.0.4 Live CD, based on SLAX Linux, which is now available.

If you want to order a free CD copy, please write, including your postal address, to



Quick Go »
Thread Status: Normal
Total posts in this thread: 6
[Add To My Favorites] [Watch this Thread] [Post new Thread]
Author
Previous Thread This topic has been viewed 141 times and has 5 replies Next Thread
Male frafra
Stranger



Joined: Jul 15, 2010
Posts: 14
Status: Offline

about CmsDbContext Reply to this Post
Reply with Quote

Hello.
I'd like to use createUser of CmsUserDriver.
I don't know why I have a nullpointer exception for the parameter
CmsDbContext cdb = new CmsDbContext();

this is my code:

CmsUser cms_first = new CmsUser();
Map info =cms_first.getAdditionalInfo();
CmsUserDriver necms = new CmsUserDriver() ;
String username = "pippo";
String password = "pippo";
String description = "Mr. pippo number one";

String firstname = "pip";
String lastname = "ppo";
String email = "fra@tin.it";
long lastlogin = 0;
int flags = 0;
long dateCreated = cms_first.getDateCreated();

CmsUUID uid = new CmsUUID();
CmsRequestContext crt = cms.getRequestContext();
CmsDbContext cdb = new CmsDbContext(crt );
necms.createUser(cdb, uid, username ,password,firstname, lastname, email, lastlogin, flags, dateCreated , info );

someone can help me?

thank you
[Jul 27, 2010 10:46:18 AM] Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male Flo
Advanced Member
Member's Avatar


Joined: May 7, 2004
Posts: 457
Status: Offline
Re: about CmsDbContext Reply to this Post
Reply with Quote

Why do you want to insert the values manually using CmsUserDriver?
----------------------------------------
/**
* Florian Hopf
* Synyx GmbH & Co. KG
*/
[Jul 27, 2010 10:55:10 AM] Show Printable Version of Post        http://www.synyx.de [Link] Report threatening or abusive post: please login first  Go to top 
Male frafra
Stranger



Joined: Jul 15, 2010
Posts: 14
Status: Offline

Re: about CmsDbContext Reply to this Post
Reply with Quote

because if I use:

String username = "testest";
String password = "654321";
String description = "Mr. test number one";

String configPath = pageContext.getServletContext().getRealPath("/") + "WEB-INF/config/";
CmsConfigurationManager configurationManager = new CmsConfigurationManager(configPath);
CmsUser cmsu = new CmsUser();
Map info =cmsu.getAdditionalInfo();
obj.createUser(username ,password,description ,info);

I can't insert other information like email,firstname o lastname.

how i have to do to insert those values?

for "addWebUser" is the same:

String username = "frafra";
String password = "123456";
String description = "Mr. Cara number one";
String group = "Guests";
CmsUser user = obj.addWebUser(username, password, group, "Web User", new Hashtable() );
obj.writeWebUser(user);

Can you say me how insert other information?
[Jul 27, 2010 11:11:18 AM] Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male frafra
Stranger



Joined: Jul 15, 2010
Posts: 14
Status: Offline

Re: about CmsDbContext Reply to this Post
Reply with Quote

I Need to insert into db users manually.

con you help me?

Now i do Insert but no with some information like email, lastname and so on...

I can only do a classic insert with sql

for example:

stmt.executeUpdate("insert into cms_users values('0000','fra','frafra','asd','qaz','fra@tin.it','0','0','/','0000000')");

But I'd like to know class and method of OpenCms.
[Jul 27, 2010 11:45:41 AM] Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male Flo
Advanced Member
Member's Avatar


Joined: May 7, 2004
Posts: 457
Status: Offline
Re: about CmsDbContext Reply to this Post
Reply with Quote

Hi,

you have to create the user first and then modify it immediately. Try this:


String username = "pippo";
String password = "pippo";
String description = "Mr. pippo number one";
String firstname = "pip";
String lastname = "ppo";
String email = "fra@tin.it";

CmsUser cms_first = cms.createUser(username, password, description, new HashMap());
cms_first.setEmail(email);
cms_first.setLastname(lastname);
cms_first.setFirstname(firstname);

cms.writeUser(cms_first);


HTH
Flo
----------------------------------------
/**
* Florian Hopf
* Synyx GmbH & Co. KG
*/
[Jul 30, 2010 3:08:35 PM] Show Printable Version of Post        http://www.synyx.de [Link] Report threatening or abusive post: please login first  Go to top 
Male frafra
Stranger



Joined: Jul 15, 2010
Posts: 14
Status: Offline

Re: about CmsDbContext Reply to this Post
Reply with Quote

thanks Flo.

really thank you very much.

Ciao,
Fra
[Aug 30, 2010 4:19:52 PM] Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
[Show Printable Version of Thread] [Post new Thread]