org.starhope.appius.user
Class Passport

java.lang.Object
  extended by org.starhope.appius.util.SimpleDataRecord<Passport>
      extended by org.starhope.appius.user.Passport
All Implemented Interfaces:
com.whirlycott.cache.Cacheable, Serializable, Comparable<Passport>, CTime, DataRecord, HasSubversionRevision

public class Passport
extends SimpleDataRecord<Passport>

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          WRITEME: Document this brpocock@star-hope.org
private  int userID
          The user ID of the owner of this passport
private  Set<String> visitedRooms
          the set of room monikers which the user has visited
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
Passport()
          nil constructor
Passport(GeneralUser user)
           
 
Method Summary
 int getCacheableID()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 String getCacheableIdent()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 int getOwnerID()
           
 String getSubversionRevision()
           Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
 Collection<String> getVisitedRooms()
           
 boolean hasVisited(String moniker)
           
 void setOwnerID(int userIDForLogin)
           
 org.json.JSONObject toJSON()
           
 void visited(String moniker)
           
 
Methods inherited from class org.starhope.appius.util.SimpleDataRecord
changed, checkStale, compareTo, equals, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, hashCode, isBeingLoaded, markAsLoaded, markAsSaved, markForReload, onRemove, onRetrieve, onStore, save, setRecordLoader, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

userID

private int userID
The user ID of the owner of this passport


visitedRooms

private final Set<String> visitedRooms
the set of room monikers which the user has visited

Constructor Detail

Passport

public Passport()
nil constructor


Passport

public Passport(GeneralUser user)
Parameters:
user - the owner
Method Detail

getCacheableID

public int getCacheableID()
                   throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Returns:
an unique ID number
Throws:
NotFoundException - if the item doesn't have a distinct numeric ID
See Also:
DataRecord.getCacheableID()

getCacheableIdent

public String getCacheableIdent()
                         throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Returns:
an unique identifier string
Throws:
NotFoundException - if the item doesn't have a distinct string identifier
See Also:
DataRecord.getCacheableIdent()

getOwnerID

public int getOwnerID()
Returns:
the user ID of the owner of this passport

getSubversionRevision

public String getSubversionRevision()
Description copied from interface: HasSubversionRevision

Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.

As an example,the Subversion revision string for this file is "$Rev: 1968 $"

 
 @Override
 public String getSubversionRevision () {
        return "$Rev: ";
 }
 

Returns:
The Subversion revision level for this class's source code file.
See Also:
HasSubversionRevision.getSubversionRevision()

getVisitedRooms

public Collection<String> getVisitedRooms()
Returns:
the set of all rooms that the user has visited

hasVisited

public boolean hasVisited(String moniker)
Parameters:
moniker - of a room
Returns:
true, if the user has ever been there

setOwnerID

public void setOwnerID(int userIDForLogin)
Parameters:
userIDForLogin - to be set

toJSON

public org.json.JSONObject toJSON()
Returns:
the list of visited rooms in JSON form

visited

public void visited(String moniker)
Parameters:
moniker - the room that the user has now visited