Package marauroa.server.game.db
Class CharacterDAO
java.lang.Object
marauroa.server.game.db.CharacterDAO
- Direct Known Subclasses:
StendhalCharacterDAO
data access object for characters
- Author:
- miguel, hendrik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCharacter(String username, String character, RPObject player)
Deprecated.void
addCharacter(DBTransaction transaction, String username, String character, RPObject player)
Deprecated.void
addCharacter(DBTransaction transaction, String username, String character, RPObject player, Timestamp timestamp)
creates a new charactergetAccountName(String character)
Deprecated.getAccountName(DBTransaction transaction, String character)
gets the name of the account to which the specified character belongs.getCanonicalName(String character)
Deprecated.getCanonicalName(DBTransaction transaction, String character)
gets the canonical spelling of the character namegetCharacters(String username)
Deprecated.getCharacters(DBTransaction transaction, String username)
gets a list of characters for this accountgetCreationDate(String character)
Deprecated.getCreationDate(DBTransaction transaction, String character)
Gets the date the character was registeredboolean
hasActiveCharacter(String username, String character)
Deprecated.boolean
hasActiveCharacter(DBTransaction transaction, String username, String character)
checks whether the specified account owns the specified character and it is activeboolean
hasCharacter(String character)
Deprecated.boolean
hasCharacter(String username, String character)
Deprecated.boolean
hasCharacter(DBTransaction transaction, String character)
checks whether the specified character existsboolean
hasCharacter(DBTransaction transaction, String username, String character)
checks whether the specified account owns the specified characterboolean
isCharacterCreationLimitReached(String username, String address)
Deprecated.boolean
isCharacterCreationLimitReached(DBTransaction transaction, String username, String address)
is the character creation limit reached?loadAllActiveCharacters(String username)
Deprecated.loadAllActiveCharacters(DBTransaction transaction, String username)
This method loads all active the characters associated with this username from the database.loadAllCharacters(String username)
Deprecated.loadAllCharacters(DBTransaction transaction, String username)
This method loads all the characters associated with this username from the database.loadCharacter(String username, String character)
Deprecated.loadCharacter(DBTransaction transaction, String username, String character)
This method loads the character's avatar associated with this character from the database.boolean
removeCharacter(String username, String character)
Deprecated.boolean
removeCharacter(DBTransaction transaction, String username, String character)
deletes a charactervoid
setCharacterStatus(String username, String character, String status)
Deprecated.void
setCharacterStatus(DBTransaction transaction, String username, String character, String status)
Modifies a character status.void
storeCharacter(String username, String character, RPObject player)
Deprecated.void
storeCharacter(DBTransaction transaction, String username, String character, RPObject player)
Deprecated.void
storeCharacter(DBTransaction transaction, String username, String character, RPObject player, Timestamp timestamp)
This method stores a character's avatar in the database and updates the link with the Character table.
-
Constructor Details
-
CharacterDAO
protected CharacterDAO()Creates a new CharacterDAO
-
-
Method Details
-
addCharacter
@Deprecated public void addCharacter(DBTransaction transaction, String username, String character, RPObject player) throws SQLException, IOExceptionDeprecated.creates a new character- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of characterplayer
- RPObject of the player- Throws:
IOException
- in case of an input/output errorSQLException
- in case of an database error
-
addCharacter
public void addCharacter(DBTransaction transaction, String username, String character, RPObject player, Timestamp timestamp) throws SQLException, IOExceptioncreates a new character- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of characterplayer
- RPObject of the playertimestamp
- timestamp- Throws:
IOException
- in case of an input/output errorSQLException
- in case of an database error
-
removeCharacter
public boolean removeCharacter(DBTransaction transaction, String username, String character) throws SQLExceptiondeletes a character- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of character- Returns:
- true, if the character was deleted, false if it did not exist
- Throws:
SQLException
- in case of an database error
-
hasCharacter
checks whether the specified character exists- Parameters:
transaction
- DBTransactioncharacter
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
hasCharacter
public boolean hasCharacter(DBTransaction transaction, String username, String character) throws SQLExceptionchecks whether the specified account owns the specified character- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
hasActiveCharacter
public boolean hasActiveCharacter(DBTransaction transaction, String username, String character) throws SQLExceptionchecks whether the specified account owns the specified character and it is active- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
getCharacters
gets a list of characters for this account- Parameters:
transaction
- DBTransactionusername
- username- Returns:
- list of characters
- Throws:
SQLException
- in case of an database error
-
storeCharacter
@Deprecated public void storeCharacter(DBTransaction transaction, String username, String character, RPObject player) throws SQLException, IOExceptionDeprecated.This method stores a character's avatar in the database and updates the link with the Character table.- Parameters:
transaction
- the database transactionusername
- the player's usernamecharacter
- the player's character nameplayer
- the RPObject itself.- Throws:
SQLException
- if there is any problem at database.IOException
-
storeCharacter
public void storeCharacter(DBTransaction transaction, String username, String character, RPObject player, Timestamp timestamp) throws SQLException, IOExceptionThis method stores a character's avatar in the database and updates the link with the Character table.- Parameters:
transaction
- the database transactionusername
- the player's usernamecharacter
- the player's character nameplayer
- the RPObject itself.timestamp
- timestamp- Throws:
SQLException
- if there is any problem at database.IOException
-
loadCharacter
public RPObject loadCharacter(DBTransaction transaction, String username, String character) throws SQLException, IOExceptionThis method loads the character's avatar associated with this character from the database.- Parameters:
transaction
- the database transactionusername
- the player's usernamecharacter
- the player's character name- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
-
loadAllCharacters
public Map<String,RPObject> loadAllCharacters(DBTransaction transaction, String username) throws SQLException, IOExceptionThis method loads all the characters associated with this username from the database.- Parameters:
transaction
- the database transactionusername
- the player's username- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
- if there is a problem reading the blob
-
loadAllActiveCharacters
public Map<String,RPObject> loadAllActiveCharacters(DBTransaction transaction, String username) throws SQLException, IOExceptionThis method loads all active the characters associated with this username from the database.- Parameters:
transaction
- the database transactionusername
- the player's username- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
- if there is a problem reading the blob
-
getAccountName
gets the name of the account to which the specified character belongs.- Parameters:
transaction
- the database transactioncharacter
- name of character- Returns:
- name of account, or
null
in case the character does not exist
- Throws:
SQLException
- if there is any problem at database
-
getCanonicalName
gets the canonical spelling of the character name- Parameters:
transaction
- the database transactioncharacter
- name of character- Returns:
- name of character, or
null
in case the character does not exist
- Throws:
SQLException
- if there is any problem at database
-
isCharacterCreationLimitReached
public boolean isCharacterCreationLimitReached(DBTransaction transaction, String username, String address) throws IOException, SQLExceptionis the character creation limit reached?- Parameters:
transaction
- the database transactionusername
- username of accountaddress
- ip-address of client- Returns:
- true if too many characters have been created
- Throws:
IOException
- in case of an input output errorSQLException
- if there is any problem at database
-
getCreationDate
Gets the date the character was registered- Parameters:
transaction
- DBTransactioncharacter
- name of character- Returns:
- date of character creation or null if no character with that name exists
- Throws:
SQLException
- in case of an database error
-
setCharacterStatus
public void setCharacterStatus(DBTransaction transaction, String username, String character, String status) throws SQLException, IOExceptionModifies a character status.- Parameters:
transaction
- DBTransactionusername
- usernamecharacter
- name of characterstatus
- status to set- Throws:
IOException
- in case of an input/output errorSQLException
- in case of an database error
-
addCharacter
@Deprecated public void addCharacter(String username, String character, RPObject player) throws SQLException, IOExceptionDeprecated.creates a new character- Parameters:
username
- usernamecharacter
- name of characterplayer
- RPObject of the player- Throws:
IOException
- in case of an input/output errorSQLException
- in case of an database error
-
removeCharacter
Deprecated.deletes a character- Parameters:
username
- usernamecharacter
- name of character- Returns:
- true, if the character was deleted, false if it did not exist
- Throws:
SQLException
- in case of an database error
-
hasCharacter
Deprecated.checks whether the specified character exists- Parameters:
character
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
hasCharacter
Deprecated.checks whether the specified account owns the specified character- Parameters:
username
- usernamecharacter
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
hasActiveCharacter
@Deprecated public boolean hasActiveCharacter(String username, String character) throws SQLExceptionDeprecated.checks whether the specified account owns the specified character and it is active- Parameters:
username
- usernamecharacter
- name of character- Returns:
- true, if the character exists and belongs to the account; false otherwise
- Throws:
SQLException
- in case of an database error
-
getCharacters
Deprecated.gets a list of characters for this account- Parameters:
username
- username- Returns:
- list of characters
- Throws:
SQLException
- in case of an database error
-
storeCharacter
@Deprecated public void storeCharacter(String username, String character, RPObject player) throws SQLException, IOExceptionDeprecated.This method stores a character's avatar in the database and updates the link with the Character table.- Parameters:
username
- the player's usernamecharacter
- the player's character nameplayer
- the RPObject itself.- Throws:
SQLException
- if there is any problem at database.IOException
-
loadCharacter
@Deprecated public RPObject loadCharacter(String username, String character) throws SQLException, IOExceptionDeprecated.This method loads the character's avatar associated with this character from the database.- Parameters:
username
- the player's usernamecharacter
- the player's character name- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
-
loadAllCharacters
@Deprecated public Map<String,RPObject> loadAllCharacters(String username) throws SQLException, IOExceptionDeprecated.This method loads all the characters associated with this username from the database.- Parameters:
username
- the player's username- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
- if there is a problem reading the blob
-
loadAllActiveCharacters
@Deprecated public Map<String,RPObject> loadAllActiveCharacters(String username) throws SQLException, IOExceptionDeprecated.This method loads all active the characters associated with this username from the database.- Parameters:
username
- the player's username- Returns:
- The loaded RPObject
- Throws:
SQLException
- if there is any problem at databaseIOException
- if there is a problem reading the blob
-
getAccountName
Deprecated.gets the name of the account to which the specified character belongs.- Parameters:
character
- name of character- Returns:
- name of account, or
null
in case the character does not exist
- Throws:
SQLException
- if there is any problem at database
-
getCanonicalName
Deprecated.gets the canonical spelling of the character name- Parameters:
character
- name of character- Returns:
- name of character, or
null
in case the character does not exist
- Throws:
SQLException
- if there is any problem at database
-
isCharacterCreationLimitReached
@Deprecated public boolean isCharacterCreationLimitReached(String username, String address) throws IOException, SQLExceptionDeprecated.is the character creation limit reached?- Parameters:
username
- username of accountaddress
- ip-address of client- Returns:
- true if too many characters have been created
- Throws:
IOException
- in case of an input output errorSQLException
- if there is any problem at database
-
getCreationDate
Deprecated.Gets the date the character was registered- Parameters:
character
- name of character- Returns:
- date of character creation or null if no character with that name exists
- Throws:
SQLException
- in case of an database error
-
setCharacterStatus
@Deprecated public void setCharacterStatus(String username, String character, String status) throws SQLException, IOExceptionDeprecated.Modifies a character status.- Parameters:
username
- usernamecharacter
- name of characterstatus
- status to set- Throws:
IOException
- in case of an input/output errorSQLException
- in case of an database error
-