|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjitas.core.Student
public class Student
Student keeps track of all the domains a student is logged into as well as the domains that the student is able to log into, and their userName and password which the student uses to log into domains.
| Constructor Summary | |
|---|---|
Student(java.lang.String userName,
java.lang.String password,
java.util.Set<java.lang.String> allowedDomains)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAllowedDomain(java.lang.String domainName)
Adds a new domain to the set of domains a student can log into. |
void |
addSatisfiedConstraints(java.lang.String domainName,
java.util.Collection<java.lang.String> satisfiedConstraints)
Add some satisfied constraints to this students model for the given domain |
void |
addSolvedProblem(java.lang.String domainName,
java.lang.String subdomainName,
java.lang.Integer problemID)
Add a problem to the collection of solved problems for a subdomain |
void |
addStudentModel(java.lang.String domainName,
StudentModel model)
Add a student model to this students models. |
void |
addViolatedConstraints(java.lang.String domainName,
java.util.Collection<java.lang.String> violatedConstraints)
Add some violated constraints to this students model for the given domain |
void |
changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
Change the Student password |
static int |
checkPassword(java.lang.String password)
Check the password is longer than 2 |
static int |
checkUsername(java.lang.String username)
Validate the username which only allows alphabets, numbers and underscore |
int |
compareTo(java.lang.Object object)
Standard compareTo override, based on the userName |
void |
createStudentModel(java.lang.String domainName)
Creates a new (empty) StudentModel and adds it to this students models. |
static void |
deleteUser(Student student)
Deletes students global information -NOT domain information. |
boolean |
equals(java.lang.Object object1)
|
java.util.Set<java.lang.String> |
getAllowedDomains()
Returns a complete unmodifiable Set of all the domains a student can log into |
java.lang.Integer |
getCurrentProblemID(java.lang.String domainName)
Get the ID of the problem the student is currently working on for a given domain |
java.lang.String |
getCurrentSubdomain(java.lang.String domainName)
Get the name of the current subdomain of a particular domain |
java.util.Set<java.lang.String> |
getLiveDomains()
Returns a complete Set of all the domains a student is currently logged into |
Problem |
getNextProblem(java.lang.String domainName,
java.util.SortedMap<java.lang.Integer,Problem> problems)
Gets the next problem the student hasnt solved in the current subdomain of a given domain |
Problem |
getNextProblem(java.lang.String domainName,
java.util.SortedMap<java.lang.Integer,Problem> problems,
int problemNumber)
Returns a problem, given a problemID, for a domain |
java.lang.String |
getPassword()
Get the encrypted password of this user. |
java.lang.String |
getProblemStatus(java.lang.String domainName,
int problemID)
Get the status of a given problem, from a given domain. |
double |
getRating(java.lang.String domainName)
Get the rating of this student for a given domain. |
java.util.Collection<java.lang.String> |
getSatisfiedConstraints(java.lang.String domainName)
Get the collection of constraints satisfied in the given domain |
java.util.Set<java.lang.Integer> |
getSolvedProblems(java.lang.String domainName,
java.lang.String subdomainName)
Get the IDs of the problems solved for a given subdomain |
java.lang.String |
getUserName()
Get the userName of this user. |
java.util.Collection<java.lang.String> |
getViolatedConstraints(java.lang.String domainName)
Get the collection of constraints violated in the given domain |
int |
hashCode()
|
void |
incrementRating(java.lang.String domainName,
double increment)
Increment this students rating in the given domain by a certain amount |
void |
initModel(java.lang.String domainName)
Make sure a student model exists for the given domain |
boolean |
isAllowedInDomain(java.lang.String domainName)
Checks whether a Student has access to a domain or not. |
boolean |
isLoggedIn(java.lang.String domainName)
Get the login status for the user (ie if they are logged in or not) for a specific domain |
static java.util.Set<Student> |
loadAllStudents()
Loads all the Students from xml, and returns a set of those (loaded) Students. |
void |
login(java.lang.String domainName,
java.lang.String password)
Log the user in to allow further actions |
void |
logout(java.lang.String domainName)
Logs this user out of a domain |
static Student |
newStudentFactory(java.lang.String userName,
java.lang.String password,
java.util.Set<java.lang.String> allowedDomains)
Construct a new Student Object. |
static void |
persistStudent(Student student)
Saves the Student to xml, creates a new StudentModel for the domain, and also writes that to XML. |
static void |
removeUser(Student student,
java.lang.String domainName)
Removes access to a specific Domain, for a Student. |
void |
saveStudentModel(java.lang.String domainName)
Save the model for a given domain |
void |
setCurrentProblemStatus(java.lang.String domainName,
java.lang.String status)
Set the status of the current problem for a domain |
void |
setCurrentSubdomain(java.lang.String domainName,
java.lang.String currentSubdomain)
Set the current working subdomain for a given domain |
void |
setProblemStatus(java.lang.String domainName,
java.lang.String subdomainName,
int problemID,
java.lang.String status)
Set the status for a given problem. |
void |
setRating(java.lang.String domainName,
double rating)
Set this students rating for a given domain. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Student(java.lang.String userName,
java.lang.String password,
java.util.Set<java.lang.String> allowedDomains)
throws IllegalUserNameException
userName - The students userName.password - The encrypted passwordallowedDomains - The domains a student can log into
java.security.NoSuchAlgorithmException
IllegalUserNameException| Method Detail |
|---|
public void login(java.lang.String domainName,
java.lang.String password)
domainName - The name of the domain that user wants to log inpassword - The password.
java.io.UnsupportedEncodingException
java.security.NoSuchAlgorithmExceptionpublic void logout(java.lang.String domainName)
public boolean isLoggedIn(java.lang.String domainName)
public void initModel(java.lang.String domainName)
domainName - The domain (name)public java.lang.String getUserName()
public java.lang.String getPassword()
public static int checkUsername(java.lang.String username)
username - The student username that needs to be validated
public static int checkPassword(java.lang.String password)
password - The student's password that needs to be checked
public static Student newStudentFactory(java.lang.String userName,
java.lang.String password,
java.util.Set<java.lang.String> allowedDomains)
throws IllegalUserNameException
userName - The username of the studentpassword - The plain text password of the studentallowedDomains - A set of domain names the student is allowed to access
IllegalUserNameException - If the username is Illegal
public void changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
throws InvalidPasswordException
newPassword - The new password that the user wants to change tooldPassword - The existing password of a user
InvalidPasswordException - If the old password is wrongpublic boolean equals(java.lang.Object object1)
equals in class java.lang.Object
public int compareTo(java.lang.Object object)
throws java.lang.ClassCastException
object - the Object to be compared
java.lang.ClassCastExceptionpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isAllowedInDomain(java.lang.String domainName)
domainName - The name of the domain we want to check
public java.util.Set<java.lang.String> getAllowedDomains()
public void addAllowedDomain(java.lang.String domainName)
throws StudentModelAlreadyExistsException
domainName - The domain name that the students can log into
AddUserDeniedException
StudentModelAlreadyExistsException
UserAlreadyExistsException
public void addStudentModel(java.lang.String domainName,
StudentModel model)
domainName - The name of the domain this model is formodel - The StudentModel objectpublic void createStudentModel(java.lang.String domainName)
domainName - public java.util.Set<java.lang.String> getLiveDomains()
public static java.util.Set<Student> loadAllStudents()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static void persistStudent(Student student)
student - The Student to be persisted
AddUserDeniedException
StudentModelAlreadyExistsException
UserAlreadyExistsException
public static void removeUser(Student student,
java.lang.String domainName)
throws UserNotFoundException
student - The student that needs to be removeddomainName - the domain which you want a student to have revoked access on.
UserNotFoundException - if a Students student model is not found in domain
public static void deleteUser(Student student)
throws UserNotFoundException
student - the student which is to be deleted.
UserNotFoundException
public void setCurrentSubdomain(java.lang.String domainName,
java.lang.String currentSubdomain)
domainName - The domain namecurrentSubdomain - The name of the current subdomainpublic java.lang.String getCurrentSubdomain(java.lang.String domainName)
domainName - The domain name
public Problem getNextProblem(java.lang.String domainName,
java.util.SortedMap<java.lang.Integer,Problem> problems)
domainName - The name of the domainproblems - A collection of problems to choose the next from
public Problem getNextProblem(java.lang.String domainName,
java.util.SortedMap<java.lang.Integer,Problem> problems,
int problemNumber)
domainName - The name of the domainproblems - The problems to select fromproblemNumber - The ID of they wanted problem
public java.lang.String getProblemStatus(java.lang.String domainName,
int problemID)
domainName - The name of the domainproblemID - The ID of the problem
public java.lang.Integer getCurrentProblemID(java.lang.String domainName)
domainName - The name of the domain
public void setProblemStatus(java.lang.String domainName,
java.lang.String subdomainName,
int problemID,
java.lang.String status)
domainName - The domain namesubdomainName - The subdomain name the problem belongs toproblemID - The ID of the problemstatus - The status
public void setRating(java.lang.String domainName,
double rating)
domainName - The domain namerating - The new ratingpublic double getRating(java.lang.String domainName)
domainName - The domain name
public void incrementRating(java.lang.String domainName,
double increment)
domainName - The domain nameincrement - The amount to increase the rating by
public void setCurrentProblemStatus(java.lang.String domainName,
java.lang.String status)
domainName - The domain namestatus - The status for the current problem
public void addSolvedProblem(java.lang.String domainName,
java.lang.String subdomainName,
java.lang.Integer problemID)
domainName - The domain namesubdomainName - The name of the subdomain the problem belongs toproblemID - The ID of the solved problem
public void addViolatedConstraints(java.lang.String domainName,
java.util.Collection<java.lang.String> violatedConstraints)
domainName - The domain nameviolatedConstraints - A collection of constraints
public void addSatisfiedConstraints(java.lang.String domainName,
java.util.Collection<java.lang.String> satisfiedConstraints)
domainName - the domain namesatisfiedConstraints - A collection of constraints
public java.util.Set<java.lang.Integer> getSolvedProblems(java.lang.String domainName,
java.lang.String subdomainName)
domainName - The domain namesubdomainName - The subdomain name
public java.util.Collection<java.lang.String> getSatisfiedConstraints(java.lang.String domainName)
domainName - The domain name
public java.util.Collection<java.lang.String> getViolatedConstraints(java.lang.String domainName)
domainName - The domain name
public void saveStudentModel(java.lang.String domainName)
domainName - The domain name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||