Search in sources :

Example 51 with Biography

use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.

the class PersonalDetailsManagerReadOnlyImpl method getPublicPersonalDetails.

@Override
public PersonalDetails getPublicPersonalDetails(String orcid) {
    Date lastModified = getLastModifiedDate(orcid);
    PersonalDetails personalDetails = new PersonalDetails();
    Biography bio = biographyManager.getPublicBiography(orcid);
    if (bio != null) {
        personalDetails.setBiography(bio);
    }
    Name name = recordNameManager.getRecordName(orcid);
    if (name != null && !Visibility.PUBLIC.equals(name.getVisibility())) {
        personalDetails.setName(null);
    } else {
        personalDetails.setName(name);
    }
    OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid);
    OtherNames filteredOtherNames = new OtherNames();
    personalDetails.setOtherNames(filteredOtherNames);
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        // Lets copy the list so we don't modify the cached collection
        List<OtherName> filteredList = new ArrayList<OtherName>(otherNames.getOtherNames());
        filteredOtherNames.setOtherNames(filteredList);
    }
    if (personalDetails.getLastModifiedDate() == null || personalDetails.getLastModifiedDate().getValue() == null) {
        personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified)));
    }
    return personalDetails;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) ArrayList(java.util.ArrayList) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) Date(java.util.Date) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Example 52 with Biography

use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.

the class ProfileEntityManagerImpl method clearRecord.

/**
 * Clears all record info but the email addresses, that stay unmodified
 */
private void clearRecord(String orcid, Boolean disableTokens) {
    // Remove works
    workManager.removeAllWorks(orcid);
    // Remove funding
    fundingManager.removeAllFunding(orcid);
    // Remove affiliations
    affiliationsManager.removeAllAffiliations(orcid);
    // Remove peer reviews
    peerReviewManager.removeAllPeerReviews(orcid);
    // Remove addresses
    addressManager.removeAllAddress(orcid);
    // Remove external identifiers
    externalIdentifierManager.removeAllExternalIdentifiers(orcid);
    // Remove researcher urls
    researcherUrlManager.removeAllResearcherUrls(orcid);
    // Remove other names
    otherNamesManager.removeAllOtherNames(orcid);
    // Remove keywords
    profileKeywordManager.removeAllKeywords(orcid);
    // Remove biography
    if (biographyManager.exists(orcid)) {
        Biography deprecatedBio = new Biography();
        deprecatedBio.setContent(null);
        deprecatedBio.setVisibility(Visibility.PRIVATE);
        biographyManager.updateBiography(orcid, deprecatedBio);
    }
    // Set the deactivated names
    if (recordNameManager.exists(orcid)) {
        Name name = new Name();
        name.setCreditName(new CreditName());
        name.setGivenNames(new GivenNames("Given Names Deactivated"));
        name.setFamilyName(new FamilyName("Family Name Deactivated"));
        name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
        name.setPath(orcid);
        recordNameManager.updateRecordName(orcid, name);
    }
    // 
    userConnectionDao.deleteByOrcid(orcid);
    if (disableTokens) {
        // Disable any token that belongs to this record
        orcidOauth2TokenDetailService.disableAccessTokenByUserOrcid(orcid, RevokeReason.RECORD_DEACTIVATED);
    }
    // Change default visibility to private
    profileDao.updateDefaultVisibility(orcid, Visibility.PRIVATE);
}
Also used : FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) GivenNames(org.orcid.jaxb.model.record_v2.GivenNames) Biography(org.orcid.jaxb.model.record_v2.Biography) CreditName(org.orcid.jaxb.model.record_v2.CreditName) CreditName(org.orcid.jaxb.model.record_v2.CreditName) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) Name(org.orcid.jaxb.model.record_v2.Name)

Example 53 with Biography

use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewBiography.

@Override
public Response viewBiography(String orcid) {
    Biography bio = biographyManagerReadOnly.getBiography(orcid);
    if (bio == null) {
        throw new OrcidNoBioException();
    }
    orcidSecurityManager.checkAndFilter(orcid, bio, ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToBiography(bio, orcid);
    return Response.ok(bio).build();
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) OrcidNoBioException(org.orcid.core.exception.OrcidNoBioException)

Example 54 with Biography

use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.

the class BiographyManagerTest method testUpdateBiography.

@Test
public void testUpdateBiography() {
    String orcid = "0000-0000-0000-0001";
    Biography bio = biographyManager.getBiography(orcid);
    assertNotNull(bio);
    assertEquals("Biography for 0000-0000-0000-0001", bio.getContent());
    assertEquals(Visibility.PRIVATE, bio.getVisibility());
    long now = System.currentTimeMillis();
    bio.setContent("Updated bio " + now);
    bio.setVisibility(Visibility.PUBLIC);
    biographyManager.updateBiography(orcid, bio);
    Biography newBio = biographyManager.getBiography(orcid);
    assertNotNull(newBio);
    assertEquals("Updated bio " + now, newBio.getContent());
    assertEquals(Visibility.PUBLIC, newBio.getVisibility());
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 55 with Biography

use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.

the class BiographyManagerTest method testGetBiography.

@Test
public void testGetBiography() {
    String orcid = "0000-0000-0000-0002";
    Biography bio = biographyManager.getBiography(orcid);
    assertNotNull(bio);
    assertEquals("Biography for 0000-0000-0000-0002", bio.getContent());
    assertEquals(Visibility.LIMITED, bio.getVisibility());
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Biography (org.orcid.jaxb.model.record_v2.Biography)79 Test (org.junit.Test)74 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)48 Name (org.orcid.jaxb.model.record_v2.Name)46 OtherName (org.orcid.jaxb.model.record_v2.OtherName)46 Address (org.orcid.jaxb.model.record_v2.Address)34 Addresses (org.orcid.jaxb.model.record_v2.Addresses)34 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)34 Email (org.orcid.jaxb.model.record_v2.Email)33 Keywords (org.orcid.jaxb.model.record_v2.Keywords)33 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keyword (org.orcid.jaxb.model.record_v2.Keyword)32 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)32 Person (org.orcid.jaxb.model.record_v2.Person)26 Record (org.orcid.jaxb.model.record_v2.Record)16 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15