use of org.orcid.jaxb.model.message.Contributor in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method orcidProvidedAndDoesExistInDbAndCreditNameAndEmailArePublic.
@Test
@Transactional
public void orcidProvidedAndDoesExistInDbAndCreditNameAndEmailArePublic() {
// Unmarshall message containing contributor email
OrcidMessage orcidMessage = unmarshallOrcidMessage("new_work_with_contributor_orcid.xml");
// Change orcid to one that exists in DB
orcidMessage.getOrcidProfile().retrieveOrcidWorks().getOrcidWork().get(0).getWorkContributors().getContributor().get(0).getContributorOrcid().setPath("4444-4444-4444-444X");
// Add the work
orcidProfileManager.addOrcidWorks(orcidMessage.getOrcidProfile());
// Get it back from the API
OrcidWork retrievedWork = retrieveAddedWorkFromApi();
Contributor workContributor = retrievedWork.getWorkContributors().getContributor().get(0);
// Check that the contributor name is included in the resulting work
assertEquals("U. Name", workContributor.getCreditName().getContent());
// Check that the email is not included in the resulting work, because
// never want to show email
assertNull(workContributor.getContributorEmail());
}
use of org.orcid.jaxb.model.message.Contributor in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method orcidProvidedAndDoesExistInDbButCreditNameAndEmailArePrivate.
@Test
@Transactional
public void orcidProvidedAndDoesExistInDbButCreditNameAndEmailArePrivate() {
// Unmarshall message containing contributor email
OrcidMessage orcidMessage = unmarshallOrcidMessage("new_work_with_contributor_orcid.xml");
// Change email to one that exists in DB
orcidMessage.getOrcidProfile().retrieveOrcidWorks().getOrcidWork().get(0).getWorkContributors().getContributor().get(0).getContributorOrcid().setPath("4444-4444-4444-4447");
// Add the work
orcidProfileManager.addOrcidWorks(orcidMessage.getOrcidProfile());
// Get it back from the API
OrcidWork retrievedWork = retrieveAddedWorkFromApi();
Contributor workContributor = retrievedWork.getWorkContributors().getContributor().get(0);
// Check that the contributor name is not included in the resulting
// work, because it is private
assertNull(workContributor.getCreditName());
// Check that the email is not included in the resulting work, because
// never want to show email
assertNull(workContributor.getContributorEmail());
}
use of org.orcid.jaxb.model.message.Contributor in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method emailProvidedAndDoesExistInDbAndCreditNameAndEmailArePublic.
@Test
@Transactional
public void emailProvidedAndDoesExistInDbAndCreditNameAndEmailArePublic() {
// Unmarshall message containing contributor email
OrcidMessage orcidMessage = unmarshallOrcidMessage("new_work_with_contributor_email_and_name.xml");
// Change email to one that exists in DB
orcidMessage.getOrcidProfile().retrieveOrcidWorks().getOrcidWork().get(0).getWorkContributors().getContributor().get(0).getContributorEmail().setValue("user@email.com");
// Add the work
orcidProfileManager.addOrcidWorks(orcidMessage.getOrcidProfile());
// Get it back from the API
OrcidWork retrievedWork = retrieveAddedWorkFromApi();
Contributor workContributor = retrievedWork.getWorkContributors().getContributor().get(0);
// Check that the contributor name is included in the resulting work
assertEquals("U. Name", workContributor.getCreditName().getContent());
// Check that the email is not included in the resulting work, because
// never want to show email
assertNull(workContributor.getContributorEmail());
}
use of org.orcid.jaxb.model.message.Contributor in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method orcidProvidedButDoesNotExistInDb.
@Test
@Transactional
public void orcidProvidedButDoesNotExistInDb() {
// Unmarshall message containing contributor ORCID that does not exist
// in DB
OrcidMessage orcidMessage = unmarshallOrcidMessage("new_work_with_contributor_orcid.xml");
// Add the work
orcidProfileManager.addOrcidWorks(orcidMessage.getOrcidProfile());
// Get it back from the API
OrcidWork retrievedWork = retrieveAddedWorkFromApi();
Contributor workContributor = retrievedWork.getWorkContributors().getContributor().get(0);
// Check that the contributor name is not included in the resulting
// work, because the ORCID does not exist
assertNull(workContributor.getCreditName());
// Check that the email is not included in the resulting work, because
// never want to show email
assertNull(workContributor.getContributorEmail());
}
use of org.orcid.jaxb.model.message.Contributor in project ORCID-Source by ORCID.
the class PublicationTest method testGetOrcidWork.
@Test
public void testGetOrcidWork() {
String doi = "10.1029\\/2002JD002436";
String title = "5 on chemistry and nitrate aerosol formation in the lower troposphere under photosmog conditions";
String fullCitation = "Riemer, N, 2003, '5 on chemistry and nitrate aerosol formation in the lower troposphere under photosmog conditions', <i>Journal of Geophysical Research<\\/i>, vol. 30, no. D4, p. 1255.";
String coins = "ctx_ver=Z39.88-2004&rft_val_fmt=info:ofi\\/fmt:kev:mtx:journal&rft_id=info:doi\\/10.1029\\/2002JD002436&rtf.genre=journal-article&rtf.spage=1255&rtf.date=2003&rtf.aulast=Riemer&rtf.aufirst=N.&rtf.auinit=N&rtf.atitle=5 on chemistry and nitrate aerosol formation in the lower troposphere under photosmog conditions&rtf.jtitle=Journal of Geophysical Research&rtf.volume=30&rtf.issue=D4";
Publication publication = new Publication();
publication.setDoi(doi);
publication.setTitle(title);
publication.setFullCitation(fullCitation);
publication.setCoins(coins);
OrcidWork orcidWork = publication.getOrcidWork();
assertNotNull(orcidWork);
assertEquals(doi, orcidWork.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).getWorkExternalIdentifierId().getContent());
assertEquals(WorkExternalIdentifierType.DOI, orcidWork.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).getWorkExternalIdentifierType());
assertEquals(title, orcidWork.getWorkTitle().getTitle().getContent());
assertEquals(fullCitation, orcidWork.getWorkCitation().getCitation());
PublicationDate publicationDate = orcidWork.getPublicationDate();
assertNotNull(publicationDate);
assertEquals(null, publicationDate.getDay());
assertEquals(null, publicationDate.getMonth());
assertEquals("2003", publicationDate.getYear().getValue());
assertEquals(1, orcidWork.getWorkContributors().getContributor().size());
Contributor contributor = orcidWork.getWorkContributors().getContributor().get(0);
assertEquals("Riemer N.", contributor.getCreditName().getContent());
assertEquals(ContributorRole.AUTHOR, contributor.getContributorAttributes().getContributorRole());
assertEquals(SequenceType.FIRST, contributor.getContributorAttributes().getContributorSequence());
}
Aggregations