@Override public void copyUpdatedContactDetailsToExistingPreservingVisibility(OrcidBio existing, OrcidBio updated) { ContactDetails existingContactDetails = existing.getContactDetails(); ContactDetails updatedContactDetails = updated.getContactDetails(); copyUpdatedAddress(existingContactDetails, updatedContactDetails); }
private void checkBio(OrcidBio orcidBio) { if (orcidBio != null) { checkContactDetails(orcidBio.getContactDetails()); } }
public boolean sendVerifiedRequiredAnnouncement2017(OrcidProfile orcidProfile) { String orcid = orcidProfile.getOrcidIdentifier().getPath(); String email = orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(); String emailFriendlyName = notificationManager.deriveEmailFriendlyName(profileDaoReadOnly.find(orcid)); String verificationUrl = notificationManager.createVerificationUrl(email, orcidUrlManager.getBaseUrl()); String emailFrequencyUrl = notificationManager.createUpdateEmailFrequencyUrl(orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue()); Map<String, Boolean> features = new HashMap<String, Boolean>(); for(Features f : Features.values()) { features.put(f.name(), f.isActive()); } Locale locale = localeManager.getLocaleFromOrcidProfile(orcidProfile); Map<String, Object> templateParams = new HashMap<String, Object>(); templateParams.put("emailName", emailFriendlyName); templateParams.put("verificationUrl", verificationUrl); templateParams.put("emailFrequencyUrl", emailFrequencyUrl); templateParams.put("orcid", orcid); templateParams.put("baseUri", orcidUrlManager.getBaseUrl()); templateParams.put("messages", this.messages); templateParams.put("messageArgs", new Object[0]); templateParams.put("locale", locale); templateParams.put("features", features); String subject = messages.getMessage("email.service_announcement.subject.imporant_information", null, locale); String text = templateManager.processTemplate("verified_required_announcement_2017.ftl", templateParams); String html = templateManager.processTemplate("verified_required_announcement_2017_html.ftl", templateParams); return mailGunManager.sendEmail("support@notify.orcid.org", email, subject, text, html); }
public boolean sendServiceAnnouncement_1_For_2015(OrcidProfile orcidProfile) { String orcid = orcidProfile.getOrcidIdentifier().getPath(); String email = orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(); String emailFriendlyName = notificationManager.deriveEmailFriendlyName(profileDaoReadOnly.find(orcid)); Map<String, Object> templateParams = new HashMap<String, Object>(); templateParams.put("emailName", emailFriendlyName); String verificationUrl = notificationManager.createVerificationUrl(email, orcidUrlManager.getBaseUrl()); boolean needsVerification = !orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().isVerified() && orcidProfile.getType().equals(org.orcid.jaxb.model.message.OrcidType.USER) && !orcidProfile.isDeactivated(); if (needsVerification) { templateParams.put("verificationUrl", verificationUrl); String emailFrequencyUrl = notificationManager.createUpdateEmailFrequencyUrl(orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue()); templateParams.put("emailFrequencyUrl", emailFrequencyUrl); templateParams.put("orcid", orcid);
@Override public OrcidProfile createOrcidProfileAndNotify(OrcidProfile orcidProfile) { OrcidProfile createdOrcidProfile = createOrcidProfile(orcidProfile, true, false); notificationManager.sendApiRecordCreationEmail(orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(), orcidProfile.getOrcidIdentifier().getPath()); return createdOrcidProfile; }
@Override public ProfileEventResult call() throws Exception { String orcidId = getOrcidProfile().getOrcidIdentifier().getPath(); if (orcidProfile.getOrcidBio() == null || orcidProfile.getOrcidBio().getContactDetails() == null || orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail() == null || orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue() == null) { return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_SKIPPED_2017); } if (orcidProfile.isLocked() || orcidProfile.isDeactivated() || orcidProfile.getOrcidDeprecated() != null || !orcidProfile.getOrcidHistory().getClaimed().isValue()) { return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_SKIPPED_2017); } Email primaryEmail = orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail(); if (primaryEmail.isVerified()) { return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_HAS_VALIDATED_2017); } else { try { boolean sent = sendVerifiedRequiredAnnouncement2017(orcidProfile); if (sent) { return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_SENT_2017); } else { return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_FAIL_2017); } } catch (Exception e) { LOG.error("ProfileEventType exception trying to send email to: " + orcidProfile.retrieveOrcidUriAsString(), e); return new ProfileEventResult(orcidId, ProfileEventType.VERIFIED_REQUIRED_FAIL_2017); } } }
/** * Add source to the profile emails * * @param orcidProfile * The profile * @param amenderOrcid * The orcid of the user or client that add the email to the * profile user */ private void addSourceToEmails(OrcidProfile orcidProfile) { if (orcidProfile != null && orcidProfile.getOrcidBio() != null && orcidProfile.getOrcidBio().getContactDetails() != null && orcidProfile.getOrcidBio().getContactDetails().getEmail() != null) { SourceEntity entity = sourceManager.retrieveSourceEntity(); for (Email email : orcidProfile.getOrcidBio().getContactDetails().getEmail()) { if (entity.getSourceClient() != null && !PojoUtil.isEmpty(entity.getSourceClient().getId())) { email.setSourceClientId(entity.getSourceClient().getId()); } else if(entity.getSourceProfile() != null && !PojoUtil.isEmpty(entity.getSourceProfile().getId())) { email.setSource(entity.getSourceProfile().getId()); } } } }
private void setBioDetails(ProfileEntity profileEntity, OrcidBio orcidBio) { if (orcidBio != null) { setBiographyDetails(profileEntity, orcidBio.getBiography()); setContactDetails(profileEntity, orcidBio.getContactDetails()); setExternalIdentifiers(profileEntity, orcidBio.getExternalIdentifiers()); setKeywords(profileEntity, orcidBio.getKeywords()); setPersonalDetails(profileEntity, orcidBio.getPersonalDetails()); setResearcherUrls(profileEntity, orcidBio.getResearcherUrls()); } }
private void assignPersistenceFields(OrcidProfile profile) { // set the transient fields that the encrypters need profile.setPassword("password"); // profile.setOrcidIdentifier(); profile.setSecurityQuestionAnswer("securityQuestionAnswer"); profile.setVerificationCode("1111"); // randomise any fields that are uniquely constrained so that we can // re-use the test data profile.getOrcidBio().getContactDetails().addOrReplacePrimaryEmail(new Email(RandomStringUtils.randomAlphabetic(150))); Keywords keywords = new Keywords(); keywords.getKeyword().add(new Keyword(RandomStringUtils.randomAlphabetic(255), Visibility.PUBLIC)); profile.getOrcidBio().setKeywords(keywords); profile.retrieveOrcidWorks().getOrcidWork(); }
String orcidId = getOrcidProfile().getOrcidIdentifier().getPath(); if (orcidProfile.getOrcidBio() == null || orcidProfile.getOrcidBio().getContactDetails() == null || orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail() == null || orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue() == null) return new ProfileEventResult(orcidId, ProfileEventType.SERVICE_ANNOUNCEMENT_SKIPPED_1_FOR_2015);
ContactDetails contactDetails = orcidBio.getContactDetails(); if (contactDetails != null) { SourceEntity entity = sourceManager.retrieveSourceEntity();
ContactDetails contactDetails = orcidBio.getContactDetails(); if (contactDetails != null) { for (Email email : contactDetails.getEmail()) {
private void downgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { orcidProfile.setAffiliations(null); OrcidBio orcidBio = orcidProfile.getOrcidBio(); if (orcidBio != null) { ContactDetails contactDetails = orcidBio.getContactDetails(); if (contactDetails != null) { for (Email email : contactDetails.getEmail()) { email.setSourceClientId(null); } } ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers(); if (extIds != null) { for (ExternalIdentifier extId : extIds.getExternalIdentifier()) { extId.setSource(null); } } } if (orcidProfile.getOrcidActivities() != null) { if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) { for (OrcidWork act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) downGradeActivity(act); } } } }
if (bio.getContactDetails() != null && bio.getContactDetails().getAddress() != null && bio.getContactDetails().getAddress().getCountry() != null) { Country country = bio.getContactDetails().getAddress().getCountry(); if (country.getSource() == null || PojoUtil.isEmpty(country.getSource().retrieveSourcePath())) { country.setSource(source);
if (orcidProfile.getOrcidBio().getContactDetails() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry() != null) { Country country = orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry(); if (isClaimed) { country.setVisibility(defaultActivityVis);
if(orcidBio.getContactDetails() != null) { Address address = orcidBio.getContactDetails().getAddress(); if(address != null) { setSourceName(address);