use of org.orcid.jaxb.model.message.DeveloperToolsEnabled in project ORCID-Source by ORCID.
the class OrcidMessageVersionConverterImplV1_2_rc3ToV1_2_rc4 method upgradeProfile.
private void upgradeProfile(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
if (orcidProfile.getOrcidInternal() != null) {
if (orcidProfile.getOrcidInternal().getPreferences() != null) {
Preferences prefs = orcidProfile.getOrcidInternal().getPreferences();
if (prefs.getWorkVisibilityDefault() != null && prefs.getWorkVisibilityDefault().getValue() != null) {
prefs.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(prefs.getWorkVisibilityDefault().getValue()));
prefs.setWorkVisibilityDefault(null);
}
if (prefs.getDeveloperToolsEnabled() == null) {
DeveloperToolsEnabled dtn = new DeveloperToolsEnabled(false);
prefs.setDeveloperToolsEnabled(dtn);
}
}
}
}
}
use of org.orcid.jaxb.model.message.DeveloperToolsEnabled in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method testUpdatePreferences.
@Test
@Transactional
@Rollback(true)
public void testUpdatePreferences() {
OrcidProfile profile1 = createBasicProfile();
profile1 = orcidProfileManager.createOrcidProfile(profile1, false, false);
assertEquals(Visibility.PRIVATE, profile1.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue());
OrcidProfile profile2 = new OrcidProfile();
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidInternal internal = new OrcidInternal();
profile2.setOrcidInternal(internal);
Preferences preferences = new Preferences();
internal.setPreferences(preferences);
preferences.setSendChangeNotifications(new SendChangeNotifications(false));
preferences.setSendOrcidNews(new SendOrcidNews(true));
preferences.setDeveloperToolsEnabled(new DeveloperToolsEnabled(true));
preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.PUBLIC));
orcidProfileManager.updatePreferences(profile2.getOrcidIdentifier().getPath(), profile2.getOrcidInternal().getPreferences());
OrcidProfile retrievedProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
assertEquals(false, retrievedProfile.getOrcidInternal().getPreferences().getSendChangeNotifications().isValue());
assertEquals(true, retrievedProfile.getOrcidInternal().getPreferences().getSendOrcidNews().isValue());
assertEquals(true, retrievedProfile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled().isValue());
assertEquals(Visibility.PUBLIC, retrievedProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue());
}
Aggregations