Search in sources :

Example 6 with SecurityDetails

use of org.orcid.jaxb.model.message.SecurityDetails in project ORCID-Source by ORCID.

the class JpaJaxbEntityAdapterToOrcidProfileTest method checkOrcidInternal.

private void checkOrcidInternal(OrcidInternal orcidInternal) {
    SecurityDetails securityDetails = orcidInternal.getSecurityDetails();
    assertNotNull(securityDetails);
    assertEquals("e9adO9I4UpBwqI5tGR+qDodvAZ7mlcISn+T+kyqXPf2Z6PPevg7JijqYr6KGO8VOskOYqVOEK2FEDwebxWKGDrV/TQ9gRfKWZlzxssxsOnA=", securityDetails.getEncryptedPassword().getContent());
    assertEquals(1, securityDetails.getSecurityQuestionId().getValue());
    assertEquals("iTlIoR2JsFl5guE56cazmg==", securityDetails.getEncryptedSecurityAnswer().getContent());
    assertEquals("1vLkD2Lm8c24TyALcW0Brg==", securityDetails.getEncryptedVerificationCode().getContent());
    Preferences preferences = orcidInternal.getPreferences();
    assertNotNull(preferences);
    assertTrue(preferences.getSendChangeNotifications().isValue());
    assertFalse(preferences.getSendOrcidNews().isValue());
}
Also used : SecurityDetails(org.orcid.jaxb.model.message.SecurityDetails) Preferences(org.orcid.jaxb.model.message.Preferences)

Example 7 with SecurityDetails

use of org.orcid.jaxb.model.message.SecurityDetails in project ORCID-Source by ORCID.

the class Jaxb2JpaAdapterImpl method setInternalDetails.

private void setInternalDetails(ProfileEntity profileEntity, OrcidInternal orcidInternal) {
    if (orcidInternal != null) {
        SecurityDetails securityDetails = orcidInternal.getSecurityDetails();
        if (securityDetails != null) {
            String encryptedPassword = securityDetails.getEncryptedPassword() != null ? securityDetails.getEncryptedPassword().getContent() : null;
            profileEntity.setEncryptedPassword(encryptedPassword);
            profileEntity.setSecurityQuestion(securityDetails.getSecurityQuestionId() == null ? null : securityQuestionDao.find((int) securityDetails.getSecurityQuestionId().getValue()));
            String encryptedAnswer = securityDetails.getEncryptedSecurityAnswer() != null ? securityDetails.getEncryptedSecurityAnswer().getContent() : null;
            profileEntity.setEncryptedSecurityAnswer(encryptedAnswer);
            String verificationCode = securityDetails.getEncryptedVerificationCode() != null ? securityDetails.getEncryptedVerificationCode().getContent() : null;
            profileEntity.setEncryptedVerificationCode(verificationCode);
        }
        if (orcidInternal.getReferredBy() != null) {
            profileEntity.setReferredBy(orcidInternal.getReferredBy().getPath());
        }
        Preferences preferences = orcidInternal.getPreferences();
        if (preferences != null) {
            String sendEmailFrequencyDays = preferences.getSendEmailFrequencyDays();
            profileEntity.setSendEmailFrequencyDays(Float.valueOf(sendEmailFrequencyDays == null ? DefaultPreferences.SEND_EMAIL_FREQUENCY_DAYS : sendEmailFrequencyDays));
            profileEntity.setSendChangeNotifications(preferences.getSendChangeNotifications() == null ? null : preferences.getSendChangeNotifications().isValue());
            profileEntity.setSendOrcidNews(preferences.getSendOrcidNews() == null ? null : preferences.getSendOrcidNews().isValue());
            profileEntity.setSendMemberUpdateRequests(preferences.getSendMemberUpdateRequests() == null ? null : preferences.getSendMemberUpdateRequests());
            // ActivitiesVisibilityDefault default is WorkVisibilityDefault
            if (preferences.getActivitiesVisibilityDefault() != null && preferences.getActivitiesVisibilityDefault().getValue() != null) {
                profileEntity.setActivitiesVisibilityDefault(org.orcid.jaxb.model.common_v2.Visibility.fromValue(preferences.getActivitiesVisibilityDefault().getValue().value()));
            }
            if (preferences.getDeveloperToolsEnabled() != null) {
                profileEntity.setEnableDeveloperTools(preferences.getDeveloperToolsEnabled().isValue());
            }
            profileEntity.setEnableNotifications(preferences.getNotificationsEnabled() == null ? DefaultPreferences.NOTIFICATIONS_ENABLED : preferences.getNotificationsEnabled());
        }
        if (orcidInternal.getSalesforceId() != null) {
            profileEntity.setSalesforeId(orcidInternal.getSalesforceId().getContent());
        }
    }
}
Also used : SecurityDetails(org.orcid.jaxb.model.message.SecurityDetails) Preferences(org.orcid.jaxb.model.message.Preferences) OrcidPreferences(org.orcid.jaxb.model.message.OrcidPreferences) DefaultPreferences(org.orcid.core.constants.DefaultPreferences)

Aggregations

SecurityDetails (org.orcid.jaxb.model.message.SecurityDetails)7 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)4 OrcidInternal (org.orcid.jaxb.model.message.OrcidInternal)3 Preferences (org.orcid.jaxb.model.message.Preferences)3 SecurityQuestionId (org.orcid.jaxb.model.message.SecurityQuestionId)3 DefaultPreferences (org.orcid.core.constants.DefaultPreferences)1 Biography (org.orcid.jaxb.model.message.Biography)1 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)1 Email (org.orcid.jaxb.model.message.Email)1 EncryptedPassword (org.orcid.jaxb.model.message.EncryptedPassword)1 EncryptedSecurityAnswer (org.orcid.jaxb.model.message.EncryptedSecurityAnswer)1 FamilyName (org.orcid.jaxb.model.message.FamilyName)1 GivenNames (org.orcid.jaxb.model.message.GivenNames)1 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)1 OrcidPreferences (org.orcid.jaxb.model.message.OrcidPreferences)1 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)1 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)1 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)1 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)1 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)1