//The "state" notation seems a little brittle. Should just booleans. State 2 is "false because....".
//Maybe use an additional "messageToUser" string that provides additional information.
int state = 0; //succeed
User user = new User( screenname, firstname, lastname, dob, language,
timezone, email, gender, postcode, openid, password,country );
//Check that the input information elements have valid input ranges.
if( uv.validate( user ) ){
/* update both the user's information and layout information */
//This will encrypt the password as a hash.
boolean succ = UserDBMgr.insertUser( user );
if( succ == true ){
//Note the defaultLayoutData string is actually some non-trivial JSON loaded from
//a file.
UserDBMgr.insertUILayout(new UILayout(user.getScreenname(), defaultLayoutData));
proxystoreKeyAdjust(openid, screenname);
}else{
state = 2; //the user with that screen name has existed.
}
}else{//the user has input invalid information.