use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method solrDocFilteredByAffilliationVisibility.
private OrcidSolrDocument solrDocFilteredByAffilliationVisibility() {
OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
OrcidProfile orcidProfile = orcidProfileLimitedVisiblityAffiliations();
OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
return orcidSolrDocument;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method solrDocWithFundingTitles.
private OrcidSolrDocument solrDocWithFundingTitles() {
OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
orcidSolrDocument.setFundingTitles(Arrays.asList(new String[] { "grant 1", "grant 2" }));
OrcidProfile orcidProfile = getOrcidWithGrants();
OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
return orcidSolrDocument;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method solrDocFilteredByNameVisibility.
private OrcidSolrDocument solrDocFilteredByNameVisibility() {
OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
orcidSolrDocument.setCreditName(null);
orcidSolrDocument.setOtherNames(null);
orcidSolrDocument.setGivenNames(null);
orcidSolrDocument.setFamilyName(null);
orcidSolrDocument.setGivenAndFamilyNames(null);
OrcidProfile orcidProfile = orcidProfileLimitedVisiblityCreditNameAndOtherNames();
OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
return orcidSolrDocument;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method onlyDoiPersistedFromOrcidWorks.
@Test
@Rollback
public void onlyDoiPersistedFromOrcidWorks() {
OrcidProfile orcidProfileWithDOI = getStandardOrcidWithDoiInformation();
OrcidSolrDocument doiListings = solrDocumentLimitedtoVisibleDoi();
// check that the limited profiles or non doi identifiers aren't
// included
orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
verify(solrDao).persist(eq(doiListings));
// now check null values aren't persisted when either the type or value
// are missing
OrcidWork orcidWork1 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(0);
orcidWork1.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierType(null);
OrcidWork orcidWork2 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(1);
orcidWork2.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierId(null);
// so this should leave only the second doi
doiListings.setDigitalObjectIds(Arrays.asList(new String[] { "work2-doi2" }));
OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfileWithDOI);
doiListings.setPublicProfileMessage(orcidMessage.toString());
orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
verify(solrDao).persist(eq(doiListings));
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method emailProvidedButDoesNotExistInDb.
@Test
@Transactional
public void emailProvidedButDoesNotExistInDb() {
// Unmarshall message containing contributor email that does not exist
// in DB
OrcidMessage orcidMessage = unmarshallOrcidMessage("new_work_with_contributor_email_and_name.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 included in the resulting work
assertEquals("Test Contributor Name", workContributor.getCreditName().getContent());
// Check that the email is not included in the resulting work, because
// never want to show email
assertNull(workContributor.getContributorEmail());
// Get the contributor directly from the DB so can see stuff not
// included in the API
Contributor workContributorDirectFromDb = retrieveWorkContributorEntityDirectlyFromDb(retrievedWork);
// Check the email is in the DB for later use if needed
assertEquals("doesnotexist@orcid.org", workContributorDirectFromDb.getContributorEmail().getValue());
}
Aggregations