use of org.jabref.logic.importer.fileformat.mods.PlaceTermDefinition in project jabref by JabRef.
the class ModsExportFormat method addOriginInformation.
private void addOriginInformation(String key, String value, OriginInfoDefinition originInfo) {
if (FieldName.YEAR.equals(key)) {
addDate("dateIssued", value, originInfo);
} else if ("created".equals(key)) {
addDate("dateCreated", value, originInfo);
} else if ("modified".equals(key)) {
addDate("dateModified", value, originInfo);
} else if ("captured".equals(key)) {
addDate("dateCaptured", value, originInfo);
} else if (FieldName.PUBLISHER.equals(key)) {
StringPlusLanguagePlusSupplied publisher = new StringPlusLanguagePlusSupplied();
publisher.setValue(value);
JAXBElement<StringPlusLanguagePlusSupplied> element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "publisher"), StringPlusLanguagePlusSupplied.class, publisher);
originInfo.getPlaceOrPublisherOrDateIssued().add(element);
} else if ("issuance".equals(key)) {
IssuanceDefinition issuance = IssuanceDefinition.fromValue(value);
JAXBElement<IssuanceDefinition> element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "issuance"), IssuanceDefinition.class, issuance);
originInfo.getPlaceOrPublisherOrDateIssued().add(element);
} else if ("address".equals(key)) {
PlaceDefinition placeDefinition = new PlaceDefinition();
//There can be more than one place, so we split to get all places and add them
String[] places = value.split(", ");
for (String place : places) {
PlaceTermDefinition placeTerm = new PlaceTermDefinition();
//There's no possibility to see from a bib entry whether it is code or text, but since it is in the bib entry
//we assume that it is text
placeTerm.setType(CodeOrText.TEXT);
placeTerm.setValue(place);
placeDefinition.getPlaceTerm().add(placeTerm);
}
JAXBElement<PlaceDefinition> element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "place"), PlaceDefinition.class, placeDefinition);
originInfo.getPlaceOrPublisherOrDateIssued().add(element);
} else if ("edition".equals(key)) {
StringPlusLanguagePlusSupplied edition = new StringPlusLanguagePlusSupplied();
edition.setValue(value);
JAXBElement<StringPlusLanguagePlusSupplied> element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "edition"), StringPlusLanguagePlusSupplied.class, edition);
originInfo.getPlaceOrPublisherOrDateIssued().add(element);
}
}
Aggregations