Search in sources :

Example 6 with OrcidInternal

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

the class OrcidProfileManagerImpl method initSecurityDetails.

private SecurityDetails initSecurityDetails(OrcidProfile cachedProfile) {
    OrcidInternal internal = cachedProfile.getOrcidInternal();
    if (internal == null) {
        internal = new OrcidInternal();
        cachedProfile.setOrcidInternal(internal);
    }
    SecurityDetails securityDetails = internal.getSecurityDetails();
    if (securityDetails == null) {
        securityDetails = new SecurityDetails();
        internal.setSecurityDetails(securityDetails);
    }
    return securityDetails;
}
Also used : OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) SecurityDetails(org.orcid.jaxb.model.message.SecurityDetails)

Example 7 with OrcidInternal

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

the class SourceInActivitiesTest method getMinimalOrcidProfile.

private OrcidProfile getMinimalOrcidProfile() {
    OrcidProfile profile = new OrcidProfile();
    OrcidBio bio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new org.orcid.jaxb.model.message.Email(System.currentTimeMillis() + "@user.com"));
    Preferences preferences = new Preferences();
    preferences.setSendChangeNotifications(new SendChangeNotifications(true));
    preferences.setSendOrcidNews(new SendOrcidNews(true));
    preferences.setSendMemberUpdateRequests(true);
    preferences.setSendEmailFrequencyDays("1");
    preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.fromValue("public")));
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setFamilyName(new FamilyName("First"));
    personalDetails.setGivenNames(new GivenNames("Last"));
    bio.setContactDetails(contactDetails);
    bio.setPersonalDetails(personalDetails);
    OrcidInternal internal = new OrcidInternal();
    internal.setPreferences(preferences);
    profile.setOrcidBio(bio);
    profile.setOrcidInternal(internal);
    OrcidHistory orcidHistory = new OrcidHistory();
    orcidHistory.setClaimed(new Claimed(true));
    orcidHistory.setCreationMethod(CreationMethod.fromValue("integration-test"));
    profile.setOrcidHistory(orcidHistory);
    orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile.setPassword("password1");
    return orcidProfileManager.createOrcidProfile(profile, false, false);
}
Also used : SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Claimed(org.orcid.jaxb.model.message.Claimed) Date(java.util.Date) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Preferences(org.orcid.jaxb.model.message.Preferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications)

Example 8 with OrcidInternal

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

the class PreferencesForm method getOrcidProfile.

public OrcidProfile getOrcidProfile() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(orcid);
    OrcidInternal internal = new OrcidInternal();
    orcidProfile.setOrcidInternal(internal);
    Preferences preferences = new Preferences();
    internal.setPreferences(preferences);
    preferences.setSendChangeNotifications((sendChangeNotifications != null && !sendChangeNotifications.isEmpty()) ? new SendChangeNotifications(true) : null);
    preferences.setSendOrcidNews((sendOrcidNews != null && !sendOrcidNews.isEmpty()) ? new SendOrcidNews(true) : null);
    return orcidProfile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) Preferences(org.orcid.jaxb.model.message.Preferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications)

Example 9 with OrcidInternal

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

the class OrcidProfileManagerImpl method deactivateOrcidProfile.

@Override
@Transactional
@Deprecated
public OrcidProfile deactivateOrcidProfile(OrcidProfile existingOrcidProfile) {
    OrcidProfile blankedOrcidProfile = new OrcidProfile();
    OrcidBio existingBio = existingOrcidProfile.getOrcidBio();
    OrcidBio minimalBio = new OrcidBio();
    ContactDetails minimalContactDetails = new ContactDetails();
    minimalContactDetails.getEmail().addAll(existingBio.getContactDetails().getEmail());
    OrcidInternal minimalOrcidInternal = new OrcidInternal();
    minimalOrcidInternal.setSecurityDetails(existingOrcidProfile.getOrcidInternal().getSecurityDetails());
    OrcidHistory deactivatedOrcidHistory = existingOrcidProfile.getOrcidHistory();
    deactivatedOrcidHistory.setDeactivationDate(new DeactivationDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    blankedOrcidProfile.setOrcidHistory(deactivatedOrcidHistory);
    // only names names from bio with a visibility setting
    PersonalDetails minimalPersonalDetails = new PersonalDetails();
    minimalPersonalDetails.setOtherNames(null);
    CreditName creditName = new CreditName();
    creditName.setVisibility(Visibility.PUBLIC);
    minimalPersonalDetails.setCreditName(creditName);
    minimalPersonalDetails.setGivenNames(new GivenNames("Given Names Deactivated"));
    minimalPersonalDetails.setFamilyName(new FamilyName("Family Name Deactivated"));
    for (Email email : minimalContactDetails.getEmail()) {
        setVisibilityToPrivate(email);
    }
    setVisibilityToPrivate(minimalPersonalDetails.getOtherNames());
    if (minimalPersonalDetails.getOtherNames() != null && minimalPersonalDetails.getOtherNames().getOtherName() != null) {
        for (OtherName name : minimalPersonalDetails.getOtherNames().getOtherName()) setVisibilityToPrivate(name);
    }
    minimalBio.setPersonalDetails(minimalPersonalDetails);
    minimalBio.setContactDetails(minimalContactDetails);
    minimalBio.setBiography(new Biography());
    minimalBio.setExternalIdentifiers(new ExternalIdentifiers());
    blankedOrcidProfile.setOrcidBio(minimalBio);
    blankedOrcidProfile.setOrcidIdentifier(existingOrcidProfile.getOrcidIdentifier().getPath());
    OrcidProfile profileToReturn = updateOrcidProfile(blankedOrcidProfile);
    userConnectionDao.deleteByOrcid(existingOrcidProfile.getOrcidIdentifier().getPath());
    notificationManager.sendAmendEmail(profileToReturn, AmendedSection.UNKNOWN);
    return profileToReturn;
}
Also used : Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) DeactivationDate(org.orcid.jaxb.model.message.DeactivationDate) Date(java.util.Date) DeactivationDate(org.orcid.jaxb.model.message.DeactivationDate) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) GivenNames(org.orcid.jaxb.model.message.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with OrcidInternal

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

the class SetUpClientsAndUsers method createUser.

private void createUser(Map<String, String> params) throws Exception {
    // Create it
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(new OrcidIdentifier(params.get(ORCID)));
    orcidProfile.setType(OrcidType.fromValue(params.get(ORCID_TYPE)));
    if (params.get(MEMBER_TYPE) != null) {
        orcidProfile.setGroupType(MemberType.fromValue(params.get(MEMBER_TYPE)));
    }
    orcidProfile.setPassword(params.get(PASSWORD));
    OrcidInternal internal = new OrcidInternal();
    Preferences preferences = new Preferences();
    ActivitiesVisibilityDefault visibilityDefaults = new ActivitiesVisibilityDefault();
    visibilityDefaults.setValue(Visibility.PUBLIC);
    preferences.setActivitiesVisibilityDefault(visibilityDefaults);
    internal.setPreferences(preferences);
    orcidProfile.setOrcidInternal(internal);
    Email email = new Email(params.get(EMAIL));
    email.setCurrent(true);
    email.setPrimary(true);
    email.setVerified(true);
    email.setVisibility(Visibility.PUBLIC);
    List<Email> emails = new ArrayList<Email>();
    emails.add(email);
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.setEmail(emails);
    org.orcid.jaxb.model.message.PersonalDetails personalDetails = new org.orcid.jaxb.model.message.PersonalDetails();
    org.orcid.jaxb.model.message.CreditName creditName = new org.orcid.jaxb.model.message.CreditName(params.get(CREDIT_NAME));
    creditName.setVisibility(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility());
    personalDetails.setCreditName(creditName);
    personalDetails.setFamilyName(new org.orcid.jaxb.model.message.FamilyName(params.get(FAMILY_NAMES)));
    personalDetails.setGivenNames(new org.orcid.jaxb.model.message.GivenNames(params.get(GIVEN_NAMES)));
    OrcidBio bio = new OrcidBio();
    bio.setContactDetails(contactDetails);
    bio.setPersonalDetails(personalDetails);
    bio.setBiography(new Biography(params.get(BIO), OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility()));
    orcidProfile.setOrcidBio(bio);
    OrcidHistory history = new OrcidHistory();
    history.setClaimed(new Claimed(true));
    history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    history.setCreationMethod(CreationMethod.DIRECT);
    orcidProfile.setOrcidHistory(history);
    orcidProfileManager.createOrcidProfile(orcidProfile, false, false);
    if (params.containsKey(LOCKED)) {
        orcidProfileManager.lockProfile(params.get(ORCID), LockReason.SPAM.getLabel(), null);
    }
    if (params.containsKey(DEVELOPER_TOOLS)) {
        profileEntityManager.enableDeveloperTools(orcidProfile);
    }
}
Also used : Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) ArrayList(java.util.ArrayList) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) Biography(org.orcid.jaxb.model.message.Biography) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Preferences(org.orcid.jaxb.model.message.Preferences) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Claimed(org.orcid.jaxb.model.message.Claimed) Date(java.util.Date) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory)

Aggregations

OrcidInternal (org.orcid.jaxb.model.message.OrcidInternal)14 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)12 Preferences (org.orcid.jaxb.model.message.Preferences)10 Date (java.util.Date)7 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)7 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)7 ActivitiesVisibilityDefault (org.orcid.jaxb.model.message.ActivitiesVisibilityDefault)6 Claimed (org.orcid.jaxb.model.message.Claimed)6 SendChangeNotifications (org.orcid.jaxb.model.message.SendChangeNotifications)6 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)6 Test (org.junit.Test)5 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)5 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)5 SendOrcidNews (org.orcid.jaxb.model.message.SendOrcidNews)5 Transactional (org.springframework.transaction.annotation.Transactional)5 DefaultPreferences (org.orcid.core.constants.DefaultPreferences)4 Email (org.orcid.jaxb.model.message.Email)4 FamilyName (org.orcid.jaxb.model.message.FamilyName)4 GivenNames (org.orcid.jaxb.model.message.GivenNames)4 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)4