Search in sources :

Example 1 with LanguageTermDefinition

use of org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition in project jabref by JabRef.

the class ModsExportFormat method addLanguage.

private void addLanguage(ModsDefinition mods, String value) {
    LanguageDefinition language = new LanguageDefinition();
    LanguageTermDefinition languageTerm = new LanguageTermDefinition();
    languageTerm.setValue(value);
    language.getLanguageTerm().add(languageTerm);
    mods.getModsGroup().add(language);
}
Also used : LanguageDefinition(org.jabref.logic.importer.fileformat.mods.LanguageDefinition) LanguageTermDefinition(org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition)

Example 2 with LanguageTermDefinition

use of org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition in project jabref by JabRef.

the class ModsImporter method parseRecordInfo.

private void parseRecordInfo(Map<String, String> fields, RecordInfoDefinition recordInfo) {
    List<JAXBElement<?>> recordContent = recordInfo.getRecordContentSourceOrRecordCreationDateOrRecordChangeDate();
    for (JAXBElement<?> jaxbElement : recordContent) {
        Object value = jaxbElement.getValue();
        if (value instanceof StringPlusLanguagePlusAuthority) {
            StringPlusLanguagePlusAuthority source = (StringPlusLanguagePlusAuthority) value;
            putIfValueNotNull(fields, "source", source.getValue());
        } else if (value instanceof LanguageDefinition) {
            LanguageDefinition language = (LanguageDefinition) value;
            List<LanguageTermDefinition> languageTerms = language.getLanguageTerm();
            List<String> languages = languageTerms.stream().map(LanguageTermDefinition::getValue).collect(Collectors.toList());
            putIfListIsNotEmpty(fields, languages, FieldName.LANGUAGE, ", ");
        }
    }
}
Also used : LanguageDefinition(org.jabref.logic.importer.fileformat.mods.LanguageDefinition) List(java.util.List) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) StringPlusLanguagePlusAuthority(org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority) LanguageTermDefinition(org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition)

Aggregations

LanguageDefinition (org.jabref.logic.importer.fileformat.mods.LanguageDefinition)2 LanguageTermDefinition (org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JAXBElement (javax.xml.bind.JAXBElement)1 StringPlusLanguagePlusAuthority (org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority)1