Class AchievementDAO

java.lang.Object
games.stendhal.server.core.engine.db.AchievementDAO

public class AchievementDAO extends Object
DAO to handle achievements for the stendhal website
Author:
madmetzger
  • 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 - DBTransaction
      achievementId - id of achievement
      playerName - name of player
      timestamp - timestamp
      Throws:
      SQLException - in case of an database error
    • insertAchievement

      public int insertAchievement(Achievement achievement) throws SQLException
      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 save
      transaction - 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

      public void updateAchievement(Integer id, Achievement achievement) throws SQLException
      Updates the achievement with the given id
      Parameters:
      id - id of achievement
      achievement - 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 - DBTransaction
      id - id of achievement
      achievement - Achievement
      Throws:
      SQLException - in case of an database error
    • loadIdentifierIdPairs

      public Map<String,​Integer> loadIdentifierIdPairs() throws SQLException
      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

      public Map<String,​Integer> loadIdentifierIdPairs(DBTransaction transaction) throws SQLException
      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

      public Set<String> loadAllReachedAchievementsOfPlayer(String playerName) throws SQLException
      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 - DBTransaction
      playerName - name of player
      Returns:
      set identifiers of achievements reached by playerName
      Throws:
      SQLException - in case of an database error