|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.user.UserRecordSQLLoader
public class UserRecordSQLLoader
The User Record is the canonical storage for all things that describe a character in the game world; this is the “character sheet.” An User Record may describe a player-character, an NPC, or even a non-character that acts in some way like an user, e.g. an intelligent object driven by a script, which logically acts as an NPC, but is essentially not.
Every user-like object is required to implement AbstractUser
,
which provides an enormous number of accessor methods to the data
defined by an UserRecord. While there is no requirement that
any given Abstract User implementation must use a UserRecord
for its backing store, it is extremely strongly recommended
that they should do so.
If migrating with default (Tootsville™-like) table layouts from Appius 1.0 to Appius 1.1, you'll need to execute the following DDL instructions on your database server to update the table structures. Note that “avatarID” was never used by Appius Claudius Cæcus, however, the sample SQL table structures distributed with 0.8 through 1.0 had this column in place. (Appius has always used the avatarClass column exclusively.)
It is believed that removing the “classID” column should also be harmless, however, there may be some reference to it in the codebase still. The contents of the “classID” column have never been used by Appius directly, however, the contents of that column should indicate the version of Appius which last wrote to the database. Early versions of Appius (0.x.x) wrote a classID of -3; Appius 1.0.x wrote -4; and this series (1.1.x) writes -5.
ALTER TABLE users ADD COLUMN travelRate DECIMAL(5,2) UNSIGNED NOT NULL DEFAULT 100.00; ALTER TABLE users ADD COLUMN parentApprovedName ENUM('Y','N') NOT NULL DEFAULT 'N'; ALTER TABLE users ADD COLUMN lastZoneName VARCHAR(50) NOT NULL DEFAULT ''; ALTER TABLE users DROP COLUMN avatarID;
Field Summary | |
---|---|
private static int |
CLASS_ID_CURRENT
The Class ID for user records created or updated by this loader. |
private static String |
SAVE_RECORD_SQL
The SQL statement for inserting or updating user records |
Constructor Summary | |
---|---|
UserRecordSQLLoader()
|
Method Summary | |
---|---|
void |
changed(UserRecord changedRecord)
accept a notification from a record that it has been changed. |
protected static void |
fetch_avatarInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the user's avatar information from the database |
protected static void |
fetch_chatColours(UserRecord userRecord,
ResultSet resultSet)
Fetch the chat colours for this user from the database |
protected static void |
fetch_dobInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the user's date of birth and related information from the database record provided |
protected static void |
fetch_language(UserRecord userRecord,
ResultSet resultSet)
Fetch the user's language and dialect information from the database record |
protected static void |
fetch_laston(UserRecord userRecord)
Fetch the user's last activity information from the database record |
protected static void |
fetch_mailInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the user's eMail info from the database record |
protected void |
fetch_more(ResultSet resultSet)
Fetch additional results fields from a database record — mostly intended to be overridden by derived classes |
protected static void |
fetch_parentInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch information about the user's parent (if any). |
protected static void |
fetch_passwordResetInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the password reset question and answer from the provided database record. |
protected static void |
fetch_permissionsInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the permissions-related portion of a user's record out of the SQL ResultSet. |
protected static void |
fetch_userBasicInfo(UserRecord userRecord,
ResultSet resultSet)
Fetch the user's basic information: user ID, user name, and password — from the provided database record |
String |
getSubversionRevision()
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence. |
void |
initializeStorage(String storageURL)
Initialize the database connection pool to be used for accessing user records. |
boolean |
isRealtime()
|
UserRecord |
loadRecord(int id)
Load the record with the given ID number from the storage system |
UserRecord |
loadRecord(String identifier)
Load the data record identified from the storage system. |
void |
refresh(UserRecord record)
Refreshes the record: Re-read the contents of the database into the given record. |
protected UserRecord |
reload(ResultSet resultSet,
UserRecord userRecord)
WRITEME: Document this method brpocock@star-hope.org |
void |
removeRecord(UserRecord record)
|
void |
saveRecord(UserRecord r)
Save a record back to the storage system |
protected UserRecord |
set(ResultSet resultSet)
WRITEME: Document this method brpocock@star-hope.org |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int CLASS_ID_CURRENT
private static final String SAVE_RECORD_SQL
Constructor Detail |
---|
public UserRecordSQLLoader()
Method Detail |
---|
protected static void fetch_avatarInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedprotected static void fetch_chatColours(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedprotected static void fetch_dobInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedprotected static void fetch_language(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- the database record from which to be loaded
SQLException
- if the record can't be interpretedprotected static void fetch_laston(UserRecord userRecord) throws SQLException
userRecord
- record being loaded
SQLException
- if the record can't be interpreted.protected static void fetch_mailInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedprotected static void fetch_parentInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedprotected static void fetch_passwordResetInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- the database record
SQLException
- If the records can't be found, or are in an
invalid format of some kindprotected static void fetch_permissionsInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- The ResultSet being used to set the user up.
SQLException
- if the data in the record can't be
interpreted.protected static void fetch_userBasicInfo(UserRecord userRecord, ResultSet resultSet) throws SQLException
userRecord
- The UserRecord being servicedresultSet
- database record to interpret
SQLException
- if the record can't be interpretedpublic void changed(UserRecord changedRecord)
RecordLoader
changed
in interface RecordLoader<UserRecord>
changedRecord
- the record that has been changedRecordLoader.changed(org.starhope.appius.util.DataRecord)
protected void fetch_more(ResultSet resultSet) throws SQLException
resultSet
- the user record
SQLException
- if the record can't be interpretedpublic String getSubversionRevision()
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: "; }
getSubversionRevision
in interface HasSubversionRevision
HasSubversionRevision.getSubversionRevision()
public void initializeStorage(String storageURL) throws NotReadyException
initializeStorage
in interface RecordLoader<UserRecord>
storageURL
- A URL or identifier of the storage engine. The
syntax is specific to the RecordLoader implementation.
NotReadyException
- if the database can't be accessedRecordLoader.initializeStorage(java.lang.String)
public boolean isRealtime()
isRealtime
in interface RecordLoader<UserRecord>
RecordLoader.isRealtime()
public UserRecord loadRecord(int id)
RecordLoader
loadRecord
in interface RecordLoader<UserRecord>
id
- the ID number for the record
RecordLoader.loadRecord(int)
public UserRecord loadRecord(String identifier)
RecordLoader
loadRecord
in interface RecordLoader<UserRecord>
identifier
- the identifier for the record
RecordLoader.loadRecord(java.lang.String)
public void refresh(UserRecord record)
RecordLoader
SimpleDataRecord.checkStale()
to try to reload data when
it might have been changed: it's trading elegance and efficiency
for expediency, but eventually, it should be removed.
refresh
in interface RecordLoader<UserRecord>
record
- the record to be reloaded.RecordLoader.refresh(org.starhope.appius.util.DataRecord)
protected UserRecord reload(ResultSet resultSet, UserRecord userRecord) throws SQLException
resultSet
- WRITEMEuserRecord
- WRITEME
SQLException
- WRITEMEpublic void removeRecord(UserRecord record)
removeRecord
in interface RecordLoader<UserRecord>
record
- Record to be deleted/removedRecordLoader.removeRecord(org.starhope.appius.util.DataRecord)
public void saveRecord(UserRecord r)
RecordLoader
saveRecord
in interface RecordLoader<UserRecord>
r
- the record to be savedRecordLoader.saveRecord(org.starhope.appius.util.DataRecord)
protected UserRecord set(ResultSet resultSet) throws SQLException
resultSet
- WRITEME
SQLException
- WRITEME
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |