edu.vt.marian.WebGate
Class user

java.lang.Object
  |
  +--edu.vt.marian.WebGate.user

public class user
extends java.lang.Object

Class name: user Class description: this class represent a marian user an user object can provide many services (more than 30 at this time), many services are provided by it's component classes, but we hide this to the outside and provide a single user concept to them, in this way future changes to the internal implementation are easy to make and will bring no or little effects to classed which use the services provided by this class. Author: Jianxin Zhao Finished time: ????, 1998 Known bugs: none Platform: jdk1.1.5 under UNIX


Constructor Summary
user(java.io.DataInputStream dis, edu.vt.marian.common.Debug debug)
          this constructor will create a user object from a stream, this might be helpful for remote management in the future.
user(java.lang.String dir, edu.vt.marian.common.Debug debug)
          this constructor will create an user object from the specified directory
user(java.lang.String username, java.lang.String full_name, java.lang.String password, java.lang.String userid, java.lang.String dir, edu.vt.marian.common.Debug debug)
          this constructor will create an user object based on the information provided
 
Method Summary
 java.lang.String add_address(java.lang.String type, java.lang.String value)
          this method will add a new address type with the specified value into this object
 java.lang.String add_preference(java.lang.String name, java.lang.String value)
          this method will add the specified preference with the specified value to this user
 java.lang.String add_rate(java.lang.String type, java.lang.String value)
          this method will add the specified rate type with the specified value to the user
 java.lang.String delete_address(java.lang.String type)
          this method will delete the specified address type from this object
 java.lang.String delete_preference(java.lang.String name)
          this method will delete the specified preference from this user
 java.lang.String delete_queries(general_query_data gqd)
          this method will delete all the queries from this object which are matched with the specified query data
 java.lang.String delete_query(java.lang.String query_number)
          this method will delete the query with the specified query number from this user
 java.lang.String delete_rate(java.lang.String type)
          this method will delete the specified rate from the user
 java.lang.String delete()
          this method will delete all the information about this user (not implemented yet)
 java.lang.String deposit(java.lang.String amount)
          this method will deposit the specified amount of money to the user's account
 java.util.Vector get_address_types()
          this method will return all the address types currently in this object
 java.lang.String get_address_value(java.lang.String type)
          this method will return the value of the specified address type
 java.lang.String get_creation_time()
          this method will return the time when this user is created
 java.lang.String get_current_balance()
          this method will return the current balance of the user, at least this is helpful when our client want to see how much money left on his/her account
 java.lang.String get_full_name()
          this method will return the full name of the user
 java.lang.String get_id()
          this method will return the id of this user
 long get_inactive_time()
          this method will return the inactive time of this user object, this is used for memory management -- we need to write user information back to disk when this user object is not accessed for some time
 java.lang.String get_number_queries_after(java.lang.String time)
          this method will return the number of queries the user performed after the specified time
 java.lang.String get_number_queries_before(java.lang.String time)
          this method will return the number of queries the user performed before the specified time
 java.lang.String get_number_queries_between(java.lang.String start_time, java.lang.String end_time)
          this method will return the number of queries the user performed from the start time to the end time
 java.lang.String get_number_queries()
          this method will return the total number of queries performed by this user
 java.lang.String get_number_queries(general_query_data gqd)
          this method will return the number of queries in this object which are matched with the specified query data
 java.lang.String get_overdraft()
          this method will return the overdraft amount allowed to this user
 java.lang.String get_password()
          this method will return the password of this user
 java.util.Vector get_preference_names()
          this method will return all the preference names of this user
 java.lang.String get_preference_value(java.lang.String name)
          this method will return the value of the specified preference of this user
 java.lang.String get_priority()
          this method will get the priority of this user
 java.util.Vector get_queries_after(java.lang.String time)
          this method will return all the queries thew user performed from the specified time to now
 java.util.Vector get_queries_before(java.lang.String time)
          this method will return all the queries the user performed before the specified time
 java.util.Vector get_queries_between(java.lang.String start_time, java.lang.String end_time)
          this method will return all the queries the user performed from the start time to the end time
 java.util.Vector get_queries(general_query_data gqd)
          this method will return all the queries in this object which are matched with the specified query data
 query get_query(java.lang.String query_number)
          this method will return a query of this user, the query is identiofied by the parameter query_number, we use string for it since this allow the queries performed by a user exceed the integer limit (more than 2 billion in java I believe), though this is unlikely.
 java.util.Vector get_rate_types()
          this method will return all the rate types of this user
 java.lang.String get_rate_value(java.lang.String type)
          this method will return the value of the specified type of this user
 java.lang.String get_transaction_history_after(java.lang.String time)
          this method will return the transaction history of yhis user after the specified time
 java.lang.String get_transaction_history_before(java.lang.String time)
          this method will return the transaction history of this user before the specified time
 java.lang.String get_transaction_history_between(java.lang.String start_time, java.lang.String end_time)
          this method will return the transaction history of this user from the start time to the end time
 java.lang.String get_user_name()
          this method will return the name of this user
 void init()
          this method will initialize data members of this object
 java.lang.String is_valid()
          this method will tell whether or not this is a valid user
 java.lang.String save(java.lang.String dir)
          this method will save the information about this user to the specified directory
 java.lang.String set_address(java.lang.String type, java.lang.String value)
          this method will set the specified type of address to the specified value
 java.lang.String set_full_name(java.lang.String full_name)
          this method will set the full name of this user
 java.lang.String set_overdraft(java.lang.String amount)
          this method will set the overdraft value for the user
 java.lang.String set_password(java.lang.String password)
          this method will set the password of this user
 java.lang.String set_preference(java.lang.String name, java.lang.String value)
          this method will set the specified preference with the specified value
 java.lang.String set_priority(java.lang.String priority)
          this method will set the priority of this user
 java.lang.String set_rate(java.lang.String type, java.lang.String value)
          this method will set the specified rate type to the specified value
 java.lang.String submit_query(query_data qd)
          this method will submit a query to the user, the return value is the query number of the query for in user
 java.lang.String to_stream(java.io.DataOutputStream dos)
          this method will print the content of this object to a stream, this might be helpful for remote management in the future.
 java.lang.String unload(long time)
          this method will write most of the user information back to disk if the user object has been inactive for the specified time, this is used for memory management
 java.lang.String withdraw(java.lang.String amount)
          this method will reduce the specified amount of money from the user's account
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

user

public user(java.lang.String username,
            java.lang.String full_name,
            java.lang.String password,
            java.lang.String userid,
            java.lang.String dir,
            edu.vt.marian.common.Debug debug)
this constructor will create an user object based on the information provided

user

public user(java.lang.String dir,
            edu.vt.marian.common.Debug debug)
this constructor will create an user object from the specified directory

user

public user(java.io.DataInputStream dis,
            edu.vt.marian.common.Debug debug)
this constructor will create a user object from a stream, this might be helpful for remote management in the future. (not implemented yet)
Method Detail

delete

public java.lang.String delete()
this method will delete all the information about this user (not implemented yet)

is_valid

public java.lang.String is_valid()
this method will tell whether or not this is a valid user

get_id

public java.lang.String get_id()
this method will return the id of this user

get_user_name

public java.lang.String get_user_name()
this method will return the name of this user

set_password

public java.lang.String set_password(java.lang.String password)
this method will set the password of this user

get_password

public java.lang.String get_password()
this method will return the password of this user

set_full_name

public java.lang.String set_full_name(java.lang.String full_name)
this method will set the full name of this user

get_full_name

public java.lang.String get_full_name()
this method will return the full name of the user

submit_query

public java.lang.String submit_query(query_data qd)
this method will submit a query to the user, the return value is the query number of the query for in user

get_number_queries

public java.lang.String get_number_queries()
this method will return the total number of queries performed by this user

get_number_queries_before

public java.lang.String get_number_queries_before(java.lang.String time)
this method will return the number of queries the user performed before the specified time

get_number_queries_after

public java.lang.String get_number_queries_after(java.lang.String time)
this method will return the number of queries the user performed after the specified time

get_number_queries_between

public java.lang.String get_number_queries_between(java.lang.String start_time,
                                                   java.lang.String end_time)
this method will return the number of queries the user performed from the start time to the end time

get_number_queries

public java.lang.String get_number_queries(general_query_data gqd)
this method will return the number of queries in this object which are matched with the specified query data

get_query

public query get_query(java.lang.String query_number)
this method will return a query of this user, the query is identiofied by the parameter query_number, we use string for it since this allow the queries performed by a user exceed the integer limit (more than 2 billion in java I believe), though this is unlikely.

get_queries_before

public java.util.Vector get_queries_before(java.lang.String time)
this method will return all the queries the user performed before the specified time

get_queries_after

public java.util.Vector get_queries_after(java.lang.String time)
this method will return all the queries thew user performed from the specified time to now

get_queries_between

public java.util.Vector get_queries_between(java.lang.String start_time,
                                            java.lang.String end_time)
this method will return all the queries the user performed from the start time to the end time

get_queries

public java.util.Vector get_queries(general_query_data gqd)
this method will return all the queries in this object which are matched with the specified query data

delete_query

public java.lang.String delete_query(java.lang.String query_number)
this method will delete the query with the specified query number from this user

delete_queries

public java.lang.String delete_queries(general_query_data gqd)
this method will delete all the queries from this object which are matched with the specified query data

get_preference_names

public java.util.Vector get_preference_names()
this method will return all the preference names of this user

get_preference_value

public java.lang.String get_preference_value(java.lang.String name)
this method will return the value of the specified preference of this user

add_preference

public java.lang.String add_preference(java.lang.String name,
                                       java.lang.String value)
this method will add the specified preference with the specified value to this user

set_preference

public java.lang.String set_preference(java.lang.String name,
                                       java.lang.String value)
this method will set the specified preference with the specified value

delete_preference

public java.lang.String delete_preference(java.lang.String name)
this method will delete the specified preference from this user

get_current_balance

public java.lang.String get_current_balance()
this method will return the current balance of the user, at least this is helpful when our client want to see how much money left on his/her account

get_transaction_history_before

public java.lang.String get_transaction_history_before(java.lang.String time)
this method will return the transaction history of this user before the specified time

get_transaction_history_after

public java.lang.String get_transaction_history_after(java.lang.String time)
this method will return the transaction history of yhis user after the specified time

get_transaction_history_between

public java.lang.String get_transaction_history_between(java.lang.String start_time,
                                                        java.lang.String end_time)
this method will return the transaction history of this user from the start time to the end time

deposit

public java.lang.String deposit(java.lang.String amount)
this method will deposit the specified amount of money to the user's account

withdraw

public java.lang.String withdraw(java.lang.String amount)
this method will reduce the specified amount of money from the user's account

get_rate_types

public java.util.Vector get_rate_types()
this method will return all the rate types of this user

add_rate

public java.lang.String add_rate(java.lang.String type,
                                 java.lang.String value)
this method will add the specified rate type with the specified value to the user

set_rate

public java.lang.String set_rate(java.lang.String type,
                                 java.lang.String value)
this method will set the specified rate type to the specified value

delete_rate

public java.lang.String delete_rate(java.lang.String type)
this method will delete the specified rate from the user

get_rate_value

public java.lang.String get_rate_value(java.lang.String type)
this method will return the value of the specified type of this user

set_overdraft

public java.lang.String set_overdraft(java.lang.String amount)
this method will set the overdraft value for the user

get_overdraft

public java.lang.String get_overdraft()
this method will return the overdraft amount allowed to this user

set_priority

public java.lang.String set_priority(java.lang.String priority)
this method will set the priority of this user

get_priority

public java.lang.String get_priority()
this method will get the priority of this user

get_address_types

public java.util.Vector get_address_types()
this method will return all the address types currently in this object

add_address

public java.lang.String add_address(java.lang.String type,
                                    java.lang.String value)
this method will add a new address type with the specified value into this object

set_address

public java.lang.String set_address(java.lang.String type,
                                    java.lang.String value)
this method will set the specified type of address to the specified value

delete_address

public java.lang.String delete_address(java.lang.String type)
this method will delete the specified address type from this object

get_address_value

public java.lang.String get_address_value(java.lang.String type)
this method will return the value of the specified address type

get_creation_time

public java.lang.String get_creation_time()
this method will return the time when this user is created

get_inactive_time

public long get_inactive_time()
this method will return the inactive time of this user object, this is used for memory management -- we need to write user information back to disk when this user object is not accessed for some time

unload

public java.lang.String unload(long time)
this method will write most of the user information back to disk if the user object has been inactive for the specified time, this is used for memory management

to_stream

public java.lang.String to_stream(java.io.DataOutputStream dos)
this method will print the content of this object to a stream, this might be helpful for remote management in the future. (not implemented yet)

save

public java.lang.String save(java.lang.String dir)
this method will save the information about this user to the specified directory

init

public void init()
this method will initialize data members of this object