Class AchievementDAO
java.lang.Object
games.stendhal.server.core.engine.db.AchievementDAO
DAO to handle achievements for the stendhal website
- Author:
- madmetzger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
insertAchievement(Achievement achievement)
Saves the base data of an achievementint
insertAchievement(DBTransaction transaction, Achievement achievement)
Saves the base data of an achievementloadAllReachedAchievementsOfPlayer(String playerName)
Loads all achievements a player has reachedloadAllReachedAchievementsOfPlayer(DBTransaction transaction, String playerName)
Loads all achievements a player has reachedLoads a map from achievement identifier to database serialloadIdentifierIdPairs(DBTransaction transaction)
Loads a map from achievement identifier to database serialvoid
saveReachedAchievement(DBTransaction transaction, Integer achievementId, String playerName, boolean incReachedCount, Timestamp timestamp)
logs a reached achievement into the databasevoid
updateAchievement(Integer id, Achievement achievement)
Updates the achievement with the given idvoid
updateAchievement(DBTransaction transaction, Integer id, Achievement achievement)
Updates the achievement with the given id
-
Constructor Details
-
AchievementDAO
public AchievementDAO()
-
-
Method Details
-
saveReachedAchievement
public void saveReachedAchievement(DBTransaction transaction, Integer achievementId, String playerName, boolean incReachedCount, Timestamp timestamp) throws SQLExceptionlogs a reached achievement into the database- Parameters:
transaction
- DBTransactionachievementId
- id of achievementplayerName
- name of playertimestamp
- timestamp- Throws:
SQLException
- in case of an database error
-
insertAchievement
Saves the base data of an achievement- Parameters:
achievement
- Achievement to save- Returns:
- the id of the stored achievement
- Throws:
SQLException
- in case of an database error
-
insertAchievement
public int insertAchievement(DBTransaction transaction, Achievement achievement) throws SQLExceptionSaves the base data of an achievement- Parameters:
achievement
- Achievement to savetransaction
- a database transaction to execute the save operation in- Returns:
- the id of the stored achievement
- Throws:
SQLException
- in case of an database error
-
updateAchievement
Updates the achievement with the given id- Parameters:
id
- id of achievementachievement
- Achievement- Throws:
SQLException
- in case of an database error
-
updateAchievement
public void updateAchievement(DBTransaction transaction, Integer id, Achievement achievement) throws SQLExceptionUpdates the achievement with the given id- Parameters:
transaction
- DBTransactionid
- id of achievementachievement
- Achievement- Throws:
SQLException
- in case of an database error
-
loadIdentifierIdPairs
Loads a map from achievement identifier to database serial- Returns:
- map with key identifier string and value database id
- Throws:
SQLException
- in case of an database error
-
loadIdentifierIdPairs
Loads a map from achievement identifier to database serial- Parameters:
transaction
- DBTransaction- Returns:
- map with key identifier string and value database id
- Throws:
SQLException
- in case of an database error
-
loadAllReachedAchievementsOfPlayer
Loads all achievements a player has reached- Parameters:
playerName
- name of player- Returns:
- set identifiers of achievements reached by playerName
- Throws:
SQLException
- in case of an database error
-
loadAllReachedAchievementsOfPlayer
public Set<String> loadAllReachedAchievementsOfPlayer(DBTransaction transaction, String playerName) throws SQLExceptionLoads all achievements a player has reached- Parameters:
transaction
- DBTransactionplayerName
- name of player- Returns:
- set identifiers of achievements reached by playerName
- Throws:
SQLException
- in case of an database error
-