public class People_Record
extends java.lang.Object
To Do:
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CONFIGURATION_FILE
The default configuration file.
|
static java.lang.String |
ID
Class Identification
|
Constructor and Description |
---|
People_Record()
Create a new people object using the
DEFAULT_CONFIGURATION_FILE |
People_Record(java.lang.String configuration_file)
Create a new people object using the given configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
Add_To_Group(java.lang.String group_name)
Add the current user to the specified group
|
java.lang.String |
Get_Family_Name()
Get the last name of the user.
|
java.lang.String |
Get_Given_Name()
Get the given name for this user as retrieved from the database.
|
int |
Get_User_ID()
Get the User ID of the User
|
boolean |
Get_User(int user_id)
Retrieve user information from the database for the given user id, calling
this method will initialize the object with user information and allow the
use of the editing methods.
|
boolean |
Get_User(java.lang.String username)
Retrieve user information from the database for the given user id, calling
this method will initialize the object with user information and allow the
use of the editing methods.
|
java.lang.String |
Get_Username()
Get the Username of the user
|
java.util.Vector<java.lang.String> |
Group_Names()
Get the list of possible group names from the database.
|
boolean |
Is_Initialized()
Checks to see if this object has been initialized with information about
a person registered in the People table.
|
boolean |
Is_Member_Of_Group(java.lang.String group_name)
Determine if the user is a member of the specified group
|
java.util.Vector<java.lang.String> |
List_Group_Memberships()
List the groups the current user is a member of
|
static void |
main(java.lang.String[] arguments)
Update/Edit People table records.
|
void |
Remove_From_Group(java.lang.String group_name)
Remove the user from the specified group
|
void |
Reset_Group_Memberships(java.util.Vector<java.lang.String> group_list)
Resets the group memberships of the current user
|
static void |
Usage()
Prints the command line usage syntax.
|
public static final java.lang.String ID
public static final java.lang.String DEFAULT_CONFIGURATION_FILE
public People_Record(java.lang.String configuration_file) throws PIRL.Configuration.Configuration_Exception, PIRL.Database.Database_Exception
configuration_file
- - the configuration to use containing database
connection parametersPIRL.Configuration.Configuration_Exception
- if the configuration file can not be readPIRL.Database.Database_Exception
- if a database connection can not be establishedpublic People_Record() throws PIRL.Configuration.Configuration_Exception, PIRL.Database.Database_Exception
DEFAULT_CONFIGURATION_FILE
PIRL.Configuration.Configuration_Exception
- if the configuration can not be foundPIRL.Database.Database_Exception
- if a database connection can not be established.public boolean Get_User(int user_id) throws PIRL.Database.Database_Exception
user_id
- - an integer ID of a user in the People tabletrue
if information was successfully retrieved from the database for
the input user id, false
otherwise.PIRL.Database.Database_Exception
- if a problem occurs while retrieving user
information from the database.User_Information_Exception
- if no user can be found matching the input
user_idpublic boolean Get_User(java.lang.String username) throws PIRL.Database.Database_Exception
username
- - The username to search for in the USERNAME column in HiCat.true
if information was successfully retrieved from the
database for the input username, false
otherwise.PIRL.Database.Database_Exception
- if a database error occursUser_Information_Exception
- if the user information can't be found.public void Reset_Group_Memberships(java.util.Vector<java.lang.String> group_list) throws PIRL.Database.Database_Exception, User_Information_Exception
group_list
- A vector of strings containing one or more groups the user
should be assigned to.PIRL.Database.Database_Exception
- if a problem occurs while attempting to update the
databaseUser_Information_Exception
- if the object has not been initialized with
user information from the People table in HiCat.public void Add_To_Group(java.lang.String group_name) throws PIRL.Database.Database_Exception, User_Information_Exception
group_name
- - A string containing the group the user should be added toPIRL.Database.Database_Exception
- if a problem occurs updating the databaseUser_Information_Exception
- if the specified group is not a valid group,
or if the class has not been initialized with user information from HiCat.public void Remove_From_Group(java.lang.String group_name) throws PIRL.Database.Database_Exception, User_Information_Exception
group_name
- - the group the user is to be removed fromPIRL.Database.Database_Exception
- if a database error occurs while updating the database.User_Information_Exception
- if the group is unknown, or if the class has
not been initialized with user information from HiCat.public boolean Is_Member_Of_Group(java.lang.String group_name) throws User_Information_Exception
group_name
- - the group to check for membershipUser_Information_Exception
- if the specified group is not known or if
the class has not been initialized with user information from HiCat.public boolean Is_Initialized()
public java.util.Vector<java.lang.String> Group_Names() throws PIRL.Database.Database_Exception
PIRL.Database.Database_Exception
- if the group names can not be retrievedpublic int Get_User_ID()
public java.lang.String Get_Username()
public java.lang.String Get_Given_Name()
public java.lang.String Get_Family_Name()
public java.util.Vector<java.lang.String> List_Group_Memberships()
public static void main(java.lang.String[] arguments)
The command line syntax is described by the Usage
method.
Exit Status Values:
0 - Success 1 - Invalid Command Line Syntax 2 - Configuration Error 3 - Database Error 4 - Incomplete/unknown User information
arguments
- - array of command line argumentsUsage()
public static void Usage()
Usage: HiTList <Options> Options - [-Configuration <filename>] (default: HiCat.conf) [-Add_To_Group <group_name>] [-Group_Memberships] [-Help] [-ID <integer user id>] [-List_Groups] [-Remove_From_Group <group_name>] [-Username <username>] [-Version] Note: if both an ID and a Username is specified, the ID will be used to retrieve information from the database.
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona