Search in sources :

Example 1 with TranslatedTitle

use of org.orcid.jaxb.model.message.TranslatedTitle in project ORCID-Source by ORCID.

the class OrcidProfileManagerBaseTest method createWork1.

protected OrcidWork createWork1() {
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Test Title"));
    workTitle.setSubtitle(new Subtitle("Subtitle # 1"));
    TranslatedTitle tt = new TranslatedTitle();
    tt.setContent("Titulo prueba");
    tt.setLanguageCode("es_CR");
    workTitle.setTranslatedTitle(tt);
    return createWork1(workTitle);
}
Also used : Subtitle(org.orcid.jaxb.model.message.Subtitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle)

Example 2 with TranslatedTitle

use of org.orcid.jaxb.model.message.TranslatedTitle in project ORCID-Source by ORCID.

the class OrcidProfileManagerBaseTest method createWork2.

protected OrcidWork createWork2() {
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Test Title # 2"));
    workTitle.setSubtitle(new Subtitle("Subtitle # 2"));
    TranslatedTitle tt = new TranslatedTitle();
    tt.setContent("Titulo prueba # 2");
    tt.setLanguageCode("es_MX");
    workTitle.setTranslatedTitle(tt);
    return createWork2(workTitle);
}
Also used : Subtitle(org.orcid.jaxb.model.message.Subtitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle)

Example 3 with TranslatedTitle

use of org.orcid.jaxb.model.message.TranslatedTitle in project ORCID-Source by ORCID.

the class Jaxb2JpaAdapterImpl method getWorkEntity.

public WorkEntity getWorkEntity(OrcidWork orcidWork, WorkEntity workEntity) {
    if (orcidWork != null) {
        if (workEntity == null) {
            String putCode = orcidWork.getPutCode();
            if (StringUtils.isNotBlank(putCode) && !"-1".equals(putCode)) {
                throw new IllegalArgumentException("Invalid put-code was supplied: " + putCode);
            }
            workEntity = new WorkEntity();
        } else {
            workEntity.clean();
        }
        Citation workCitation = orcidWork.getWorkCitation();
        if (workCitation != null && StringUtils.isNotBlank(workCitation.getCitation()) && workCitation.getWorkCitationType() != null) {
            workEntity.setCitation(workCitation.getCitation());
            workEntity.setCitationType(CitationType.fromValue(workCitation.getWorkCitationType().value()));
        }
        // New way of doing work contributors
        workEntity.setContributorsJson(getWorkContributorsJson(orcidWork.getWorkContributors()));
        workEntity.setDescription(orcidWork.getShortDescription() != null ? orcidWork.getShortDescription() : null);
        // New way of doing work external ids
        workEntity.setExternalIdentifiersJson(getWorkExternalIdsJson(orcidWork));
        workEntity.setPublicationDate(getWorkPublicationDate(orcidWork));
        WorkTitle workTitle = orcidWork.getWorkTitle();
        if (workTitle != null) {
            workEntity.setSubtitle(workTitle.getSubtitle() != null ? workTitle.getSubtitle().getContent() : null);
            workEntity.setTitle(workTitle.getTitle() != null ? workTitle.getTitle().getContent().trim() : null);
            TranslatedTitle translatedTitle = workTitle.getTranslatedTitle();
            if (translatedTitle != null) {
                workEntity.setTranslatedTitle(StringUtils.isEmpty(translatedTitle.getContent()) ? null : translatedTitle.getContent());
                workEntity.setTranslatedTitleLanguageCode(StringUtils.isEmpty(translatedTitle.getLanguageCode()) ? null : translatedTitle.getLanguageCode());
            }
        }
        workEntity.setJournalTitle(orcidWork.getJournalTitle() != null ? orcidWork.getJournalTitle().getContent() : null);
        workEntity.setLanguageCode(orcidWork.getLanguageCode() != null ? orcidWork.getLanguageCode() : null);
        if (orcidWork.getCountry() != null && orcidWork.getCountry().getValue() != null) {
            workEntity.setIso2Country(org.orcid.jaxb.model.common_v2.Iso3166Country.fromValue(orcidWork.getCountry().getValue().value()));
        }
        workEntity.setWorkUrl(orcidWork.getUrl() != null ? orcidWork.getUrl().getValue() : null);
        if (orcidWork.getWorkType() != null) {
            workEntity.setWorkType(org.orcid.jaxb.model.record_v2.WorkType.fromValue(orcidWork.getWorkType().value()));
        }
        if (orcidWork.getVisibility() != null) {
            workEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(orcidWork.getVisibility().value()));
        } else {
            workEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
        }
        workEntity.setAddedToProfileDate(new Date());
        //Set source
        setSource(orcidWork.getSource(), workEntity);
        if (workEntity.getDisplayIndex() == null) {
            workEntity.setDisplayIndex(0L);
        }
        return workEntity;
    }
    return null;
}
Also used : WorkEntity(org.orcid.persistence.jpa.entities.WorkEntity) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Citation(org.orcid.jaxb.model.message.Citation) CompletionDate(org.orcid.jaxb.model.message.CompletionDate) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate) PublicationDate(org.orcid.jaxb.model.message.PublicationDate) DeactivationDate(org.orcid.jaxb.model.message.DeactivationDate)

Example 4 with TranslatedTitle

use of org.orcid.jaxb.model.message.TranslatedTitle in project ORCID-Source by ORCID.

the class Jaxb2JpaAdapterImpl method getWorkEntity.

@Override
@Deprecated
public WorkEntity getWorkEntity(String orcid, OrcidWork orcidWork, WorkEntity workEntity) {
    if (orcidWork != null) {
        if (workEntity == null) {
            String putCode = orcidWork.getPutCode();
            if (StringUtils.isNotBlank(putCode) && !"-1".equals(putCode)) {
                throw new IllegalArgumentException("Invalid put-code was supplied: " + putCode);
            }
            workEntity = new WorkEntity();
            workEntity.setOrcid(orcid);
            setSource(sourceManager.retrieveSourceEntity(), workEntity);
        } else {
            workEntity.clean();
        }
        Citation workCitation = orcidWork.getWorkCitation();
        if (workCitation != null && StringUtils.isNotBlank(workCitation.getCitation()) && workCitation.getWorkCitationType() != null) {
            workEntity.setCitation(workCitation.getCitation());
            workEntity.setCitationType(CitationType.fromValue(workCitation.getWorkCitationType().value()));
        }
        // New way of doing work contributors
        workEntity.setContributorsJson(getWorkContributorsJson(orcidWork.getWorkContributors()));
        workEntity.setDescription(orcidWork.getShortDescription() != null ? orcidWork.getShortDescription() : null);
        // New way of doing work external ids
        workEntity.setExternalIdentifiersJson(getWorkExternalIdsJson(orcidWork));
        workEntity.setPublicationDate(getWorkPublicationDate(orcidWork));
        WorkTitle workTitle = orcidWork.getWorkTitle();
        if (workTitle != null) {
            workEntity.setSubtitle(workTitle.getSubtitle() != null ? workTitle.getSubtitle().getContent() : null);
            workEntity.setTitle(workTitle.getTitle() != null ? workTitle.getTitle().getContent().trim() : null);
            TranslatedTitle translatedTitle = workTitle.getTranslatedTitle();
            if (translatedTitle != null) {
                workEntity.setTranslatedTitle(StringUtils.isEmpty(translatedTitle.getContent()) ? null : translatedTitle.getContent());
                workEntity.setTranslatedTitleLanguageCode(StringUtils.isEmpty(translatedTitle.getLanguageCode()) ? null : translatedTitle.getLanguageCode());
            }
        }
        workEntity.setJournalTitle(orcidWork.getJournalTitle() != null ? orcidWork.getJournalTitle().getContent() : null);
        workEntity.setLanguageCode(orcidWork.getLanguageCode() != null ? orcidWork.getLanguageCode() : null);
        if (orcidWork.getCountry() != null && orcidWork.getCountry().getValue() != null) {
            workEntity.setIso2Country(org.orcid.jaxb.model.common_v2.Iso3166Country.fromValue(orcidWork.getCountry().getValue().value()));
        }
        workEntity.setWorkUrl(orcidWork.getUrl() != null ? orcidWork.getUrl().getValue() : null);
        if (orcidWork.getWorkType() != null) {
            workEntity.setWorkType(org.orcid.jaxb.model.record_v2.WorkType.fromValue(orcidWork.getWorkType().value()));
        }
        if (orcidWork.getVisibility() != null) {
            workEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(orcidWork.getVisibility().value()));
        } else {
            workEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
        }
        workEntity.setAddedToProfileDate(new Date());
        if (workEntity.getDisplayIndex() == null) {
            workEntity.setDisplayIndex(0L);
        }
        return workEntity;
    }
    return null;
}
Also used : WorkEntity(org.orcid.persistence.jpa.entities.WorkEntity) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Citation(org.orcid.jaxb.model.message.Citation) CompletionDate(org.orcid.jaxb.model.message.CompletionDate) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate) PublicationDate(org.orcid.jaxb.model.message.PublicationDate) DeactivationDate(org.orcid.jaxb.model.message.DeactivationDate)

Example 5 with TranslatedTitle

use of org.orcid.jaxb.model.message.TranslatedTitle in project ORCID-Source by ORCID.

the class OrcidProfileManagerBaseTest method createWork3.

protected OrcidWork createWork3() {
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("Test Title # 3"));
    workTitle.setSubtitle(new Subtitle("Subtitle # 3"));
    TranslatedTitle tt = new TranslatedTitle();
    tt.setContent("Titulo prueba # 3");
    tt.setLanguageCode("es");
    workTitle.setTranslatedTitle(tt);
    return createWork3(workTitle);
}
Also used : Subtitle(org.orcid.jaxb.model.message.Subtitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.message.TranslatedTitle)

Aggregations

TranslatedTitle (org.orcid.jaxb.model.message.TranslatedTitle)7 Subtitle (org.orcid.jaxb.model.message.Subtitle)5 Title (org.orcid.jaxb.model.message.Title)5 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)5 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Citation (org.orcid.jaxb.model.message.Citation)2 CompletionDate (org.orcid.jaxb.model.message.CompletionDate)2 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)2 DeactivationDate (org.orcid.jaxb.model.message.DeactivationDate)2 Email (org.orcid.jaxb.model.message.Email)2 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)2 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)2 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)2 Funding (org.orcid.jaxb.model.message.Funding)2 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)2 FuzzyDate (org.orcid.jaxb.model.message.FuzzyDate)2