Class AssistanceService

java.lang.Object
edu.kit.datamanager.takita.assistance.AssistanceService
All Implemented Interfaces:
IAssistanceService

@SessionScope @Service public class AssistanceService extends Object implements IAssistanceService
Class to handle help menu requests and to get User form Repository by its Pseudonym.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AssistanceService(UserRepository repo, IFilterService filterService, IMainPageService mainPageService)
    Constructor for the Assistance Service to autowire required instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds Row of which thumbnails are displayed to current user.
    void
    changeUser(String pseudonym, org.springframework.ui.Model model)
    Changes current User.
    Gets Pseudonym of current User.
    Gets saved language of current User.
    Gets user from database if one with this pseudonym already exists, creates new User if not.
    void
    Removes Row of which thumbnails are displayed from current user.
    void
    setLanguage(String lang, org.springframework.ui.Model model)
    set selected language for current user.
    void
    setTableConfig(String columns, org.springframework.ui.Model model)
    Saves current Table config in current User and updates Model.
    void
    setTablePage(int pageSize, org.springframework.ui.Model model)
    Set number of Results shown on one Tableview Page for current user.
    void
    setTableSort(String sort, org.springframework.ui.Model model)
    Set sort that is selected for current user.
    void
    Toggles checkThumbs Setting and saves current table config if set to true.
    void
    updateModel(org.springframework.ui.Model model)
    Update Model with everything from assistanceService.
    void
    Updates User in Repo.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AssistanceService

      @Autowired public AssistanceService(UserRepository repo, IFilterService filterService, IMainPageService mainPageService)
      Constructor for the Assistance Service to autowire required instances.
      Parameters:
      repo - instance of the User Repository giving access to user data. Injected with Springs dependency injection system indicated by @autowired annotation.
      filterService - instance of the logic for filter. Injected with Springs dependency injection system indicated by @autowired annotation.
      mainPageService - instance of the logic for mainPage. Injected with Springs dependency injection system indicated by @autowired annotation.
  • Method Details

    • getUserByPseudonym

      public User getUserByPseudonym(String pseudonym)
      Gets user from database if one with this pseudonym already exists, creates new User if not.
      Specified by:
      getUserByPseudonym in interface IAssistanceService
      Parameters:
      pseudonym - of User
      Returns:
      User from database or new User
    • getCurrentUser

      public User getCurrentUser()
      Gets Pseudonym of current User.
      Specified by:
      getCurrentUser in interface IAssistanceService
      Returns:
      pseudonym
    • changeUser

      public void changeUser(String pseudonym, org.springframework.ui.Model model)
      Changes current User.
      Specified by:
      changeUser in interface IAssistanceService
      Parameters:
      pseudonym - of new User
      model - the holder for model attributes, used to pass attributes back to the view
    • toggleCheckThumbs

      public void toggleCheckThumbs()
      Toggles checkThumbs Setting and saves current table config if set to true.
      Specified by:
      toggleCheckThumbs in interface IAssistanceService
    • updateUser

      public void updateUser()
      Updates User in Repo.
      Specified by:
      updateUser in interface IAssistanceService
    • setTableConfig

      public void setTableConfig(String columns, org.springframework.ui.Model model)
      Saves current Table config in current User and updates Model.
      Specified by:
      setTableConfig in interface IAssistanceService
      Parameters:
      columns - table config
      model - the holder for model attributes, used to pass attributes back to the view
    • setTablePage

      public void setTablePage(int pageSize, org.springframework.ui.Model model)
      Set number of Results shown on one Tableview Page for current user.
      Specified by:
      setTablePage in interface IAssistanceService
      Parameters:
      pageSize - selected number of Results
      model - the holder for model attributes, used to pass attributes back to the view
    • setTableSort

      public void setTableSort(String sort, org.springframework.ui.Model model)
      Set sort that is selected for current user.
      Specified by:
      setTableSort in interface IAssistanceService
      Parameters:
      sort - selected Sort in JSON format
      model - the holder for model attributes, used to pass attributes back to the view
    • updateModel

      public void updateModel(org.springframework.ui.Model model)
      Update Model with everything from assistanceService.
      Specified by:
      updateModel in interface IAssistanceService
      Parameters:
      model - the holder for model attributes, used to pass attributes back to the view
    • setLanguage

      public void setLanguage(String lang, org.springframework.ui.Model model)
      set selected language for current user.
      Specified by:
      setLanguage in interface IAssistanceService
      Parameters:
      lang - that is selected
      model - the holder for model attributes, used to pass attributes back to the view
    • getLang

      public String getLang()
      Gets saved language of current User.
      Specified by:
      getLang in interface IAssistanceService
      Returns:
      language
    • addRow

      public void addRow(String row)
      Adds Row of which thumbnails are displayed to current user.
      Specified by:
      addRow in interface IAssistanceService
      Parameters:
      row - to be added
    • removeRow

      public void removeRow(String row)
      Removes Row of which thumbnails are displayed from current user.
      Specified by:
      removeRow in interface IAssistanceService
      Parameters:
      row - to be removed