org.activemath.abstractcontent
Class UserModelAdapter

java.lang.Object
  extended by org.activemath.abstractcontent.UserModelAdapter
All Implemented Interfaces:
AbstractStudentModel, AbstractUserModel

public class UserModelAdapter
extends Object
implements AbstractUserModel


Constructor Summary
UserModelAdapter(AbstractStudentModel model)
           
 
Method Summary
 void addBook(String user, org.jdom.Document book)
          Attaches a Document representing a user-generated book to the given user.
 int addToHistory(String string, String[] itemIds, String page, String type, long start, int duration, double success, String session)
          Temporary method needed for the connection to the history in the userModel server.
 boolean alreadySeen(String userId, String con)
          tells wether the user has already seen the given item.
 void createNewUser(Hashtable hashtable)
          creates a new user from the given Hashtable.
 void disableEyeTracker(String user)
           
 boolean doesUserExist(String user)
          checks if there is a student model for the student with login name user.
 void elementHasBeenSeen(String userID, String mBaseID, String session, Date startTime, Date endTime)
           
 void enableEyeTracker(String user)
           
 void endExercise(String userID, String problemID, Date time, double successProportion, String sessionID)
           
 void endPageBrowsed(String userID, List mBaseIDs, Date time, String sessionId, String page)
           
 Map getBooks(String user)
          Fetches a Map of all books attached to the given user
 Vector getConceptsKnown(String user)
          gets a Vector containing the MBase IDs of all Items the user has a mastery assessment for.
 Hashtable getJustificatingSteps(String user, String concept)
          gets a Hashtable containing the history elements responsible for the mastery assessment of the given concept, keyed by their id.
 Hashtable getKnowledge(String userID, String mBaseID)
          fetches a Hashtable from the studentmodel containing the students mastery values for the supplied concept.
 Date getLastTimeSeen(String userID, String mBaseID)
          gets the Date of the last time the given Item has been seen by the student.
 double getMastery(String userID, String mBaseID)
          gets the student's mastery value for the given item.
 Hashtable getMultipleKnowledge(String userID, Vector mBaseIDs)
          gets a Hashtable containing the supplied mBaseIds as keys, and the corresponding mastery Hashtable as Value as returned by AbstractUserModel.getKnowledge(java.lang.String, java.lang.String).
 org.jdom.Document getNextBestAdvice(String user, String advice_id)
           
 Hashtable getProperties(String userId)
          gets the Hashtable containing all the properties stored in the um for the user with login userId.
 String getProperty(String userId, String propertyName)
          gets the value of the requested property for the supplied user as a String.
 List getUserList()
          returns the list of all existing user ids
 void incrementTimesSeen(String userId, String itemId)
          Increments the number of Times an element has been seen
 void logout(String userID)
          logs the student with login name user out, that means save her student model to the hard disk and remove it from ram.
 void removeBook(String user, String bookId)
          Removed the given user-generated book from the user.
 boolean removeUser(String userId)
          Deletes the given user from the userModel server
 void requestNextBestAdvice(String user, String type)
           
 void setKnowledge(String userID, String mBaseID, Hashtable bloomProps)
          sets user userID's mastery assessment for the given mBaseID to the supplied Hashtable.
 void setProperty(String userId, String propertyName, String value)
          sets the property for the user userId to the supplied key-value pair.
 void startExercise(String userID, String problemID, Date time, String proxyURL, String sessionID)
           
 void startPageBrowsed(String userID, List list, Date time, String sessionId, String page)
           
 void suggestionFollowed(String user, int suggestion_type)
           
 void suggestionIgnored(String user, int suggestion_type)
           
 void update(String userId, String itemId, Map newAssessment, String historyId)
          Temporary: Connectivity for the UM-internal update method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserModelAdapter

public UserModelAdapter(AbstractStudentModel model)
Method Detail

getUserList

public List getUserList()
Description copied from interface: AbstractStudentModel
returns the list of all existing user ids

Specified by:
getUserList in interface AbstractStudentModel
Specified by:
getUserList in interface AbstractUserModel
Returns:
the list of all existing user ids

getProperties

public Hashtable getProperties(String userId)
Description copied from interface: AbstractUserModel
gets the Hashtable containing all the properties stored in the um for the user with login userId. (SM)

Specified by:
getProperties in interface AbstractStudentModel
Specified by:
getProperties in interface AbstractUserModel
Parameters:
userId - the login id of the user whose properties to fetch.
Returns:
the Hashtable containing all the user's properties.
See Also:
AbstractUserModel.getProperty(String,String), AbstractUserModel.setProperty(String,String,String)

getProperty

public String getProperty(String userId,
                          String propertyName)
Description copied from interface: AbstractUserModel
gets the value of the requested property for the supplied user as a String. (SM)

Specified by:
getProperty in interface AbstractStudentModel
Specified by:
getProperty in interface AbstractUserModel
Parameters:
userId - the login name of the user to get the property for
propertyName - the name of the property to get the value of
Returns:
the value of the given property as a String
See Also:
AbstractUserModel.getProperties(String), AbstractUserModel.setProperty(String, String, String)

setProperty

public void setProperty(String userId,
                        String propertyName,
                        String value)
Description copied from interface: AbstractUserModel
sets the property for the user userId to the supplied key-value pair. (SM)

Specified by:
setProperty in interface AbstractStudentModel
Specified by:
setProperty in interface AbstractUserModel
Parameters:
userId - the login of the user to set the property for
propertyName - the name of the property to set
value - the value to assign to the property
See Also:
AbstractUserModel.getProperty(String,String), AbstractUserModel.getProperties(String)

getKnowledge

public Hashtable getKnowledge(String userID,
                              String mBaseID)
Description copied from interface: AbstractUserModel
fetches a Hashtable from the studentmodel containing the students mastery values for the supplied concept. For information about our implementation, see org.activemath.studentmodel.StudentModelFacade#getKnowledge(String,String).(SM)

Specified by:
getKnowledge in interface AbstractStudentModel
Specified by:
getKnowledge in interface AbstractUserModel
Parameters:
userID - the login of the user to get the mastery assessment for
mBaseID - the MBase ID of the concept to get the mastery assessment for.
Returns:
a Hashtable containing the mastery assessment for the given userID
See Also:
AbstractUserModel.getMultipleKnowledge(String,Vector), AbstractUserModel.setKnowledge(String,String,Hashtable), AbstractUserModel.getMastery(String,String), org.activemath.studentmodel.ModelCentral#getKnowledge(String,String), org.activemath.studentmodel.KnowledgeAtomImpl

getMultipleKnowledge

public Hashtable getMultipleKnowledge(String userID,
                                      Vector mBaseIDs)
Description copied from interface: AbstractUserModel
gets a Hashtable containing the supplied mBaseIds as keys, and the corresponding mastery Hashtable as Value as returned by AbstractUserModel.getKnowledge(java.lang.String, java.lang.String).(SM)

Specified by:
getMultipleKnowledge in interface AbstractStudentModel
Specified by:
getMultipleKnowledge in interface AbstractUserModel
Parameters:
userID - the login of the user to get the assessments for
mBaseIDs - a Vector containing MBaseIDs to fetch the user's mastery assessment for.
Returns:
a Hashtable containing the mastery assessments for the supplied mBaseIDs (which are strings).
See Also:
AbstractUserModel.getKnowledge(String,String), AbstractUserModel.setKnowledge(String,String,Hashtable), AbstractUserModel.getMastery(String,String), org.activemath.studentmodel.ModelCentral#getMultipleKnowledge(String,Vector), org.activemath.studentmodel.KnowledgeAtomImpl

setKnowledge

public void setKnowledge(String userID,
                         String mBaseID,
                         Hashtable bloomProps)
Description copied from interface: AbstractUserModel
sets user userID's mastery assessment for the given mBaseID to the supplied Hashtable. The Hashtable must have the structure like those returned by AbstractUserModel.getKnowledge(String,String).(SM)

Specified by:
setKnowledge in interface AbstractStudentModel
Specified by:
setKnowledge in interface AbstractUserModel
Parameters:
userID - the login of the user to set the mastery assessment for
mBaseID - the MBase Id of the item to set the mastery assessment for
bloomProps - the Hashtable containing the mastery assessment that is to be set.
See Also:
AbstractUserModel.getKnowledge(String,String), AbstractUserModel.getMultipleKnowledge(String,Vector), AbstractUserModel.getMastery(String,String), org.activemath.studentmodel.ModelCentral#setKnowledge(String,String,Hashtable), org.activemath.studentmodel.KnowledgeAtomImpl

getMastery

public double getMastery(String userID,
                         String mBaseID)
Description copied from interface: AbstractUserModel
gets the student's mastery value for the given item. mastery value means just one double between 0 and 1, representing how good the user masters this concept.(SM)

Specified by:
getMastery in interface AbstractStudentModel
Specified by:
getMastery in interface AbstractUserModel
Parameters:
userID - the login name of the user to get the mean value for
mBaseID - the id of the item to get the mastery for.
Returns:
a double representing the student's mastery for the given item.
See Also:
AbstractUserModel.getKnowledge(String,String), AbstractUserModel.getMultipleKnowledge(String,Vector), AbstractUserModel.setKnowledge(String,String,Hashtable), org.activemath.studentmodel.KnowledgeAtomImpl

logout

public void logout(String userID)
Description copied from interface: AbstractUserModel
logs the student with login name user out, that means save her student model to the hard disk and remove it from ram.(SM)

Specified by:
logout in interface AbstractStudentModel
Specified by:
logout in interface AbstractUserModel
Parameters:
userID - the login name of the student to log out.

enableEyeTracker

public void enableEyeTracker(String user)

disableEyeTracker

public void disableEyeTracker(String user)

alreadySeen

public boolean alreadySeen(String userId,
                           String con)
Description copied from interface: AbstractUserModel
tells wether the user has already seen the given item.(SM)

Specified by:
alreadySeen in interface AbstractStudentModel
Specified by:
alreadySeen in interface AbstractUserModel
Parameters:
userId - the login name of the student to check
con - the MBase ID of the item to check
Returns:
true if the user has already seen the concept
See Also:
org.activemath.studentmodel.ModelCentral#getTimesSeen(String,String)

startExercise

public void startExercise(String userID,
                          String problemID,
                          Date time,
                          String proxyURL,
                          String sessionID)

endExercise

public void endExercise(String userID,
                        String problemID,
                        Date time,
                        double successProportion,
                        String sessionID)

startPageBrowsed

public void startPageBrowsed(String userID,
                             List list,
                             Date time,
                             String sessionId,
                             String page)

endPageBrowsed

public void endPageBrowsed(String userID,
                           List mBaseIDs,
                           Date time,
                           String sessionId,
                           String page)

elementHasBeenSeen

public void elementHasBeenSeen(String userID,
                               String mBaseID,
                               String session,
                               Date startTime,
                               Date endTime)

getLastTimeSeen

public Date getLastTimeSeen(String userID,
                            String mBaseID)
Description copied from interface: AbstractUserModel
gets the Date of the last time the given Item has been seen by the student.(SM)

Specified by:
getLastTimeSeen in interface AbstractStudentModel
Specified by:
getLastTimeSeen in interface AbstractUserModel
Parameters:
userID - the login name of the student
mBaseID - the MBase ID of the Item.
Returns:
the Date of the last time the item has been seen by the student.
See Also:
AbstractUserModel.alreadySeen(String,String)

createNewUser

public void createNewUser(Hashtable hashtable)
                   throws ModelExistsException
Description copied from interface: AbstractUserModel
creates a new user from the given Hashtable. It has to be in the form specified by the student model component.(SM)

Specified by:
createNewUser in interface AbstractStudentModel
Specified by:
createNewUser in interface AbstractUserModel
Parameters:
hashtable - the Hashtable containing the information needed to create the model
Throws:
ModelExistsException - if the requested name(contained in the Hashtable) is already in use
See Also:
org.activemath.studentmodel.ModelCentral#createNewUser(Hashtable)

doesUserExist

public boolean doesUserExist(String user)
Description copied from interface: AbstractUserModel
checks if there is a student model for the student with login name user.(SM)

Specified by:
doesUserExist in interface AbstractStudentModel
Specified by:
doesUserExist in interface AbstractUserModel
Parameters:
user - the username to check
Returns:
true if such a student model already exists
See Also:
org.activemath.studentmodel.ModelCentral#doesUserExist

getJustificatingSteps

public Hashtable getJustificatingSteps(String user,
                                       String concept)
Description copied from interface: AbstractUserModel
gets a Hashtable containing the history elements responsible for the mastery assessment of the given concept, keyed by their id.(SM)

Specified by:
getJustificatingSteps in interface AbstractStudentModel
Specified by:
getJustificatingSteps in interface AbstractUserModel
Parameters:
user - the login name of the user
concept - the MBase ID of the Item to get the justification for

getNextBestAdvice

public org.jdom.Document getNextBestAdvice(String user,
                                           String advice_id)

requestNextBestAdvice

public void requestNextBestAdvice(String user,
                                  String type)

getConceptsKnown

public Vector getConceptsKnown(String user)
Description copied from interface: AbstractUserModel
gets a Vector containing the MBase IDs of all Items the user has a mastery assessment for.

Specified by:
getConceptsKnown in interface AbstractStudentModel
Specified by:
getConceptsKnown in interface AbstractUserModel
Parameters:
user - the login of the user
Returns:
the Vector containing the IDs of all the items known to the user
See Also:
org.activemath.studentmodel.ModelCentral#getConceptsKnown(String), AbstractUserModel.getKnowledge(String,String), AbstractUserModel.getMultipleKnowledge(String,Vector), AbstractUserModel.getMastery(String, String), AbstractUserModel.setKnowledge(String,String,Hashtable)

suggestionFollowed

public void suggestionFollowed(String user,
                               int suggestion_type)

suggestionIgnored

public void suggestionIgnored(String user,
                              int suggestion_type)

addBook

public void addBook(String user,
                    org.jdom.Document book)
Description copied from interface: AbstractUserModel
Attaches a Document representing a user-generated book to the given user.

Specified by:
addBook in interface AbstractStudentModel
Specified by:
addBook in interface AbstractUserModel
Parameters:
user - the user to attach the book to
book - the book as a Document.

removeBook

public void removeBook(String user,
                       String bookId)
Description copied from interface: AbstractUserModel
Removed the given user-generated book from the user.

Specified by:
removeBook in interface AbstractStudentModel
Specified by:
removeBook in interface AbstractUserModel
Parameters:
user - the user to remove the book from
bookId - the id of the book to remove

getBooks

public Map getBooks(String user)
Description copied from interface: AbstractUserModel
Fetches a Map of all books attached to the given user

Specified by:
getBooks in interface AbstractStudentModel
Specified by:
getBooks in interface AbstractUserModel
Parameters:
user - the user id to get the books for.
Returns:
a Map containing the given user's books, keys are the ids, values are the content as String.

update

public void update(String userId,
                   String itemId,
                   Map newAssessment,
                   String historyId)
Description copied from interface: AbstractUserModel
Temporary: Connectivity for the UM-internal update method.

Specified by:
update in interface AbstractStudentModel
Specified by:
update in interface AbstractUserModel
Parameters:
userId - The id of the user to update the model for
itemId - the id of the item to update the mastery assessment of
newAssessment - the new mastery assessment to set
historyId - the id of the history item that justifies the update

addToHistory

public int addToHistory(String string,
                        String[] itemIds,
                        String page,
                        String type,
                        long start,
                        int duration,
                        double success,
                        String session)
Description copied from interface: AbstractUserModel
Temporary method needed for the connection to the history in the userModel server.

Specified by:
addToHistory in interface AbstractStudentModel
Specified by:
addToHistory in interface AbstractUserModel

removeUser

public boolean removeUser(String userId)
Description copied from interface: AbstractUserModel
Deletes the given user from the userModel server

Specified by:
removeUser in interface AbstractStudentModel
Specified by:
removeUser in interface AbstractUserModel
Parameters:
userId - The id of the user to remove
Returns:
true if the user could be successfully removed

incrementTimesSeen

public void incrementTimesSeen(String userId,
                               String itemId)
Description copied from interface: AbstractUserModel
Increments the number of Times an element has been seen

Specified by:
incrementTimesSeen in interface AbstractStudentModel
Specified by:
incrementTimesSeen in interface AbstractUserModel
Parameters:
userId - the id of the user
itemId - the mbase id of the item.