Search in sources :

Example 6 with CreditName

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;
}
Also used : PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) ContributorAttributes(org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes) FundingContributorAttributes(org.orcid.jaxb.model.v3.dev1.record.FundingContributorAttributes) WorkContributors(org.orcid.jaxb.model.v3.dev1.record.WorkContributors) Work(org.orcid.jaxb.model.v3.dev1.record.Work) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) Country(org.orcid.jaxb.model.v3.dev1.common.Country) Iso3166Country(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country) Title(org.orcid.jaxb.model.v3.dev1.common.Title) TranslatedTitle(org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 7 with CreditName

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;
}
Also used : FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) GivenNames(org.orcid.jaxb.model.v3.dev1.record.GivenNames) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) Name(org.orcid.jaxb.model.v3.dev1.record.Name)

Example 8 with CreditName

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();
}
Also used : ArrayList(java.util.ArrayList) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor)

Example 9 with CreditName

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);
}
Also used : FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) GivenNames(org.orcid.jaxb.model.v3.dev1.record.GivenNames) Biography(org.orcid.jaxb.model.v3.dev1.record.Biography) CreditName(org.orcid.jaxb.model.v3.dev1.record.CreditName) FamilyName(org.orcid.jaxb.model.v3.dev1.record.FamilyName) CreditName(org.orcid.jaxb.model.v3.dev1.record.CreditName) Name(org.orcid.jaxb.model.v3.dev1.record.Name)

Example 10 with CreditName

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());
}
Also used : CreditName(org.orcid.jaxb.model.v3.dev1.record.CreditName) Test(org.junit.Test)

Aggregations

CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)18 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)10 Test (org.junit.Test)8 Name (org.orcid.jaxb.model.v3.dev1.record.Name)8 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)7 FamilyName (org.orcid.jaxb.model.v3.dev1.record.FamilyName)7 GivenNames (org.orcid.jaxb.model.v3.dev1.record.GivenNames)7 Work (org.orcid.jaxb.model.v3.dev1.record.Work)7 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)6 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)6 Title (org.orcid.jaxb.model.v3.dev1.common.Title)4 CreditName (org.orcid.jaxb.model.v3.dev1.record.CreditName)4 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)4 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)4 ArrayList (java.util.ArrayList)3 Country (org.orcid.jaxb.model.v3.dev1.common.Country)3 Day (org.orcid.jaxb.model.v3.dev1.common.Day)3 Iso3166Country (org.orcid.jaxb.model.v3.dev1.common.Iso3166Country)3 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)3 Subtitle (org.orcid.jaxb.model.v3.dev1.common.Subtitle)3