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());
}
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());
}
}
}
Aggregations