jitas.admin
Class GUIHelper

java.lang.Object
  extended by jitas.admin.GUIHelper

public class GUIHelper
extends java.lang.Object

This class acts as an intermediate pathway between the gui (AdminFrame) and jitas.core.Admin

Author:
lsf21 & rle41

Constructor Summary
GUIHelper()
           
 
Method Summary
 void addDomain(int row)
          Called when the add button is pressed in the gui.
 void addDomainToSelectedDomains(java.lang.String domain)
          Adds a domain to the set of domains a new student will have access to.
 void addNewStudent(java.lang.String username, java.lang.String password)
          Creates a new student with all domains from previous calls to addDomainToSelectedDomains.
 boolean allInputValid()
          checks whether the username, password are valid, and also whether there is at least one domain from calls to addDomainToSelectedDomains.
 java.lang.String checkPassword(java.lang.String password)
          Checks whether a password is valid or not, and returns a message.
 java.lang.String checkUsername(java.lang.String username)
          checks whether the student with username already exists
 void deleteUser(java.lang.String username)
          deletes a student from the entire JITAS System
 java.util.SortedSet<java.lang.String> getAllDomainNames()
          gets the set of all domain names
 java.lang.String[] getAllDomainNameStrings()
          gets an array of all domain names
 boolean getPasswordEntryStatus()
           
 java.lang.String[] getSelectedDomainStrings()
          gets all the domains names which are currently selected.
 javax.swing.table.TableModel getStudentTableModel()
          gets the table model for the current student
 java.lang.String[] getStudentUsernameStrings()
          Used to return an array of student usernames depending on what the filter is set to.
 java.lang.String[] getUnselectedDomainStrings()
          gets the domains which the new student will not currently belong to.
 boolean getUsernameEntryStatus()
           
 boolean isAllowedInDomain(int row)
          tests whether a student has access to a certain domain
 void removeDomain(int row)
          Called when the remove button is pressed in the gui.
 void removeDomainFromSelectedDomains(java.lang.String domain)
          Removes a domain from the domains a new student will have access to.
 void resetNewStudentDomainLists()
          Resets the currently selected domains which the new student will belong to, to the default which is: no domains are selected.
 void setCurrentUser(java.lang.String username)
          Sets the current student which is selected in the gui
 void setFilter(java.lang.String filter)
          Sets the domaain of which we wish to filter by If the filter is null, then all domains are selected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIHelper

public GUIHelper()
          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getStudentUsernameStrings

public java.lang.String[] getStudentUsernameStrings()
                                             throws java.io.FileNotFoundException
Used to return an array of student usernames depending on what the filter is set to. In the gui, these usernames will make up the list of students.

Returns:
the array of students dependent on the filter
Throws:
java.io.FileNotFoundException

setCurrentUser

public void setCurrentUser(java.lang.String username)
Sets the current student which is selected in the gui

Parameters:
username -

removeDomain

public void removeDomain(int row)
                  throws DomainNotFoundException,
                         DomainNotLoadedException,
                         UserNotFoundException,
                         UserNotLoggedInException,
                         java.rmi.RemoteException,
                         jess.JessException
Called when the remove button is pressed in the gui. This method then gets the admin class to remove the domain from the current student.

Parameters:
row - - current domain selected in the gui
Throws:
DomainNotFoundException
DomainNotLoadedException
UserNotFoundException
UserNotLoggedInException
java.rmi.RemoteException
jess.JessException

addDomain

public void addDomain(int row)
               throws DomainNotFoundException,
                      DomainNotLoadedException,
                      StudentModelAlreadyExistsException,
                      UserNotFoundException,
                      java.rmi.RemoteException,
                      jess.JessException,
                      AddUserDeniedException
Called when the add button is pressed in the gui. Adds the selected domain to the set of domains a student can access.

Parameters:
row - - the row of the domain selected
Throws:
DomainNotFoundException
DomainNotLoadedException
StudentModelAlreadyExistsException
UserNotFoundException
java.rmi.RemoteException
jess.JessException
AddUserDeniedException

getAllDomainNames

public java.util.SortedSet<java.lang.String> getAllDomainNames()
gets the set of all domain names

Returns:
a SortedSet of all domain names

getAllDomainNameStrings

public java.lang.String[] getAllDomainNameStrings()
gets an array of all domain names

Returns:
an array of all domain names

getStudentTableModel

public javax.swing.table.TableModel getStudentTableModel()
gets the table model for the current student

Returns:
a tableModel

isAllowedInDomain

public boolean isAllowedInDomain(int row)
                          throws UserNotFoundException
tests whether a student has access to a certain domain

Parameters:
row - - the row of the domain currently selected
Returns:
true if the student does have access to domain
Throws:
UserNotFoundException

setFilter

public void setFilter(java.lang.String filter)
Sets the domaain of which we wish to filter by If the filter is null, then all domains are selected

Parameters:
filter - - the domain name we wish to filter by or null if all domains are selected

resetNewStudentDomainLists

public void resetNewStudentDomainLists()
Resets the currently selected domains which the new student will belong to, to the default which is: no domains are selected.


getUnselectedDomainStrings

public java.lang.String[] getUnselectedDomainStrings()
gets the domains which the new student will not currently belong to.

Returns:
an array of all the domains the student does not currently have access

getSelectedDomainStrings

public java.lang.String[] getSelectedDomainStrings()
gets all the domains names which are currently selected. This is used in creating a new student.

Returns:
an array of domain names

checkUsername

public java.lang.String checkUsername(java.lang.String username)
checks whether the student with username already exists

Parameters:
username - -username of the student
Returns:
a message

checkPassword

public java.lang.String checkPassword(java.lang.String password)
Checks whether a password is valid or not, and returns a message.


allInputValid

public boolean allInputValid()
checks whether the username, password are valid, and also whether there is at least one domain from calls to addDomainToSelectedDomains.

Returns:
True if username, password and selection domain information is valid.

addNewStudent

public void addNewStudent(java.lang.String username,
                          java.lang.String password)
                   throws AddUserDeniedException,
                          DomainNotFoundException,
                          DomainNotLoadedException,
                          IllegalUserNameException,
                          StudentModelAlreadyExistsException,
                          java.rmi.RemoteException,
                          jess.JessException
Creates a new student with all domains from previous calls to addDomainToSelectedDomains.

Parameters:
username - - the students username
password - - the students password
Throws:
AddUserDeniedException
DomainNotFoundException
DomainNotLoadedException
IllegalUserNameException
StudentModelAlreadyExistsException
java.rmi.RemoteException
jess.JessException

addDomainToSelectedDomains

public void addDomainToSelectedDomains(java.lang.String domain)
Adds a domain to the set of domains a new student will have access to.

Parameters:
domain - - the domain name

removeDomainFromSelectedDomains

public void removeDomainFromSelectedDomains(java.lang.String domain)
Removes a domain from the domains a new student will have access to.

Parameters:
domain - - the domain name

getUsernameEntryStatus

public boolean getUsernameEntryStatus()
Returns:
true if the username entered is valid

getPasswordEntryStatus

public boolean getPasswordEntryStatus()
Returns:
true if the password entered is valid

deleteUser

public void deleteUser(java.lang.String username)
                throws DomainNotFoundException,
                       DomainNotLoadedException,
                       UserNotFoundException,
                       UserNotLoggedInException,
                       java.rmi.RemoteException,
                       jess.JessException
deletes a student from the entire JITAS System

Parameters:
username - - the username of the student
Throws:
DomainNotFoundException
DomainNotLoadedException
UserNotFoundException
UserNotLoggedInException
java.rmi.RemoteException
jess.JessException