Search in sources :

Example 61 with ResearcherUrl

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl 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));
    person.setBiography(biographyManager.getBiography(orcid));
    Addresses addresses = addressManager.getAddresses(orcid);
    if (addresses.getAddress() != null) {
        Addresses filteredAddresses = new Addresses();
        filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
        person.setAddresses(filteredAddresses);
    }
    PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid);
    if (extIds.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
        filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
        person.setExternalIdentifiers(filteredExtIds);
    }
    Keywords keywords = profileKeywordManager.getKeywords(orcid);
    if (keywords.getKeywords() != null) {
        Keywords filteredKeywords = new Keywords();
        filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
        person.setKeywords(filteredKeywords);
    }
    OtherNames otherNames = otherNameManager.getOtherNames(orcid);
    if (otherNames.getOtherNames() != null) {
        OtherNames filteredOtherNames = new OtherNames();
        filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
        person.setOtherNames(filteredOtherNames);
    }
    ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid);
    if (rUrls.getResearcherUrls() != null) {
        ResearcherUrls filteredRUrls = new ResearcherUrls();
        filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
        person.setResearcherUrls(filteredRUrls);
    }
    Emails emails = emailManager.getEmails(orcid);
    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.v3.dev1.record.Keywords) Email(org.orcid.jaxb.model.v3.dev1.record.Email) Address(org.orcid.jaxb.model.v3.dev1.record.Address) Keyword(org.orcid.jaxb.model.v3.dev1.record.Keyword) OtherNames(org.orcid.jaxb.model.v3.dev1.record.OtherNames) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Addresses(org.orcid.jaxb.model.v3.dev1.record.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers) ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) Person(org.orcid.jaxb.model.v3.dev1.record.Person)

Example 62 with ResearcherUrl

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.

the class JpaJaxbResearcherUrlAdapterImpl method toResearcherUrlList.

@Override
public ResearcherUrls toResearcherUrlList(Collection<ResearcherUrlEntity> entities) {
    if (entities == null) {
        return null;
    }
    List<ResearcherUrl> researchUrlList = mapperFacade.mapAsList(entities, ResearcherUrl.class);
    ResearcherUrls researchUrls = new ResearcherUrls();
    researchUrls.setResearcherUrls(researchUrlList);
    return researchUrls;
}
Also used : ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)

Example 63 with ResearcherUrl

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getResearcherUrlMapperFacade.

public MapperFacade getResearcherUrlMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ClassMapBuilder<ResearcherUrl, ResearcherUrlEntity> researcherUrlClassMap = mapperFactory.classMap(ResearcherUrl.class, ResearcherUrlEntity.class);
    addV3DateFields(researcherUrlClassMap);
    registerSourceConverters(mapperFactory, researcherUrlClassMap);
    researcherUrlClassMap.field("putCode", "id");
    researcherUrlClassMap.field("url.value", "url");
    researcherUrlClassMap.field("urlName", "urlName");
    researcherUrlClassMap.fieldBToA("displayIndex", "displayIndex");
    researcherUrlClassMap.byDefault();
    researcherUrlClassMap.register();
    return mapperFactory.getMapperFacade();
}
Also used : ResearcherUrlEntity(org.orcid.persistence.jpa.entities.ResearcherUrlEntity) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)

Example 64 with ResearcherUrl

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method getResearcherUrl.

private ResearcherUrl getResearcherUrl() {
    ResearcherUrl rUrl = new ResearcherUrl();
    rUrl.setUrl(new Url("http://orcid.org"));
    rUrl.setUrlName("ORCID Site");
    rUrl.setVisibility(Visibility.PUBLIC);
    return rUrl;
}
Also used : ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 65 with ResearcherUrl

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method testAddResearcherUrlToUnclaimedRecordPreserveResearcherUrlVisibility.

@Test
public void testAddResearcherUrlToUnclaimedRecordPreserveResearcherUrlVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    ResearcherUrl rUrl = getResearcherUrl();
    rUrl = researcherUrlManager.createResearcherUrl(unclaimedOrcid, rUrl, true);
    rUrl = researcherUrlManager.getResearcherUrl(unclaimedOrcid, rUrl.getPutCode());
    assertNotNull(rUrl);
    assertEquals(Visibility.PUBLIC, rUrl.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)77 Test (org.junit.Test)55 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)41 Address (org.orcid.jaxb.model.v3.dev1.record.Address)39 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)39 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)38 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)38 Email (org.orcid.jaxb.model.v3.dev1.record.Email)36 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)31 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)31 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)30 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)30 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)30 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)30 Person (org.orcid.jaxb.model.v3.dev1.record.Person)28 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 DBUnitTest (org.orcid.test.DBUnitTest)22 Response (javax.ws.rs.core.Response)20 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)15