Search in sources :

Example 6 with CSLItemData

use of de.undercouch.citeproc.csl.CSLItemData in project ORCID-Source by ORCID.

the class WorkToCiteprocTranslatorTest method testBibtexWorkTranslationHyperAuthorNoAbrev.

@Test
public void testBibtexWorkTranslationHyperAuthorNoAbrev() {
    Work w = makeWork(bibtexHyper);
    WorkToCiteprocTranslator t = new WorkToCiteprocTranslator();
    CSLItemData d = t.toCiteproc(w, null, false);
    Assert.assertEquals(d.getAuthor().length, 2932);
}
Also used : CSLItemData(de.undercouch.citeproc.csl.CSLItemData) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 7 with CSLItemData

use of de.undercouch.citeproc.csl.CSLItemData in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorImpl method viewWorkCitation.

@Override
public Response viewWorkCitation(String orcid, Long putCode) {
    Work w = (Work) this.viewWork(orcid, putCode).getEntity();
    ProfileEntity entity = profileEntityManagerReadOnly.findByOrcid(orcid);
    String creditName = null;
    RecordNameEntity recordNameEntity = entity.getRecordNameEntity();
    if (recordNameEntity != null) {
        if (!recordNameEntity.getVisibility().isMoreRestrictiveThan(Visibility.PUBLIC)) {
            creditName = recordNameEntity.getCreditName();
            if (StringUtils.isBlank(creditName)) {
                creditName = recordNameEntity.getGivenNames();
                String familyName = recordNameEntity.getFamilyName();
                if (StringUtils.isNotBlank(familyName)) {
                    creditName += " " + familyName;
                }
            }
        }
    }
    WorkToCiteprocTranslator tran = new WorkToCiteprocTranslator();
    CSLItemData item = tran.toCiteproc(w, creditName, true);
    return Response.ok(item).build();
}
Also used : CSLItemData(de.undercouch.citeproc.csl.CSLItemData) Work(org.orcid.jaxb.model.record_v2.Work) RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) WorkToCiteprocTranslator(org.orcid.api.common.writer.citeproc.WorkToCiteprocTranslator) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Aggregations

CSLItemData (de.undercouch.citeproc.csl.CSLItemData)7 Work (org.orcid.jaxb.model.record_v2.Work)4 Test (org.junit.Test)3 IOException (java.io.IOException)2 BibTeXConverter (de.undercouch.citeproc.bibtex.BibTeXConverter)1 CSLName (de.undercouch.citeproc.csl.CSLName)1 CSLNameBuilder (de.undercouch.citeproc.csl.CSLNameBuilder)1 Bibliography (de.undercouch.citeproc.output.Bibliography)1 PrintStream (java.io.PrintStream)1 BibTeXDatabase (org.jbibtex.BibTeXDatabase)1 ParseException (org.jbibtex.ParseException)1 TokenMgrException (org.jbibtex.TokenMgrException)1 WorkToCiteprocTranslator (org.orcid.api.common.writer.citeproc.WorkToCiteprocTranslator)1 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)1 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)1 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)1 RecordNameEntity (org.orcid.persistence.jpa.entities.RecordNameEntity)1