Class Account

All Implemented Interfaces:
spark.Route

public class Account extends HTMLTemplateRoute
The Account class handles the account route, displaying the user's account information.
  • Constructor Details

    • Account

      public Account(App app)
      Constructs an Account route with the specified application.
      Parameters:
      app - the application instance
  • Method Details

    • getHTMLTemplatePath

      public String getHTMLTemplatePath(spark.Request request)
      Returns the path to the HTML template for the account page.
      Specified by:
      getHTMLTemplatePath in class HTMLTemplateRoute
      Parameters:
      request - the HTTP request
      Returns:
      the path to the HTML template
    • populateContext

      public Map<String,Object> populateContext(spark.Request request, spark.Response response) throws SQLException
      Populates the context for the account page with the user's balance as "balance" and recent transactions, including deposits, withdrawals and game results, as a submap containing operation type, identifier, date and amount.
      Overrides:
      populateContext in class HTMLTemplateRoute
      Parameters:
      request - the HTTP request
      response - the HTTP response
      Returns:
      a map containing the user's balance and transactions
      Throws:
      SQLException - if an SQL error occurs
    • getNotificationDefinitions

      public Map<String,String> getNotificationDefinitions()
      Description copied from class: HTMLTemplateRoute
      Returns a map of notification definitions to be used in the Jinjava HTML template. Intended to be overridden by subclasses, providing their own definitions based on all redirects which point the user to the route with any error or success tags.
      Overrides:
      getNotificationDefinitions in class HTMLTemplateRoute
      Returns:
      the definitions as an URL name-notification message map.