public Date getPreferencesDate() { String username = getUsername(); try { UserPreferences userPreferences = (UserPreferences) storageService.getEntity(UserPreferences.getPath(username)); return userPreferences.getCreatedDate(); } catch (NotFoundException e) { return new Date(); } }
public Map<String, String> getPreferences() { String username = getUsername(); try { UserPreferences userPreferences = (UserPreferences) storageService.getEntity(UserPreferences.getPath(username)); return userPreferences.getPreferences(); } catch (NotFoundException e) { return new HashMap<String, String>(); } }
public void setPreferences(Map<String, String> preferences) { String username = SecurityUtil.getLoggedUsername(); UserPreferences userPreferences; try { userPreferences = (UserPreferences) storageService.getEntity(UserPreferences.getPath(username)); } catch (NotFoundException e) { userPreferences = new UserPreferences(username); } userPreferences.setPreferences(preferences); storageService.addOrModifyEntity(userPreferences); }