Search in sources :

Example 6 with Subtitle

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

the class OrcidProfileManagerImplTest method testAddOrcidWorksWhenDefaultVisibilityIsPublic.

@Test
@Transactional
@Rollback(true)
public void testAddOrcidWorksWhenDefaultVisibilityIsPublic() {
    OrcidProfile profile1 = createBasicProfile();
    OrcidHistory history = new OrcidHistory();
    history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile1.setOrcidHistory(history);
    history.setClaimed(new Claimed(true));
    profile1.getOrcidInternal().getPreferences().setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.PUBLIC));
    orcidProfileManager.createOrcidProfile(profile1, false, false);
    OrcidProfile profile2 = new OrcidProfile();
    profile2.setOrcidIdentifier(TEST_ORCID);
    OrcidWorks orcidWorks = new OrcidWorks();
    profile2.setOrcidWorks(orcidWorks);
    WorkTitle workTitle1 = new WorkTitle();
    workTitle1.setTitle(new Title("Another Title"));
    workTitle1.setSubtitle(new Subtitle("Journal of Cloud Spotting"));
    OrcidWork work1 = createWork1(workTitle1);
    Source source = new Source(TEST_ORCID);
    work1.setSource(source);
    orcidWorks.getOrcidWork().add(work1);
    WorkTitle workTitle2 = new WorkTitle();
    workTitle2.setTitle(new Title("New Title"));
    workTitle2.setSubtitle(new Subtitle("Another New subtitle"));
    OrcidWork work2 = createWork2(workTitle2);
    orcidWorks.getOrcidWork().add(work2);
    // Try to add a duplicate
    WorkTitle workTitle3 = new WorkTitle();
    workTitle3.setTitle(new Title("Further Title"));
    workTitle3.setSubtitle(new Subtitle("Further subtitle"));
    OrcidWork work3 = createWork3(workTitle3);
    work3.setVisibility(Visibility.LIMITED);
    orcidWorks.getOrcidWork().add(work3);
    orcidProfileManager.addOrcidWorks(profile2);
    OrcidProfile resultProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
    assertEquals("Will", resultProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
    List<OrcidWork> works = resultProfile.retrieveOrcidWorks().getOrcidWork();
    assertEquals(4, works.size());
    assertEquals("Another Title", works.get(0).getWorkTitle().getTitle().getContent());
    assertEquals("Journal of Cloud Spotting", works.get(0).getWorkTitle().getSubtitle().getContent());
    for (OrcidWork work : works) {
        if ("Test Title".equals(work.getWorkTitle().getTitle().getContent()))
            assertEquals(Visibility.PRIVATE, work.getVisibility());
        else
            assertEquals(Visibility.PUBLIC, work.getVisibility());
    }
}
Also used : OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) ApprovalDate(org.orcid.jaxb.model.message.ApprovalDate) Claimed(org.orcid.jaxb.model.message.Claimed) Source(org.orcid.jaxb.model.message.Source) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Subtitle(org.orcid.jaxb.model.message.Subtitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with Subtitle

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

the class OrcidProfileCleanerTest method testSimpleClean.

@Test
public void testSimpleClean() {
    OrcidWork orcidWork = new OrcidWork();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Test Title"));
    workTitle.setSubtitle(new Subtitle(""));
    orcidWork.setWorkTitle(workTitle);
    WorkExternalIdentifiers workExternalIdentifiers = new WorkExternalIdentifiers();
    orcidWork.setWorkExternalIdentifiers(workExternalIdentifiers);
    WorkExternalIdentifier workExternalIdentifier1 = new WorkExternalIdentifier();
    workExternalIdentifiers.getWorkExternalIdentifier().add(workExternalIdentifier1);
    workExternalIdentifier1.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
    workExternalIdentifier1.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work-doi"));
    orcidProfileCleaner.clean(orcidWork);
    assertEquals("Test Title", orcidWork.getWorkTitle().getTitle().getContent());
    assertEquals("work-doi", orcidWork.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).getWorkExternalIdentifierId().getContent());
    assertNull("Subtitle should be null", orcidWork.getWorkTitle().getSubtitle());
}
Also used : Subtitle(org.orcid.jaxb.model.message.Subtitle) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Title(org.orcid.jaxb.model.message.Title) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) BaseTest(org.orcid.core.BaseTest) Test(org.junit.Test)

Example 8 with Subtitle

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

the class OrcidProfileManagerBaseTest method createWork3.

protected OrcidWork createWork3() {
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Test Title # 3"));
    workTitle.setSubtitle(new Subtitle("Subtitle # 3"));
    TranslatedTitle tt = new TranslatedTitle();
    tt.setContent("Titulo prueba # 3");
    tt.setLanguageCode("es");
    workTitle.setTranslatedTitle(tt);
    return createWork3(workTitle);
}
Also used : Subtitle(org.orcid.jaxb.model.message.Subtitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle)

Example 9 with Subtitle

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

the class OrcidProfileManagerImplTest method testAddOrcidWorksWhenDefaultVisibilityIsPrivate.

@Test
@Transactional
public void testAddOrcidWorksWhenDefaultVisibilityIsPrivate() {
    OrcidProfile profile1 = createBasicProfile();
    OrcidHistory history = new OrcidHistory();
    history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile1.setOrcidHistory(history);
    history.setClaimed(new Claimed(true));
    profile1.getOrcidInternal().getPreferences().setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.PRIVATE));
    orcidProfileManager.createOrcidProfile(profile1, false, false);
    OrcidProfile profile2 = new OrcidProfile();
    profile2.setOrcidIdentifier(TEST_ORCID);
    OrcidWorks orcidWorks = new OrcidWorks();
    profile2.setOrcidWorks(orcidWorks);
    WorkTitle workTitle1 = new WorkTitle();
    workTitle1.setTitle(new Title("Another Title"));
    workTitle1.setSubtitle(new Subtitle("Journal of Cloud Spotting"));
    OrcidWork work1 = createWork1(workTitle1);
    Source source = new Source(TEST_ORCID);
    work1.setSource(source);
    orcidWorks.getOrcidWork().add(work1);
    WorkTitle workTitle2 = new WorkTitle();
    workTitle2.setTitle(new Title("New Title"));
    workTitle2.setSubtitle(new Subtitle("Another New subtitle"));
    OrcidWork work2 = createWork2(workTitle2);
    orcidWorks.getOrcidWork().add(work2);
    // Try to add a duplicate
    WorkTitle workTitle3 = new WorkTitle();
    workTitle3.setTitle(new Title("Further Title"));
    workTitle3.setSubtitle(new Subtitle("Further subtitle"));
    OrcidWork work3 = createWork3(workTitle3);
    work3.setVisibility(Visibility.LIMITED);
    orcidWorks.getOrcidWork().add(work3);
    orcidProfileManager.addOrcidWorks(profile2);
    OrcidProfile resultProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
    assertEquals("Will", resultProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
    List<OrcidWork> works = resultProfile.retrieveOrcidWorks().getOrcidWork();
    assertEquals(4, works.size());
    assertEquals("Another Title", works.get(0).getWorkTitle().getTitle().getContent());
    assertEquals("Journal of Cloud Spotting", works.get(0).getWorkTitle().getSubtitle().getContent());
    for (OrcidWork work : works) {
        if ("Test Title".equals(work.getWorkTitle().getTitle().getContent()))
            assertEquals(Visibility.PRIVATE, work.getVisibility());
        else
            assertEquals(Visibility.PRIVATE, work.getVisibility());
    }
}
Also used : OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) ApprovalDate(org.orcid.jaxb.model.message.ApprovalDate) Claimed(org.orcid.jaxb.model.message.Claimed) Source(org.orcid.jaxb.model.message.Source) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Subtitle(org.orcid.jaxb.model.message.Subtitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with Subtitle

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

the class OrcidProfileManagerImplTest method testUpdatePersonalInformationRemovesOrcidIndexFields.

@Test
@Transactional
@Rollback(true)
public void testUpdatePersonalInformationRemovesOrcidIndexFields() throws Exception {
    // re-use the createFull method but add some extra criteria so we can
    // use our specific orcidAllSolrFieldsPopulatedForSave matcher
    OrcidProfile profile = createFullOrcidProfile();
    OtherNames otherNames = new OtherNames();
    otherNames.getOtherName().add(new OtherName("Stan", null));
    otherNames.getOtherName().add(new OtherName("Willis", null));
    profile.getOrcidBio().getPersonalDetails().setOtherNames(otherNames);
    OrcidWorks orcidWorks = new OrcidWorks();
    profile.setOrcidWorks(orcidWorks);
    WorkTitle singleWorkTitle = new WorkTitle();
    singleWorkTitle.setTitle(new Title("Single works"));
    singleWorkTitle.setSubtitle(new Subtitle("Single works"));
    OrcidWork orcidWork = createWork1(singleWorkTitle);
    // TODO JB some doi testing here?
    // orcidWork.getElectronicResourceNum().add(new
    // ElectronicResourceNum("10.1016/S0021-8502(00)90373-2",
    // ElectronicResourceNumType.DOI));
    orcidWorks.getOrcidWork().add(orcidWork);
    orcidProfileManager.createOrcidProfile(profile, false, false);
    // now negate all fields that form part of a solr query, leaving only
    // the orcid itself
    // we do this by passing through an orcid missing the fields from an
    // OrcidSolrDocument
    OrcidProfile negatedProfile = createBasicProfile();
    negatedProfile.getOrcidBio().getPersonalDetails().setFamilyName(null);
    negatedProfile.getOrcidBio().getPersonalDetails().setGivenNames(null);
    negatedProfile.getOrcidBio().getPersonalDetails().setCreditName(null);
    negatedProfile.getOrcidBio().getPersonalDetails().setOtherNames(null);
    negatedProfile.getOrcidActivities().setAffiliations(null);
    orcidProfileManager.updateOrcidBio(negatedProfile);
    assertEquals(IndexingStatus.PENDING, profileDao.find(TEST_ORCID).getIndexingStatus());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Subtitle(org.orcid.jaxb.model.message.Subtitle) OtherNames(org.orcid.jaxb.model.message.OtherNames) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Subtitle (org.orcid.jaxb.model.message.Subtitle)13 Title (org.orcid.jaxb.model.message.Title)13 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)11 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)10 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)9 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)8 Test (org.junit.Test)7 Source (org.orcid.jaxb.model.message.Source)7 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)6 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)6 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)6 Transactional (org.springframework.transaction.annotation.Transactional)6 TranslatedTitle (org.orcid.jaxb.model.message.TranslatedTitle)5 Rollback (org.springframework.test.annotation.Rollback)5 Date (java.util.Date)4 ApprovalDate (org.orcid.jaxb.model.message.ApprovalDate)4 Claimed (org.orcid.jaxb.model.message.Claimed)4 ActivitiesVisibilityDefault (org.orcid.jaxb.model.message.ActivitiesVisibilityDefault)3 OtherName (org.orcid.jaxb.model.message.OtherName)3 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)3