@Override @Transactional public void updatePreferences(String orcid, Preferences preferences) { boolean sendChangeNotifications = preferences.getSendChangeNotifications() == null ? DefaultPreferences.SEND_CHANGE_NOTIFICATIONS_DEFAULT : preferences.getSendChangeNotifications().isValue(); boolean sendAdministrativeChangeNotifications = preferences.getSendAdministrativeChangeNotifications() == null ? sendChangeNotifications : preferences.getSendAdministrativeChangeNotifications().isValue(); boolean sendOrcidNews = preferences.getSendOrcidNews() == null ? DefaultPreferences.SEND_ORCID_NEWS_DEFAULT : preferences.getSendOrcidNews().isValue(); boolean sendMemberUpdateRequests = preferences.getSendMemberUpdateRequests() == null ? DefaultPreferences.SEND_MEMBER_UPDATE_REQUESTS : preferences.getSendMemberUpdateRequests(); org.orcid.jaxb.model.common_v2.Visibility activitiesVisibilityDefault = (preferences.getActivitiesVisibilityDefault().getValue() == null) ? org.orcid.jaxb.model.common_v2.Visibility.PRIVATE : org.orcid.jaxb.model.common_v2.Visibility.fromValue(preferences.getActivitiesVisibilityDefault().getValue().value()); boolean developerToolsEnabled = preferences.getDeveloperToolsEnabled() == null ? DefaultPreferences.DEVELOPER_TOOLS_ENABLED_DEFAULT : preferences.getDeveloperToolsEnabled().isValue(); float sendEmailFrequencyDays = Float .valueOf(preferences.getSendEmailFrequencyDays() == null ? DefaultPreferences.SEND_EMAIL_FREQUENCY_DAYS : preferences.getSendEmailFrequencyDays()); profileDao.updatePreferences(orcid, sendChangeNotifications, sendAdministrativeChangeNotifications, sendOrcidNews, sendMemberUpdateRequests, activitiesVisibilityDefault.name(), developerToolsEnabled, sendEmailFrequencyDays); }
public Preferences(org.orcid.jaxb.model.message.Preferences castPreferences) { this.setSendChangeNotifications(castPreferences.getSendChangeNotifications()); this.setSendAdministrativeChangeNotifications(castPreferences.getSendAdministrativeChangeNotifications()); this.setSendOrcidNews(castPreferences.getSendOrcidNews()); this.setWorkVisibilityDefault(castPreferences.getWorkVisibilityDefault()); this.setActivitiesVisibilityDefault(castPreferences.getActivitiesVisibilityDefault()); this.setDeveloperToolsEnabled(castPreferences.getDeveloperToolsEnabled()); }