Search in sources :

Example 56 with Biography

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

the class PublicV2ApiServiceDelegatorTest method testGetPublicBiographyUsingToken.

// Biography
@Test
public void testGetPublicBiographyUsingToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewBiography(ORCID);
    assertNotNull(r);
    Biography b = (Biography) r.getEntity();
    assertNotNull(b);
    assertNotNull(b.getLastModifiedDate());
    assertNotNull(b.getLastModifiedDate().getValue());
    assertEquals(Visibility.PUBLIC, b.getVisibility());
}
Also used : Response(javax.ws.rs.core.Response) Biography(org.orcid.jaxb.model.record_v2.Biography) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 57 with Biography

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

the class ManageProfileController method getBiographyForm.

@RequestMapping(value = "/biographyForm.json", method = RequestMethod.GET)
@ResponseBody
public BiographyForm getBiographyForm() {
    Biography bio = biographyManager.getBiography(getCurrentUserOrcid(), profileEntityManager.getLastModified(getCurrentUserOrcid()));
    BiographyForm form = BiographyForm.valueOf(bio);
    if (form.getVisiblity() == null) {
        ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
        form.setVisiblity(Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
    }
    return form;
}
Also used : BiographyForm(org.orcid.pojo.ajaxForm.BiographyForm) Biography(org.orcid.jaxb.model.record_v2.Biography) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 58 with Biography

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

the class BiographyManagerTest method testCreateBiography.

@Test
public void testCreateBiography() {
    String orcid = "0000-0000-0000-0004";
    Biography bio = new Biography();
    bio.setContent("This is my biography");
    bio.setVisibility(Visibility.LIMITED);
    biographyManager.createBiography(orcid, bio);
    Biography newBio = biographyManager.getBiography(orcid, 0);
    assertNotNull(newBio);
    assertEquals("This is my biography", newBio.getContent());
    assertEquals(Visibility.LIMITED, newBio.getVisibility());
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 59 with Biography

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

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken.

@Test
public void testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    Name name = createName(Visibility.PRIVATE);
    Biography bio = createBiography(Visibility.PRIVATE);
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertNull(p.getName());
    assertNull(p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertTrue(p.getOtherNames().getOtherNames().isEmpty());
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 60 with Biography

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

the class OrcidSecurityManager_generalTest method testBio_CanRead_When_HaveReadScope_IsLimited.

@Test
public void testBio_CanRead_When_HaveReadScope_IsLimited() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    Biography bio = createBiography(Visibility.LIMITED);
    orcidSecurityManager.checkAndFilter(ORCID_1, bio, ScopePathType.ORCID_BIO_READ_LIMITED);
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) Test(org.junit.Test)

Aggregations

Biography (org.orcid.jaxb.model.record_v2.Biography)80 Test (org.junit.Test)76 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)47 OtherName (org.orcid.jaxb.model.record_v2.OtherName)46 Name (org.orcid.jaxb.model.record_v2.Name)44 Address (org.orcid.jaxb.model.record_v2.Address)34 Addresses (org.orcid.jaxb.model.record_v2.Addresses)33 Email (org.orcid.jaxb.model.record_v2.Email)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 Keywords (org.orcid.jaxb.model.record_v2.Keywords)33 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)33 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)33 Emails (org.orcid.jaxb.model.record_v2.Emails)31 Person (org.orcid.jaxb.model.record_v2.Person)25 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 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15