Search in sources :

Example 1 with Person

use of org.orcid.jaxb.model.record_rc2.Person in project fastjson by alibaba.

the class Bug_for_issue_729 method test_for_issue.

public void test_for_issue() throws Exception {
    Person person = new Person();
    person.setName("bob");
    person.startTime = new Date();
    String result = JSON.toJSONString(person);
    Person person2 = JSON.parseObject(result, Person.class);
    person2.toString();
}
Also used : Person(com.alibaba.json.bvt.bug.Bug_for_issue_729.Person) Date(java.util.Date)

Example 2 with Person

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

the class MemberV2ApiServiceVersionedDelegatorTest method test2_0.

@Test
public void test2_0() {
    SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0003", ScopePathType.READ_LIMITED);
    Response response = serviceDelegator.viewRecord("0000-0000-0000-0003");
    Record record = (Record) response.getEntity();
    assertNotNull(record.getActivitiesSummary());
    ActivitiesSummary activitiesSummary = record.getActivitiesSummary();
    if (activitiesSummary.getEducations() != null) {
        activitiesSummary.getEducations().getSummaries().forEach(e -> assertSourceElement(e, false));
    }
    if (activitiesSummary.getEmployments() != null) {
        activitiesSummary.getEmployments().getSummaries().forEach(e -> assertSourceElement(e, false));
    }
    if (activitiesSummary.getFundings() != null) {
        activitiesSummary.getFundings().getFundingGroup().forEach(g -> {
            g.getFundingSummary().forEach(e -> assertSourceElement(e, false));
        });
    }
    if (activitiesSummary.getWorks() != null) {
        activitiesSummary.getWorks().getWorkGroup().forEach(g -> {
            g.getWorkSummary().forEach(e -> assertSourceElement(e, false));
        });
    }
    if (activitiesSummary.getPeerReviews() != null) {
        activitiesSummary.getPeerReviews().getPeerReviewGroup().forEach(g -> {
            g.getPeerReviewSummary().forEach(e -> assertSourceElement(e, false));
        });
    }
    assertNotNull(record.getPerson());
    Person person = record.getPerson();
    if (person.getAddresses() != null) {
        person.getAddresses().getAddress().forEach(e -> assertSourceElement(e, false));
    }
    if (person.getExternalIdentifiers() != null) {
        person.getExternalIdentifiers().getExternalIdentifiers().forEach(e -> assertSourceElement(e, false));
    }
    if (person.getKeywords() != null) {
        person.getKeywords().getKeywords().forEach(e -> assertSourceElement(e, false));
    }
    if (person.getOtherNames() != null) {
        person.getOtherNames().getOtherNames().forEach(e -> assertSourceElement(e, false));
    }
    if (person.getResearcherUrls() != null) {
        person.getResearcherUrls().getResearcherUrls().forEach(e -> assertSourceElement(e, false));
    }
}
Also used : Response(javax.ws.rs.core.Response) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.record_v2.Record) Person(org.orcid.jaxb.model.record_v2.Person) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 3 with Person

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

the class MemberV2ApiServiceVersionedDelegatorTest method test2_1.

@Test
public void test2_1() {
    SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0003", ScopePathType.READ_LIMITED);
    Response response = serviceDelegator_v2_1.viewRecord("0000-0000-0000-0003");
    Record record = (Record) response.getEntity();
    assertNotNull(record.getActivitiesSummary());
    ActivitiesSummary activitiesSummary = record.getActivitiesSummary();
    if (activitiesSummary.getEducations() != null) {
        activitiesSummary.getEducations().getSummaries().forEach(e -> assertSourceElement(e, true));
    }
    if (activitiesSummary.getEmployments() != null) {
        activitiesSummary.getEmployments().getSummaries().forEach(e -> assertSourceElement(e, true));
    }
    if (activitiesSummary.getFundings() != null) {
        activitiesSummary.getFundings().getFundingGroup().forEach(g -> {
            g.getFundingSummary().forEach(e -> assertSourceElement(e, true));
        });
    }
    if (activitiesSummary.getWorks() != null) {
        activitiesSummary.getWorks().getWorkGroup().forEach(g -> {
            g.getWorkSummary().forEach(e -> assertSourceElement(e, true));
        });
    }
    if (activitiesSummary.getPeerReviews() != null) {
        activitiesSummary.getPeerReviews().getPeerReviewGroup().forEach(g -> {
            g.getPeerReviewSummary().forEach(e -> assertSourceElement(e, true));
        });
    }
    assertNotNull(record.getPerson());
    Person person = record.getPerson();
    if (person.getAddresses() != null) {
        person.getAddresses().getAddress().forEach(e -> assertSourceElement(e, true));
    }
    if (person.getExternalIdentifiers() != null) {
        person.getExternalIdentifiers().getExternalIdentifiers().forEach(e -> assertSourceElement(e, true));
    }
    if (person.getKeywords() != null) {
        person.getKeywords().getKeywords().forEach(e -> assertSourceElement(e, true));
    }
    if (person.getOtherNames() != null) {
        person.getOtherNames().getOtherNames().forEach(e -> assertSourceElement(e, true));
    }
    if (person.getResearcherUrls() != null) {
        person.getResearcherUrls().getResearcherUrls().forEach(e -> assertSourceElement(e, true));
    }
}
Also used : Response(javax.ws.rs.core.Response) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.record_v2.Record) Person(org.orcid.jaxb.model.record_v2.Person) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 4 with Person

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

the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.

@Override
public Person getPersonDetails(String orcid) {
    long lastModifiedTime = getLastModified(orcid);
    Person person = new Person();
    person.setName(recordNameManager.getRecordName(orcid, lastModifiedTime));
    person.setBiography(biographyManager.getBiography(orcid, lastModifiedTime));
    Addresses addresses = addressManager.getAddresses(orcid, lastModifiedTime);
    if (addresses.getAddress() != null) {
        Addresses filteredAddresses = new Addresses();
        filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
        person.setAddresses(filteredAddresses);
    }
    PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid, lastModifiedTime);
    if (extIds.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
        filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
        person.setExternalIdentifiers(filteredExtIds);
    }
    Keywords keywords = profileKeywordManager.getKeywords(orcid, lastModifiedTime);
    if (keywords.getKeywords() != null) {
        Keywords filteredKeywords = new Keywords();
        filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
        person.setKeywords(filteredKeywords);
    }
    OtherNames otherNames = otherNameManager.getOtherNames(orcid, lastModifiedTime);
    if (otherNames.getOtherNames() != null) {
        OtherNames filteredOtherNames = new OtherNames();
        filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
        person.setOtherNames(filteredOtherNames);
    }
    ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid, lastModifiedTime);
    if (rUrls.getResearcherUrls() != null) {
        ResearcherUrls filteredRUrls = new ResearcherUrls();
        filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
        person.setResearcherUrls(filteredRUrls);
    }
    Emails emails = emailManager.getEmails(orcid, lastModifiedTime);
    if (emails.getEmails() != null) {
        Emails filteredEmails = new Emails();
        filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
        person.setEmails(filteredEmails);
    }
    return person;
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Email(org.orcid.jaxb.model.record_v2.Email) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Addresses(org.orcid.jaxb.model.record_v2.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Emails(org.orcid.jaxb.model.record_v2.Emails) Person(org.orcid.jaxb.model.record_v2.Person)

Example 5 with Person

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

the class OrcidSecurityManager_EmailTest method testPerson_NoReadLimited.

@Test
public void testPerson_NoReadLimited() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Email e1 = createEmail(Visibility.PUBLIC, CLIENT_2);
    Email e2 = createEmail(Visibility.LIMITED, CLIENT_2);
    Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
    List<Email> emailList = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
    Emails emails = new Emails();
    emails.setEmails(emailList);
    Person p = new Person();
    p.setEmails(emails);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertNotNull(p.getEmails());
    assertEquals(1, p.getEmails().getEmails().size());
    assertTrue(p.getEmails().getEmails().contains(e1));
    assertFalse(p.getEmails().getEmails().contains(e2));
    assertFalse(p.getEmails().getEmails().contains(e3));
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) ArrayList(java.util.ArrayList) Emails(org.orcid.jaxb.model.record_v2.Emails) Person(org.orcid.jaxb.model.record_v2.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)65 Person (org.orcid.jaxb.model.record_v2.Person)58 Email (org.orcid.jaxb.model.record_v2.Email)35 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)32 OtherName (org.orcid.jaxb.model.record_v2.OtherName)31 Address (org.orcid.jaxb.model.record_v2.Address)30 Emails (org.orcid.jaxb.model.record_v2.Emails)30 Keyword (org.orcid.jaxb.model.record_v2.Keyword)30 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)30 Name (org.orcid.jaxb.model.record_v2.Name)26 Addresses (org.orcid.jaxb.model.record_v2.Addresses)25 Biography (org.orcid.jaxb.model.record_v2.Biography)25 Keywords (org.orcid.jaxb.model.record_v2.Keywords)25 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)25 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)25 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)25 Record (org.orcid.jaxb.model.record_v2.Record)20 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)19 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)14 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)14