Class AchievementDAO
java.lang.Object
games.stendhal.server.core.engine.db.AchievementDAO
DAO to handle achievements for the stendhal website
- Author:
- madmetzger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintinsertAchievement(Achievement achievement) Saves the base data of an achievementintinsertAchievement(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 serialvoidsaveReachedAchievement(DBTransaction transaction, Integer achievementId, String playerName, boolean incReachedCount, Timestamp timestamp) logs a reached achievement into the databasevoidupdateAchievement(Integer id, Achievement achievement) Updates the achievement with the given idvoidupdateAchievement(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 SQLException logs 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 SQLException Saves 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 SQLException Updates 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 SQLException Loads 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
-