use of org.orcid.jaxb.model.v3.dev1.common.CreditName in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getWork.
public Work getWork() {
Work work = new Work();
work.setCountry(new Country(Iso3166Country.US));
work.setJournalTitle(new Title("journal-title"));
work.setLanguageCode("en");
work.setPublicationDate(new PublicationDate(getFuzzyDate()));
work.setShortDescription("short-description");
work.setUrl(new Url("http://test.orcid.org"));
work.setVisibility(Visibility.PUBLIC);
work.setWorkCitation(new Citation("citation", CitationType.FORMATTED_HARVARD));
ContributorAttributes attributes = new ContributorAttributes();
attributes.setContributorRole(ContributorRole.ASSIGNEE);
attributes.setContributorSequence(SequenceType.FIRST);
ContributorOrcid contributorOrcid = new ContributorOrcid();
contributorOrcid.setHost("http://test.orcid.org");
contributorOrcid.setPath("0000-0000-0000-0000");
contributorOrcid.setUri("https://test.orcid.org/0000-0000-0000-0000");
Contributor contributor = new Contributor();
contributor.setContributorAttributes(attributes);
contributor.setContributorOrcid(contributorOrcid);
contributor.setCreditName(new CreditName("credit name"));
contributor.setContributorEmail(new ContributorEmail("email@test.orcid.org"));
WorkContributors contributors = new WorkContributors(Stream.of(contributor).collect(Collectors.toList()));
work.setWorkContributors(contributors);
work.setWorkExternalIdentifiers(getExternalIDs());
work.setWorkTitle(getWorkTitle());
work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
return work;
}
use of org.orcid.jaxb.model.v3.dev1.common.CreditName in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createName.
protected Name createName(Visibility v) {
Name name = new Name();
name.setVisibility(v);
name.setCreditName(new CreditName("Credit Name"));
name.setFamilyName(new FamilyName("Family Name"));
name.setGivenNames(new GivenNames("Given Names"));
return name;
}
use of org.orcid.jaxb.model.v3.dev1.common.CreditName in project ORCID-Source by ORCID.
the class BibtexManagerImpl method workToBibtex.
public String workToBibtex(Work work, String creditName) {
StringBuffer out = new StringBuffer();
switch(work.getWorkType()) {
case JOURNAL_ARTICLE:
out.append("@article{");
break;
case BOOK:
case BOOK_CHAPTER:
out.append("@book{");
break;
case CONFERENCE_PAPER:
case CONFERENCE_ABSTRACT:
case CONFERENCE_POSTER:
out.append("@conference{");
break;
default:
out.append("@misc{");
break;
}
// id
out.append(escapeStringForBibtex(creditName).replace(' ', '_') + work.getPutCode());
// title
out.append(",\ntitle={" + escapeStringForBibtex((work.getWorkTitle() != null) ? work.getWorkTitle().getTitle().getContent() : "No Title") + "}");
// journal title
if (work.getJournalTitle() != null) {
out.append(",\njournal={" + escapeStringForBibtex(work.getJournalTitle().getContent()) + "}");
}
// name
List<String> names = new ArrayList<String>();
names.add(creditName);
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
for (Contributor c : work.getWorkContributors().getContributor()) {
if (c.getCreditName() != null && c.getCreditName().getContent() != null) {
names.add(c.getCreditName().getContent());
}
}
}
out.append(",\nauthor={" + escapeStringForBibtex(Joiner.on(" and ").skipNulls().join(names)) + "}");
// ids
String doi = extractID(work, WorkExternalIdentifierType.DOI);
String url = extractID(work, WorkExternalIdentifierType.URI);
if (doi != null) {
out.append(",\ndoi={" + escapeStringForBibtex(doi) + "}");
}
if (url != null) {
out.append(",\nurl={" + escapeStringForBibtex(url) + "}");
} else if (doi != null) {
out.append(",\nurl={" + escapeStringForBibtex("http://doi.org/" + doi) + "}");
} else {
url = extractID(work, WorkExternalIdentifierType.HANDLE);
if (url != null) {
out.append(",\nurl={" + escapeStringForBibtex(url) + "}");
}
}
String isbn = extractID(work, WorkExternalIdentifierType.ISBN);
if (isbn != null)
out.append(",\nisbn={" + escapeStringForBibtex(isbn) + "}");
String issn = extractID(work, WorkExternalIdentifierType.ISSN);
if (issn != null)
out.append(",\nissn={" + escapeStringForBibtex(issn) + "}");
// year
if (work.getPublicationDate() != null) {
int year = 0;
try {
year = Integer.parseInt(work.getPublicationDate().getYear().getValue());
} catch (Exception e) {
}
if (year > 0) {
out.append(",\nyear={" + year + "}");
}
}
out.append("\n}");
return out.toString();
}
use of org.orcid.jaxb.model.v3.dev1.common.CreditName in project ORCID-Source by ORCID.
the class ProfileEntityManagerImpl method clearRecord.
/**
* Clears all record info but the email addresses, that stay unmodified
*/
private void clearRecord(String orcid, Boolean disableTokens) {
// Remove works
workManager.removeAllWorks(orcid);
// Remove funding
fundingManager.removeAllFunding(orcid);
// Remove affiliations
affiliationsManager.removeAllAffiliations(orcid);
// Remove peer reviews
peerReviewManager.removeAllPeerReviews(orcid);
// Remove addresses
addressManager.removeAllAddress(orcid);
// Remove external identifiers
externalIdentifierManager.removeAllExternalIdentifiers(orcid);
// Remove researcher urls
researcherUrlManager.removeAllResearcherUrls(orcid);
// Remove other names
otherNameManager.removeAllOtherNames(orcid);
// Remove keywords
profileKeywordManager.removeAllKeywords(orcid);
// Remove biography
if (biographyManager.exists(orcid)) {
Biography deprecatedBio = new Biography();
deprecatedBio.setContent(null);
deprecatedBio.setVisibility(Visibility.PRIVATE);
biographyManager.updateBiography(orcid, deprecatedBio);
}
// Set the deactivated names
if (recordNameManager.exists(orcid)) {
Name name = new Name();
name.setCreditName(new CreditName());
name.setGivenNames(new GivenNames("Given Names Deactivated"));
name.setFamilyName(new FamilyName("Family Name Deactivated"));
name.setVisibility(Visibility.PUBLIC);
name.setPath(orcid);
recordNameManager.updateRecordName(orcid, name);
}
//
userConnectionDao.deleteByOrcid(orcid);
if (disableTokens) {
// Disable any token that belongs to this record
orcidOauth2TokenDetailService.disableAccessTokenByUserOrcid(orcid, RevokeReason.RECORD_DEACTIVATED);
}
// Change default visibility to private
profileDao.updateDefaultVisibility(orcid, org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
}
use of org.orcid.jaxb.model.v3.dev1.common.CreditName in project ORCID-Source by ORCID.
the class ValidateV3_dev1SamplesTest method testUnmarshallCreditName.
@Test
public void testUnmarshallCreditName() throws SAXException, URISyntaxException {
CreditName creditName = (CreditName) unmarshallFromPath("/record_3.0_dev1/samples/read_samples/credit-name-3.0_dev1.xml", CreditName.class, "/record_3.0_dev1/personal-details-3.0_dev1.xsd");
assertNotNull(creditName);
assertEquals("credit-name", creditName.getContent());
}
Aggregations