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);
}
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);
}
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;
}
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;
}
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);
}
Aggregations