org.gxos
Class Users

java.lang.Object
  |
  +--org.gxos.Users

public class Users
extends java.lang.Object

Utility class to handle user objects. Also see UserObject and User.

$Id: Users.java,v 1.17 2001/07/19 22:33:12 balsoy Exp $


Field Summary
protected static PersonalInfo impl
          Personal information implementer class.
 
Constructor Summary
Users()
           
 
Method Summary
static UserObject constructUser(UserObject user, java.util.Hashtable values)
          Fills the fields of a user object with values given in a hashtable.
static UserObject constructUser(UserObject user, java.lang.String userID, java.lang.String pwd, java.lang.String name, java.lang.String pres, java.lang.String sufs, java.lang.String email)
          Constructs a user object with given parameters.
static UserObject getUserObject()
          Returns an empty User object which complies with the current UserObject implementation.
static boolean hasEmail(UserObject user, java.lang.String email)
          Checks if a user has the given e-mail address in her email address list.
static java.util.Hashtable returnHashtable(UserObject user)
          Returns a hashtable whose values are retrieved from the given user object.
static boolean securityCheck(UserObject user, java.lang.String password, java.lang.String access)
          Checks if this user is authorized to perform a certain group of tasks.
static void setImplementer(PersonalInfo implementer)
          Changes the default type used for user object creation.
static UserObject updateFromHashtable(UserObject user, java.util.Hashtable values)
          Updates the fields of a user object with values given in a hashtable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

impl

protected static PersonalInfo impl
Personal information implementer class.
Constructor Detail

Users

public Users()
Method Detail

setImplementer

public static void setImplementer(PersonalInfo implementer)
Changes the default type used for user object creation. It affects objects created after the method called.
See Also:
PersonalInfoTypeType

getUserObject

public static UserObject getUserObject()
Returns an empty User object which complies with the current UserObject implementation.
Returns:
a user object whose parameters are not set.

constructUser

public static UserObject constructUser(UserObject user,
                                       java.lang.String userID,
                                       java.lang.String pwd,
                                       java.lang.String name,
                                       java.lang.String pres,
                                       java.lang.String sufs,
                                       java.lang.String email)
Constructs a user object with given parameters. Sets other values to defaults.
Parameters:
user - User object whose personal information will be set.
userID - User identifier for this user
pwd - Password information for this user
name - full name of this user
pres - prefix for the name if any, i.e. Prof Dr. separated space or period.
sufs - suffix for the name if any, i.e. Jr separated space,comma or period.
email - primary e-mail address of this user
Returns:
a user object with all the required fields set. Other fields needs to be set afterwards.

constructUser

public static UserObject constructUser(UserObject user,
                                       java.util.Hashtable values)
Fills the fields of a user object with values given in a hashtable.
Parameters:
user - user object whose personal information will be set.
values - a hashtable with values given as USERID, PASSWORD, FIRSTNAME, MIDNAME, LASTNAME, TITLE, ORGANIZATION, PHONE, USERROLE, USERGROUP, ADDRESS, CITY, STATE, ZIP, FAX, ENEWS, SESSIONKEY, PEMAIL, EMAILS, COUNTRY, PCOUNTRY, PAREA, FCOUNTRY, FAREA.
Returns:
initialized user object.

returnHashtable

public static java.util.Hashtable returnHashtable(UserObject user)
Returns a hashtable whose values are retrieved from the given user object. The following is the keys of the hashtable:
USERID, PASSWORD, FIRSTNAME, MIDNAME, LASTNAME, TITLE, ORGANIZATION, PHONE, USERROLE, USERGROUP, ADDRESS, CITY, STATE, ZIP, FAX, ENEWS, SESSIONKEY, PEMAIL, EMAILS, COUNTRY, PCOUNTRY, PAREA, FCOUNTRY, FAREA.
Parameters:
user - user object whose personal information will be returned.
Returns:
hashtable with above fields.

updateFromHashtable

public static UserObject updateFromHashtable(UserObject user,
                                             java.util.Hashtable values)
                                      throws GxException
Updates the fields of a user object with values given in a hashtable.
Parameters:
user - user object whose personal information will be set.
values - a hashtable with values given as USERID, PASSWORD, FIRSTNAME, MIDNAME, LASTNAME, TITLE, ORGANIZATION, PHONE, USERROLE, USERGROUP, ADDRESS, CITY, STATE, ZIP, FAX, ENEWS, SESSIONKEY, PEMAIL, EMAILS, COUNTRY, PCOUNTRY, PAREA, FCOUNTRY, FAREA.
Returns:
modified user object.
Throws:
GxException - if any error is encountered i.e.
  • user parameter is null
  • user ID of this user object is different than the one in values.
  • any other problem

  • hasEmail

    public static boolean hasEmail(UserObject user,
                                   java.lang.String email)
    Checks if a user has the given e-mail address in her email address list.
    Parameters:
    email - e-mail address of this user.
    Returns:
    true if e-mail address found in address list; false otherwise.

    securityCheck

    public static boolean securityCheck(UserObject user,
                                        java.lang.String password,
                                        java.lang.String access)
    Checks if this user is authorized to perform a certain group of tasks.
    Parameters:
    user - user whose information will be validated.
    password - password which is assigned to this user.
    access - security domain where user tries to access, i.e. account information, meeting information system configuration, user management
    Returns:
    true if this user passes security check; false otherwise.