Class AssistanceService
java.lang.Object
edu.kit.datamanager.takita.assistance.AssistanceService
- All Implemented Interfaces:
IAssistanceService
Class to handle help menu requests and to get User form Repository by its Pseudonym.
-
Constructor Summary
ConstructorsConstructorDescriptionAssistanceService(UserRepository repo, IFilterService filterService, IMainPageService mainPageService) Constructor for the Assistance Service to autowire required instances. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds Row of which thumbnails are displayed to current user.voidchangeUser(String pseudonym, org.springframework.ui.Model model) Changes current User.Gets Pseudonym of current User.getLang()Gets saved language of current User.getUserByPseudonym(String pseudonym) Gets user from database if one with this pseudonym already exists, creates new User if not.voidRemoves Row of which thumbnails are displayed from current user.voidsetLanguage(String lang, org.springframework.ui.Model model) set selected language for current user.voidsetTableConfig(String columns, org.springframework.ui.Model model) Saves current Table config in current User and updates Model.voidsetTablePage(int pageSize, org.springframework.ui.Model model) Set number of Results shown on one Tableview Page for current user.voidsetTableSort(String sort, org.springframework.ui.Model model) Set sort that is selected for current user.voidToggles checkThumbs Setting and saves current table config if set to true.voidupdateModel(org.springframework.ui.Model model) Update Model with everything from assistanceService.voidUpdates User in Repo.
-
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
Gets user from database if one with this pseudonym already exists, creates new User if not.- Specified by:
getUserByPseudonymin interfaceIAssistanceService- Parameters:
pseudonym- of User- Returns:
- User from database or new User
-
getCurrentUser
Gets Pseudonym of current User.- Specified by:
getCurrentUserin interfaceIAssistanceService- Returns:
- pseudonym
-
changeUser
Changes current User.- Specified by:
changeUserin interfaceIAssistanceService- Parameters:
pseudonym- of new Usermodel- 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:
toggleCheckThumbsin interfaceIAssistanceService
-
updateUser
public void updateUser()Updates User in Repo.- Specified by:
updateUserin interfaceIAssistanceService
-
setTableConfig
Saves current Table config in current User and updates Model.- Specified by:
setTableConfigin interfaceIAssistanceService- Parameters:
columns- table configmodel- 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:
setTablePagein interfaceIAssistanceService- Parameters:
pageSize- selected number of Resultsmodel- the holder for model attributes, used to pass attributes back to the view
-
setTableSort
Set sort that is selected for current user.- Specified by:
setTableSortin interfaceIAssistanceService- Parameters:
sort- selected Sort in JSON formatmodel- 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:
updateModelin interfaceIAssistanceService- Parameters:
model- the holder for model attributes, used to pass attributes back to the view
-
setLanguage
set selected language for current user.- Specified by:
setLanguagein interfaceIAssistanceService- Parameters:
lang- that is selectedmodel- the holder for model attributes, used to pass attributes back to the view
-
getLang
Gets saved language of current User.- Specified by:
getLangin interfaceIAssistanceService- Returns:
- language
-
addRow
Adds Row of which thumbnails are displayed to current user.- Specified by:
addRowin interfaceIAssistanceService- Parameters:
row- to be added
-
removeRow
Removes Row of which thumbnails are displayed from current user.- Specified by:
removeRowin interfaceIAssistanceService- Parameters:
row- to be removed
-