use of org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority in project jabref by JabRef.
the class ModsExportFormat method addKeyWords.
private void addKeyWords(ModsDefinition mods, String value) {
String[] keywords = value.split(", ");
for (String keyword : keywords) {
SubjectDefinition subject = new SubjectDefinition();
StringPlusLanguagePlusAuthority topic = new StringPlusLanguagePlusAuthority();
topic.setValue(keyword);
JAXBElement<?> element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "topic"), StringPlusLanguagePlusAuthority.class, topic);
subject.getTopicOrGeographicOrTemporal().add(element);
mods.getModsGroup().add(subject);
}
}
use of org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority 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, ", ");
}
}
}
use of org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority in project jabref by JabRef.
the class ModsImporter method parseTopic.
private void parseTopic(Map<String, String> fields, List<JAXBElement<?>> topicOrGeographicOrTemporal, List<String> keywords) {
for (JAXBElement<?> jaxbElement : topicOrGeographicOrTemporal) {
Object value = jaxbElement.getValue();
String elementName = jaxbElement.getName().getLocalPart();
if (value instanceof HierarchicalGeographicDefinition) {
HierarchicalGeographicDefinition hierarchichalGeographic = (HierarchicalGeographicDefinition) value;
parseGeographicInformation(fields, hierarchichalGeographic);
} else if ((value instanceof StringPlusLanguagePlusAuthority) && "topic".equals(elementName)) {
StringPlusLanguagePlusAuthority topic = (StringPlusLanguagePlusAuthority) value;
keywords.add(topic.getValue().trim());
}
}
}
Aggregations