UserMenu Class Reference

#include <UserMenu.h>

Collaboration diagram for UserMenu:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UserMenu ()
 ~UserMenu ()
void mainMenu ()
 Displays the main menu: user is allowed to login into the system, register himself as new user or quit the application.
bool login ()
 Ask user to enter his crendentials and test the access: if successful, an instance of User is allocated and assigned to _currentUser.
void display () throw (BadAuthException)
 Display a menu to the screen, according to authorization level of current user.
void registerNewUser ()
 Give the user the opportunity to register as new user.

Private Member Functions

void browseProductCatalog () throw (BadAuthException)
 Browse product catalog by category.
void showProductDetail () throw (BadAuthException)
void showConfigurationByProduct () throw (BadAuthException)
void showUserProfile () throw (BadAuthException)
void placeNewOrder () throw (BadAuthException)
void addNewCategory () throw (BadAuthException)
 Admin operation to create a new category of products.
void addNewProduct () throw (BadAuthException)
void changeProductDetail () throw (BadAuthException)
void disableUser () throw (BadAuthException)
 Admin operation to disable a registered user.
void displayMonthlyTrend () throw (BadAuthException)
 Admin operation to display monthly trend of sales.
void displayUnprivilegedMenu () throw (BadAuthException)
void displayAdminMenu () throw (BadAuthException)
void wait ()
 Wait for user to press enter/return to continue.
bool getNotEmptyLine (const char *msg, char **buffer, int len, const char *end)

Private Attributes

User_currentUser
map< int, opusr_operations
map< int, opadm_operations

Constructor & Destructor Documentation

UserMenu::UserMenu (  ) 
UserMenu::~UserMenu (  ) 

References _currentUser, and LOG_DTOR.


Member Function Documentation

void UserMenu::addNewCategory (  )  throw (BadAuthException) [private]

Admin operation to create a new category of products.

Exceptions:
BadAuthException If called without being authenticated

References _currentUser, CLEAR_SCREEN_CMD, Category::factory(), ManagedObject::store(), and wait().

Referenced by UserMenu().

void UserMenu::addNewProduct (  )  throw (BadAuthException) [private]
void UserMenu::browseProductCatalog (  )  throw (BadAuthException) [private]

Browse product catalog by category.

(All categories could be listed at the same time)

Exceptions:
BadAuthException If called without being authenticated

References _currentUser, ProductProxy::catalog(), Category::catalog(), CLEAR_SCREEN_CMD, ProductProxy::getCategory(), ProductProxy::getName(), ProductProxy::uniqueID(), and wait().

Referenced by changeProductDetail(), placeNewOrder(), showProductDetail(), and UserMenu().

void UserMenu::changeProductDetail (  )  throw (BadAuthException) [private]
void UserMenu::disableUser (  )  throw (BadAuthException) [private]

Admin operation to disable a registered user.

Exceptions:
BadAuthException If called without being authenticated or not authorized

References _currentUser, AdminUser::changeUserPassword(), CLEAR_SCREEN_CMD, User::fullName(), AdminUser::userList(), and wait().

Referenced by UserMenu().

void UserMenu::display (  )  throw (BadAuthException)

Display a menu to the screen, according to authorization level of current user.

Exceptions:
BadAuthException If called by client programmer without any logged user

References _currentUser, displayAdminMenu(), displayUnprivilegedMenu(), and User::isAdmin().

Referenced by mainMenu().

void UserMenu::displayAdminMenu (  )  throw (BadAuthException) [private]

References _currentUser, adm_operations, and CLEAR_SCREEN_CMD.

Referenced by display().

void UserMenu::displayMonthlyTrend (  )  throw (BadAuthException) [private]

Admin operation to display monthly trend of sales.

Exceptions:
BadAuthException If called without being authenticated or not authorized

References _currentUser, CLEAR_SCREEN_CMD, AdminUser::showMonthlyTrend(), and wait().

Referenced by UserMenu().

void UserMenu::displayUnprivilegedMenu (  )  throw (BadAuthException) [private]

References _currentUser, CLEAR_SCREEN_CMD, and usr_operations.

Referenced by display().

bool UserMenu::getNotEmptyLine ( const char *  msg,
char **  buffer,
int  len,
const char *  end 
) [private]

Referenced by registerNewUser().

bool UserMenu::login (  ) 

Ask user to enter his crendentials and test the access: if successful, an instance of User is allocated and assigned to _currentUser.

Returns:
True if user logged in successfully (credentials were valid).

References _currentUser, CLEAR_SCREEN_CMD, User::login(), and wait().

Referenced by mainMenu(), and registerNewUser().

void UserMenu::mainMenu (  ) 

Displays the main menu: user is allowed to login into the system, register himself as new user or quit the application.

References CLEAR_SCREEN_CMD, display(), login(), and registerNewUser().

Referenced by main().

void UserMenu::placeNewOrder (  )  throw (BadAuthException) [private]
void UserMenu::registerNewUser (  ) 

Give the user the opportunity to register as new user.

References CLEAR_SCREEN_CMD, User::factory(), getNotEmptyLine(), login(), and wait().

Referenced by mainMenu().

void UserMenu::showConfigurationByProduct (  )  throw (BadAuthException) [private]
void UserMenu::showProductDetail (  )  throw (BadAuthException) [private]
void UserMenu::showUserProfile (  )  throw (BadAuthException) [private]
void UserMenu::wait (  )  [private]

Member Data Documentation

map<int, op> UserMenu::adm_operations [private]

Referenced by displayAdminMenu(), and UserMenu().

map<int, op> UserMenu::usr_operations [private]

The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2