Search in sources :

Example 16 with PersonalDetails

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

the class T2OrcidApiServiceVersionedDelegatorTest method createStubOrcidMessage.

private OrcidMessage createStubOrcidMessage() {
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion("1.2_rc6");
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidMessage.setOrcidProfile(orcidProfile);
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    PersonalDetails personalDetails = new PersonalDetails();
    orcidBio.setPersonalDetails(personalDetails);
    GivenNames givenNames = new GivenNames("Test given names");
    personalDetails.setGivenNames(givenNames);
    CreditName creditName = new CreditName("Test credit name");
    personalDetails.setCreditName(creditName);
    creditName.setVisibility(Visibility.LIMITED);
    ContactDetails contactDetails = new ContactDetails();
    orcidBio.setContactDetails(contactDetails);
    return orcidMessage;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails)

Example 17 with PersonalDetails

use of org.orcid.jaxb.model.message.PersonalDetails 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 18 with PersonalDetails

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

the class OrcidProfileManagerReadOnlyImpl method createReservedForClaimOrcidProfile.

protected OrcidProfile createReservedForClaimOrcidProfile(String orcid, OrcidDeprecated deprecatedInfo, LastModifiedDate lastModifiedDate) {
    OrcidProfile op = new OrcidProfile();
    if (jpaJaxbAdapter != null) {
        op.setOrcidIdentifier(new OrcidIdentifier(jpaJaxbAdapter.getOrcidIdBase(orcid)));
    } else {
        op.setOrcidIdentifier(orcid);
    }
    if (deprecatedInfo != null)
        op.setOrcidDeprecated(deprecatedInfo);
    OrcidHistory oh = new OrcidHistory();
    oh.setClaimed(new Claimed(false));
    oh.setLastModifiedDate(lastModifiedDate);
    op.setOrcidHistory(oh);
    GivenNames gn = new GivenNames();
    PersonalDetails pd = new PersonalDetails();
    gn.setContent(localeManager.resolveMessage("orcid.reserved_for_claim"));
    gn.setVisibility(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility());
    pd.setGivenNames(gn);
    OrcidBio ob = new OrcidBio();
    ob.setPersonalDetails(pd);
    op.setOrcidBio(ob);
    return op;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) GivenNames(org.orcid.jaxb.model.message.GivenNames) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Claimed(org.orcid.jaxb.model.message.Claimed)

Example 19 with PersonalDetails

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

the class RDFWriterTest method fakeBio.

private OrcidMessage fakeBio() throws DatatypeConfigurationException {
    OrcidMessage orcidMessage = new OrcidMessage();
    OrcidProfile orcidProfile1 = new OrcidProfile();
    OrcidIdentifier orcidIdentifier = new OrcidIdentifier();
    orcidProfile1.setOrcidIdentifier(orcidIdentifier);
    orcidIdentifier.setUri("http://orcid.example.com/000-1337");
    orcidIdentifier.setPath("000-1337");
    OrcidBio bio = new OrcidBio();
    orcidProfile1.setOrcidBio(bio);
    OrcidHistory history = new OrcidHistory();
    XMLGregorianCalendar value = dataTypeFactory.newXMLGregorianCalendar(1980, 12, 31, 23, 29, 29, 999, 0);
    history.setCreationMethod(CreationMethod.WEBSITE);
    history.setLastModifiedDate(new LastModifiedDate(value));
    orcidProfile1.setOrcidHistory(history);
    PersonalDetails personal = new PersonalDetails();
    bio.setPersonalDetails(personal);
    personal.setFamilyName(new FamilyName("Doe"));
    personal.setCreditName(new CreditName("John F Doe"));
    personal.setGivenNames(new GivenNames("John"));
    personal.setOtherNames(new OtherNames());
    personal.getOtherNames().addOtherName("Johnny", Visibility.PUBLIC);
    personal.getOtherNames().addOtherName("Mr Doe", Visibility.PUBLIC);
    ResearcherUrls urls = new ResearcherUrls();
    bio.setResearcherUrls(urls);
    ResearcherUrl anonymous = new ResearcherUrl(new Url("http://example.com/anon"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(anonymous);
    // "home page" - with strange casing
    ResearcherUrl homePage = new ResearcherUrl(new Url("http://example.com/myPage"), new UrlName("homePage"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(homePage);
    ResearcherUrl foaf = new ResearcherUrl(new Url("http://example.com/foaf#me"), new UrlName("FOAF"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(foaf);
    ResearcherUrl webId = new ResearcherUrl(new Url("http://example.com/webId"), new UrlName("webID"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(webId);
    ResearcherUrl other = new ResearcherUrl(new Url("http://example.com/other"), new UrlName("other"), Visibility.PUBLIC);
    urls.getResearcherUrl().add(other);
    bio.setContactDetails(new ContactDetails());
    bio.getContactDetails().setEmail(Arrays.asList(new Email("john@example.org"), new Email("doe@example.com")));
    bio.getContactDetails().setAddress(new Address());
    bio.getContactDetails().getAddress().setCountry(new Country(Iso3166Country.GB));
    orcidMessage.setOrcidProfile(orcidProfile1);
    return orcidMessage;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.message.LastModifiedDate) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) CreditName(org.orcid.jaxb.model.message.CreditName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country) Country(org.orcid.jaxb.model.message.Country) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl)

Example 20 with PersonalDetails

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

the class OrcidProfileManagerImplTest method before.

@Before
@Transactional
@Rollback
public void before() throws Exception {
    OrcidProfileManagerImpl orcidProfileManagerImpl = getTargetObject(orcidProfileManager, OrcidProfileManagerImpl.class);
    orcidProfileManagerImpl.setNotificationManager(notificationManager);
    if (profileDao.find(TEST_ORCID) != null) {
        profileDao.remove(TEST_ORCID);
    }
    subjectDao.merge(new SubjectEntity("Computer Science"));
    subjectDao.merge(new SubjectEntity("Dance"));
    OrcidProfile delegateProfile = new OrcidProfile();
    delegateProfile.setOrcidIdentifier(DELEGATE_ORCID);
    OrcidBio delegateBio = new OrcidBio();
    delegateProfile.setOrcidBio(delegateBio);
    PersonalDetails delegatePersonalDetails = new PersonalDetails();
    delegateBio.setPersonalDetails(delegatePersonalDetails);
    CreditName delegateCreditName = new CreditName("H. Shearer");
    delegateCreditName.setVisibility(Visibility.PUBLIC);
    delegatePersonalDetails.setCreditName(delegateCreditName);
    orcidProfileManager.createOrcidProfile(delegateProfile, false, false);
    OrcidProfile applicationProfile = new OrcidProfile();
    applicationProfile.setOrcidIdentifier(APPLICATION_ORCID);
    OrcidBio applicationBio = new OrcidBio();
    applicationProfile.setOrcidBio(applicationBio);
    PersonalDetails applicationPersonalDetails = new PersonalDetails();
    applicationBio.setPersonalDetails(applicationPersonalDetails);
    applicationPersonalDetails.setCreditName(new CreditName("Brown University"));
    orcidProfileManager.createOrcidProfile(applicationProfile, false, false);
    ClientDetailsEntity clientDetails = new ClientDetailsEntity();
    clientDetails.setId(applicationProfile.getOrcidIdentifier().getPath());
    ProfileEntity applicationProfileEntity = profileDao.find(applicationProfile.getOrcidIdentifier().getPath());
    profileDao.refresh(applicationProfileEntity);
    clientDetails.setGroupProfileId(applicationProfileEntity.getId());
    clientDetailsManager.merge(clientDetails);
    OrcidOauth2TokenDetail token = new OrcidOauth2TokenDetail();
    token.setTokenValue("1234");
    token.setClientDetailsId(clientDetails.getId());
    token.setProfile(profileDao.find(delegateProfile.getOrcidIdentifier().getPath()));
    token.setScope(StringUtils.join(new String[] { ScopePathType.ORCID_BIO_READ_LIMITED.value(), ScopePathType.ORCID_BIO_UPDATE.value() }, " "));
    SortedSet<OrcidOauth2TokenDetail> tokens = new TreeSet<>();
    tokens.add(token);
    ProfileEntity delegateProfileEntity = profileDao.find(delegateProfile.getOrcidIdentifier().getPath());
    delegateProfileEntity.setTokenDetails(tokens);
    profileDao.merge(delegateProfileEntity);
    SecurityQuestionEntity existingSecurityQuestionEntity = securityQuestionDao.find(3);
    if (existingSecurityQuestionEntity == null) {
        SecurityQuestionEntity securityQuestionEntity = new SecurityQuestionEntity();
        securityQuestionEntity.setId(3);
        securityQuestionEntity.setQuestion("What?");
        securityQuestionDao.persist(securityQuestionEntity);
    }
    orcidProfileManager.setCompareWorksUsingScopusWay(true);
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) SubjectEntity(org.orcid.persistence.jpa.entities.SubjectEntity) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) SecurityQuestionEntity(org.orcid.persistence.jpa.entities.SecurityQuestionEntity) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidProfileManagerImpl(org.orcid.core.manager.impl.OrcidProfileManagerImpl) TreeSet(java.util.TreeSet) OrcidOauth2TokenDetail(org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail) Before(org.junit.Before) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)31 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)28 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)23 GivenNames (org.orcid.jaxb.model.message.GivenNames)20 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)17 FamilyName (org.orcid.jaxb.model.message.FamilyName)16 CreditName (org.orcid.jaxb.model.message.CreditName)14 Email (org.orcid.jaxb.model.message.Email)14 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)8 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)8 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)8 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)7 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)7 Url (org.orcid.jaxb.model.message.Url)7 Test (org.junit.Test)6 Biography (org.orcid.jaxb.model.message.Biography)6 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)6 Keyword (org.orcid.jaxb.model.message.Keyword)6