From 07df2a8f0b982e4082a06b874f7ef9fda646aff6 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Fri, 22 Jul 2016 01:25:15 +0200 Subject: [PATCH 1/2] More fields added to FieldName --- .../gui/openoffice/StyleSelectDialog.java | 2 +- .../importer/fetcher/DiVAtoBibTeXFetcher.java | 4 +- .../sf/jabref/importer/fetcher/GVKParser.java | 10 +- .../importer/fetcher/IEEEXploreFetcher.java | 6 +- .../fileformat/BiblioscapeImporter.java | 12 +- .../importer/fileformat/CopacImporter.java | 4 +- .../importer/fileformat/EndnoteImporter.java | 12 +- .../importer/fileformat/FreeCiteImporter.java | 14 +- .../importer/fileformat/IsiImporter.java | 2 +- .../importer/fileformat/JSONEntryParser.java | 2 +- .../importer/fileformat/MedlineImporter.java | 5 +- .../fileformat/MedlinePlainImporter.java | 14 +- .../importer/fileformat/OvidImporter.java | 8 +- .../fileformat/PdfContentImporter.java | 4 +- .../importer/fileformat/RepecNepImporter.java | 2 +- .../importer/fileformat/RisImporter.java | 10 +- .../fileformat/SilverPlatterImporter.java | 2 +- .../sf/jabref/logic/cleanup/DoiCleanup.java | 2 +- .../exporter/FieldFormatterCleanups.java | 2 +- .../jabref/logic/exporter/OOCalcDatabase.java | 20 +-- .../exporter/OpenDocumentRepresentation.java | 20 +-- .../logic/integrity/IntegrityCheck.java | 4 +- .../logic/labelpattern/LabelPatternUtil.java | 4 +- .../net/sf/jabref/logic/mods/MODSEntry.java | 2 +- .../jabref/logic/msbib/BibTeXConverter.java | 10 +- .../sf/jabref/logic/msbib/MSBibConverter.java | 16 +-- .../sf/jabref/logic/msbib/MSBibMapping.java | 20 +-- .../sf/jabref/logic/xmp/XMPSchemaBibtex.java | 2 +- .../model/entry/BibLatexEntryTypes.java | 120 +++++++++--------- .../jabref/model/entry/BibtexEntryTypes.java | 48 +++---- .../sf/jabref/model/entry/EntryConverter.java | 4 +- .../net/sf/jabref/model/entry/FieldName.java | 13 +- .../model/entry/IEEETranEntryTypes.java | 14 +- .../model/entry/InternalBibtexFields.java | 20 +-- 34 files changed, 222 insertions(+), 212 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/openoffice/StyleSelectDialog.java b/src/main/java/net/sf/jabref/gui/openoffice/StyleSelectDialog.java index 89bc47ee2e2..870013fa67b 100644 --- a/src/main/java/net/sf/jabref/gui/openoffice/StyleSelectDialog.java +++ b/src/main/java/net/sf/jabref/gui/openoffice/StyleSelectDialog.java @@ -380,7 +380,7 @@ private void setupPrevEntry() { prevEntry.setField(FieldName.YEAR, "2008"); prevEntry.setField(FieldName.JOURNAL, "BibTeX journal"); prevEntry.setField(FieldName.PUBLISHER, "JabRef publishing"); - prevEntry.setField("address", "Trondheim"); + prevEntry.setField(FieldName.ADDRESS, "Trondheim"); prevEntry.setField("www", "https://github.com/JabRef"); } diff --git a/src/main/java/net/sf/jabref/importer/fetcher/DiVAtoBibTeXFetcher.java b/src/main/java/net/sf/jabref/importer/fetcher/DiVAtoBibTeXFetcher.java index 49e91cda1c7..6695f0d5324 100644 --- a/src/main/java/net/sf/jabref/importer/fetcher/DiVAtoBibTeXFetcher.java +++ b/src/main/java/net/sf/jabref/importer/fetcher/DiVAtoBibTeXFetcher.java @@ -109,8 +109,8 @@ public boolean processQuery(String query, ImportInspector inspector, OutputPrint entry.setField(FieldName.TITLE, title); }); - entry.getFieldOptional("institution").ifPresent( - institution -> entry.setField("institution", new UnicodeToLatexFormatter().format(institution))); + entry.getFieldOptional(FieldName.INSTITUTION).ifPresent( + institution -> entry.setField(FieldName.INSTITUTION, new UnicodeToLatexFormatter().format(institution))); // Do not use the provided key // entry.clearField(InternalBibtexFields.KEY_FIELD); inspector.addEntry(entry); diff --git a/src/main/java/net/sf/jabref/importer/fetcher/GVKParser.java b/src/main/java/net/sf/jabref/importer/fetcher/GVKParser.java index 905c33fcc31..5da796ac4ed 100644 --- a/src/main/java/net/sf/jabref/importer/fetcher/GVKParser.java +++ b/src/main/java/net/sf/jabref/importer/fetcher/GVKParser.java @@ -391,13 +391,13 @@ private BibEntry parseEntry(Element e) { result.setField(FieldName.YEAR, year); } if (address != null) { - result.setField("address", address); + result.setField(FieldName.ADDRESS, address); } if (series != null) { - result.setField("series", series); + result.setField(FieldName.SERIES, series); } if (edition != null) { - result.setField("edition", edition); + result.setField(FieldName.EDITION, edition); } if (isbn != null) { result.setField(FieldName.ISBN, isbn); @@ -427,13 +427,13 @@ private BibEntry parseEntry(Element e) { result.setField(FieldName.URL, url); } if (note != null) { - result.setField("note", note); + result.setField(FieldName.NOTE, note); } if ("article".equals(entryType) && (journal != null)) { result.setField(FieldName.JOURNAL, journal); } else if ("incollection".equals(entryType) && (booktitle != null)) { - result.setField("booktitle", booktitle); + result.setField(FieldName.BOOKTITLE, booktitle); } return result; diff --git a/src/main/java/net/sf/jabref/importer/fetcher/IEEEXploreFetcher.java b/src/main/java/net/sf/jabref/importer/fetcher/IEEEXploreFetcher.java index d3484928d0d..f76691ee4aa 100644 --- a/src/main/java/net/sf/jabref/importer/fetcher/IEEEXploreFetcher.java +++ b/src/main/java/net/sf/jabref/importer/fetcher/IEEEXploreFetcher.java @@ -373,9 +373,9 @@ private BibEntry cleanup(BibEntry entry) { String sourceField = ""; if ("article".equals(type)) { sourceField = FieldName.JOURNAL; - entry.clearField("booktitle"); + entry.clearField(FieldName.BOOKTITLE); } else if ("inproceedings".equals(type)) { - sourceField = "booktitle"; + sourceField = FieldName.BOOKTITLE; } if (entry.hasField(sourceField)) { String fullName = entry.getField(sourceField); @@ -393,7 +393,7 @@ private BibEntry cleanup(BibEntry entry) { if (parts.length == 3) { fullName += parts[2]; } - String note = entry.getField("note"); + String note = entry.getField(FieldName.NOTE); if ("Early Access".equals(note)) { entry.setField(FieldName.YEAR, "to be published"); entry.clearField(FieldName.MONTH); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/BiblioscapeImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/BiblioscapeImporter.java index 07422b6344a..e125210f8fc 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/BiblioscapeImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/BiblioscapeImporter.java @@ -119,7 +119,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { comments .add("Secondary Authors: " + entry.getValue()); } else if ("NT".equals(entry.getKey())) { - hm.put("note", entry + hm.put(FieldName.NOTE, entry .getValue().toString()); } else if ("PB".equals(entry.getKey())) { hm.put(FieldName.PUBLISHER, entry @@ -131,7 +131,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { comments .add("Tertiary Title: " + entry.getValue()); } else if ("ED".equals(entry.getKey())) { - hm.put("edition", entry + hm.put(FieldName.EDITION, entry .getValue().toString()); } else if ("TW".equals(entry.getKey())) { type[1] = entry.getValue() @@ -152,7 +152,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { address = entry.getValue() .toString(); } else if ("LG".equals(entry.getKey())) { - hm.put("language", entry + hm.put(FieldName.LANGUAGE, entry .getValue().toString()); } else if ("CO".equals(entry.getKey())) { country = entry.getValue() @@ -239,14 +239,14 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } } else if ("inbook".equals(bibtexType)) { if (titleST != null) { - hm.put("booktitle", titleST); + hm.put(FieldName.BOOKTITLE, titleST); } if (titleTI != null) { hm.put(FieldName.TITLE, titleTI); } } else { if (titleST != null) { - hm.put("booktitle", titleST); // should not + hm.put(FieldName.BOOKTITLE, titleST); // should not } // happen, I // think @@ -262,7 +262,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { // concatenate address and country if (address != null) { - hm.put("address", address + (country == null ? "" : ", " + country)); + hm.put(FieldName.ADDRESS, address + (country == null ? "" : ", " + country)); } if (!comments.isEmpty()) { // set comment if present diff --git a/src/main/java/net/sf/jabref/importer/fileformat/CopacImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/CopacImporter.java index ded1972dc61..4df397a8d8b 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/CopacImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/CopacImporter.java @@ -132,13 +132,13 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } else if ("PU- ".equals(code)) { setOrAppend(b, FieldName.PUBLISHER, line.substring(4).trim(), ", "); } else if ("SE- ".equals(code)) { - setOrAppend(b, "series", line.substring(4).trim(), ", "); + setOrAppend(b, FieldName.SERIES, line.substring(4).trim(), ", "); } else if ("IS- ".equals(code)) { setOrAppend(b, FieldName.ISBN, line.substring(4).trim(), ", "); } else if ("KW- ".equals(code)) { setOrAppend(b, FieldName.KEYWORDS, line.substring(4).trim(), ", "); } else if ("NT- ".equals(code)) { - setOrAppend(b, "note", line.substring(4).trim(), ", "); + setOrAppend(b, FieldName.NOTE, line.substring(4).trim(), ", "); } else if ("PD- ".equals(code)) { setOrAppend(b, "physicaldimensions", line.substring(4).trim(), ", "); } else if ("DT- ".equals(code)) { diff --git a/src/main/java/net/sf/jabref/importer/fileformat/EndnoteImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/EndnoteImporter.java index 44a5b9e5a9f..2ce04c2abb3 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/EndnoteImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/EndnoteImporter.java @@ -172,9 +172,9 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { type = "misc"; // } } else if ("7".equals(prefix)) { - hm.put("edition", val); + hm.put(FieldName.EDITION, val); } else if ("C".equals(prefix)) { - hm.put("address", val); + hm.put(FieldName.ADDRESS, val); } else if ("D".equals(prefix)) { hm.put(FieldName.YEAR, val); } else if ("8".equals(prefix)) { @@ -189,14 +189,14 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { if ("article".equals(type)) { hm.put(FieldName.JOURNAL, val); } else if ("book".equals(type) || "inbook".equals(type)) { - hm.put("series", val); + hm.put(FieldName.SERIES, val); } else { /* type = inproceedings */ - hm.put("booktitle", val); + hm.put(FieldName.BOOKTITLE, val); } } else if ("I".equals(prefix)) { if ("phdthesis".equals(type)) { - hm.put("school", val); + hm.put(FieldName.SCHOOL, val); } else { hm.put(FieldName.PUBLISHER, val); } @@ -222,7 +222,7 @@ else if ("P".equals(prefix)) { String[] tokens = val.split("\\s"); artnum = tokens[1]; } else { - hm.put("note", val); + hm.put(FieldName.NOTE, val); } } else if ("K".equals(prefix)) { hm.put(FieldName.KEYWORDS, val); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/FreeCiteImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/FreeCiteImporter.java index 35d53738b8f..83a1fdde592 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/FreeCiteImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/FreeCiteImporter.java @@ -167,24 +167,24 @@ public ParserResult importEntries(String text) { // the content of the "tech" field seems to contain the number of the technical report e.setField(FieldName.NUMBER, parser.getElementText()); } else if (FieldName.DOI.equals(ln) - || "institution".equals(ln) + || FieldName.INSTITUTION.equals(ln) || "location".equals(ln) || FieldName.NUMBER.equals(ln) - || "note".equals(ln) + || FieldName.NOTE.equals(ln) || FieldName.TITLE.equals(ln) || FieldName.PAGES.equals(ln) || FieldName.PUBLISHER.equals(ln) || FieldName.VOLUME.equals(ln) || FieldName.YEAR.equals(ln)) { e.setField(ln, parser.getElementText()); - } else if ("booktitle".equals(ln)) { + } else if (FieldName.BOOKTITLE.equals(ln)) { String booktitle = parser.getElementText(); if (booktitle.startsWith("In ")) { // special treatment for parsing of // "In proceedings of..." references booktitle = booktitle.substring(3); } - e.setField("booktitle", booktitle); + e.setField(FieldName.BOOKTITLE, booktitle); } else if ("raw_string".equals(ln)) { // raw input string is ignored } else { @@ -200,13 +200,13 @@ public ParserResult importEntries(String text) { if (noteSB.length() > 0) { String note; - if (e.hasField("note")) { + if (e.hasField(FieldName.NOTE)) { // "note" could have been set during the parsing as FreeCite also returns "note" - note = e.getFieldOptional("note").get().concat(Globals.NEWLINE).concat(noteSB.toString()); + note = e.getFieldOptional(FieldName.NOTE).get().concat(Globals.NEWLINE).concat(noteSB.toString()); } else { note = noteSB.toString(); } - e.setField("note", note); + e.setField(FieldName.NOTE, note); } // type has been derived from "genre" diff --git a/src/main/java/net/sf/jabref/importer/fileformat/IsiImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/IsiImporter.java index b1c3835b153..8658aef5afc 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/IsiImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/IsiImporter.java @@ -227,7 +227,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { Type = "inproceedings"; } } else if ("JO".equals(beg)) { - hm.put("booktitle", value); + hm.put(FieldName.BOOKTITLE, value); } else if ("AU".equals(beg)) { String author = IsiImporter.isiAuthorsConvert(value.replace("EOLEOL", " and ")); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/JSONEntryParser.java b/src/main/java/net/sf/jabref/importer/fileformat/JSONEntryParser.java index badc3fdb766..d929458977a 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/JSONEntryParser.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/JSONEntryParser.java @@ -171,7 +171,7 @@ public static BibEntry parseSpringerJSONtoBibtex(JSONObject springerJsonEntry) { } else { // Probably book chapter or from proceeding, go for book chapter entry.setType("incollection"); - nametype = "booktitle"; + nametype = FieldName.BOOKTITLE; entry.setField(FieldName.ISBN, isbn); } diff --git a/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java index 1eb6b588012..2fec48b8975 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java @@ -80,6 +80,7 @@ import net.sf.jabref.importer.fileformat.medline.Text; import net.sf.jabref.logic.util.strings.StringUtil; import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.FieldName; import net.sf.jabref.model.entry.IdGenerator; import com.google.common.base.Joiner; @@ -283,7 +284,7 @@ private void addBookInformation(HashMap fields, Book book) { } putIfValueNotNull(fields, "volume", book.getVolume()); - putIfValueNotNull(fields, "edition", book.getEdition()); + putIfValueNotNull(fields, FieldName.EDITION, book.getEdition()); putIfValueNotNull(fields, "medium", book.getMedium()); putIfValueNotNull(fields, "reportnumber", book.getReportNumber()); @@ -406,7 +407,7 @@ private void addNotes(HashMap fields, List generalN notes.add(note.getContent()); } } - fields.put("note", join(notes, ", ")); + fields.put(FieldName.NOTE, join(notes, ", ")); } private void addInvestigators(HashMap fields, InvestigatorList investigatorList) { diff --git a/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java index a73dfed8f79..70fbcd4ca4a 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java @@ -157,21 +157,21 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { //store the fields in a map Map hashMap = new HashMap<>(); hashMap.put("PG", FieldName.PAGES); - hashMap.put("PL", "address"); + hashMap.put("PL", FieldName.ADDRESS); hashMap.put("PHST", "history"); hashMap.put("PST", "publication-status"); hashMap.put("VI", FieldName.VOLUME); - hashMap.put("LA", "language"); - hashMap.put("LA", "language"); + hashMap.put("LA", FieldName.LANGUAGE); + hashMap.put("LA", FieldName.LANGUAGE); hashMap.put("PUBM", "model"); hashMap.put("RN", "registry-number"); hashMap.put("NM", "substance-name"); hashMap.put("OCI", "copyright-owner"); hashMap.put("CN", "corporate"); hashMap.put("IP", FieldName.ISSUE); - hashMap.put("EN", "edition"); + hashMap.put("EN", FieldName.EDITION); hashMap.put("GS", "gene-symbol"); - hashMap.put("GN", "note"); + hashMap.put("GN", FieldName.NOTE); hashMap.put("GR", "grantno"); hashMap.put("SO", "source"); hashMap.put("NR", "number-of-references"); @@ -341,10 +341,10 @@ private void addTitles(Map hm, String lab, String val, String ty } } } else if ("BTI".equals(lab) || "CTI".equals(lab)) { - hm.put("booktitle", val); + hm.put(FieldName.BOOKTITLE, val); } else if ("JT".equals(lab)) { if ("inproceedings".equals(type)) { - hm.put("booktitle", val); + hm.put(FieldName.BOOKTITLE, val); } else { hm.put(FieldName.JOURNAL, val); } diff --git a/src/main/java/net/sf/jabref/importer/fileformat/OvidImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/OvidImporter.java index 32689b7d4ce..a924b30ddd5 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/OvidImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/OvidImporter.java @@ -156,14 +156,14 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } else if ((matcher = OvidImporter.INCOLLECTION_PATTERN.matcher(content)).find()) { h.put(FieldName.EDITOR, matcher.group(1).replace(" (Ed)", "")); h.put(FieldName.YEAR, matcher.group(2)); - h.put("booktitle", matcher.group(3)); + h.put(FieldName.BOOKTITLE, matcher.group(3)); h.put(FieldName.PAGES, matcher.group(4)); - h.put("address", matcher.group(5)); + h.put(FieldName.ADDRESS, matcher.group(5)); h.put(FieldName.PUBLISHER, matcher.group(6)); } else if ((matcher = OvidImporter.BOOK_PATTERN.matcher(content)).find()) { h.put(FieldName.YEAR, matcher.group(1)); h.put(FieldName.PAGES, matcher.group(2)); - h.put("address", matcher.group(3)); + h.put(FieldName.ADDRESS, matcher.group(3)); h.put(FieldName.PUBLISHER, matcher.group(4)); } @@ -184,7 +184,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { h.put("entrytype", "inproceedings"); } } else if (fieldName.startsWith("Language")) { - h.put("language", content); + h.put(FieldName.LANGUAGE, content); } else if (fieldName.startsWith("Author Keywords")) { content = content.replace(";", ",").replace(" ", " "); h.put(FieldName.KEYWORDS, content); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/PdfContentImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/PdfContentImporter.java index 97ac6e5b816..2a0e152668f 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/PdfContentImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/PdfContentImporter.java @@ -458,13 +458,13 @@ public ParserResult importDatabase(Path filePath, Charset defaultEncoding) { entry.setField(FieldName.TITLE, title); } if (conference != null) { - entry.setField("booktitle", conference); + entry.setField(FieldName.BOOKTITLE, conference); } if (DOI != null) { entry.setField(FieldName.DOI, DOI); } if (series != null) { - entry.setField("series", series); + entry.setField(FieldName.SERIES, series); } if (volume != null) { entry.setField(FieldName.VOLUME, volume); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/RepecNepImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/RepecNepImporter.java index 89ba9e6f382..c616e6016cf 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/RepecNepImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/RepecNepImporter.java @@ -309,7 +309,7 @@ private void parseAuthors(BibEntry be, BufferedReader in) throws IOException { be.setField(FieldName.AUTHOR, String.join(" and ", authors)); } if (institutions.length() > 0) { - be.setField("institution", institutions.toString()); + be.setField(FieldName.INSTITUTION, institutions.toString()); } } diff --git a/src/main/java/net/sf/jabref/importer/fileformat/RisImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/RisImporter.java index 29c10eaffc2..1406ef3ac65 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/RisImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/RisImporter.java @@ -147,9 +147,9 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } hm.put(FieldName.TITLE, hm.get(FieldName.TITLE).replaceAll("\\s+", " ")); // Normalize whitespaces } else if ("T2".equals(lab) || "BT".equals(lab)) { - hm.put("booktitle", val); + hm.put(FieldName.BOOKTITLE, val); } else if ("T3".equals(lab)) { - hm.put("series", val); + hm.put(FieldName.SERIES, val); } else if ("AU".equals(lab) || "A1".equals(lab)) { if ("".equals(author)) { author = val; @@ -164,7 +164,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } } else if ("JA".equals(lab) || "JF".equals(lab) || "JO".equals(lab)) { if ("inproceedings".equals(type)) { - hm.put("booktitle", val); + hm.put(FieldName.BOOKTITLE, val); } else { hm.put(FieldName.JOURNAL, val); } @@ -172,12 +172,12 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { startPage = val; } else if ("PB".equals(lab)) { if ("phdthesis".equals(type)) { - hm.put("school", val); + hm.put(FieldName.SCHOOL, val); } else { hm.put(FieldName.PUBLISHER, val); } } else if ("AD".equals(lab) || "CY".equals(lab)) { - hm.put("address", val); + hm.put(FieldName.ADDRESS, val); } else if ("EP".equals(lab)) { endPage = val; if (!endPage.isEmpty()) { diff --git a/src/main/java/net/sf/jabref/importer/fileformat/SilverPlatterImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/SilverPlatterImporter.java index e0db96ec5a7..cd349dbae32 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/SilverPlatterImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/SilverPlatterImporter.java @@ -160,7 +160,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } } else if ("AF".equals(f3)) { - h.put("school", frest.trim()); + h.put(FieldName.SCHOOL, frest.trim()); } else if ("DT".equals(f3)) { frest = frest.trim(); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/DoiCleanup.java b/src/main/java/net/sf/jabref/logic/cleanup/DoiCleanup.java index 98004464d4b..048dc9bbc2b 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/DoiCleanup.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/DoiCleanup.java @@ -32,7 +32,7 @@ public class DoiCleanup implements CleanupJob { /** * Fields to check for DOIs. */ - private static final String[] FIELDS = {"note", FieldName.URL, "ee"}; + private static final String[] FIELDS = {FieldName.NOTE, FieldName.URL, "ee"}; @Override public List cleanup(BibEntry entry) { diff --git a/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java b/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java index 3a92ad2bfd2..135893aaa6e 100644 --- a/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java +++ b/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java @@ -38,7 +38,7 @@ public class FieldFormatterCleanups { List defaultFormatters = new ArrayList<>(); defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - defaultFormatters.add(new FieldFormatterCleanup("booktitle", new OrdinalsToSuperscriptFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); } diff --git a/src/main/java/net/sf/jabref/logic/exporter/OOCalcDatabase.java b/src/main/java/net/sf/jabref/logic/exporter/OOCalcDatabase.java index 6c60aa6d4ba..545c431bbdf 100644 --- a/src/main/java/net/sf/jabref/logic/exporter/OOCalcDatabase.java +++ b/src/main/java/net/sf/jabref/logic/exporter/OOCalcDatabase.java @@ -166,27 +166,27 @@ public Document getDOMrepresentation() { addTableCell(result, row, getField(e, FieldName.MONTH)); addTableCell(result, row, getField(e, FieldName.PAGES)); addTableCell(result, row, getField(e, FieldName.YEAR)); - addTableCell(result, row, getField(e, "address")); - addTableCell(result, row, getField(e, "note")); + addTableCell(result, row, getField(e, FieldName.ADDRESS)); + addTableCell(result, row, getField(e, FieldName.NOTE)); addTableCell(result, row, getField(e, FieldName.URL)); - addTableCell(result, row, getField(e, "booktitle")); + addTableCell(result, row, getField(e, FieldName.BOOKTITLE)); addTableCell(result, row, getField(e, "chapter")); - addTableCell(result, row, getField(e, "edition")); - addTableCell(result, row, getField(e, "series")); + addTableCell(result, row, getField(e, FieldName.EDITION)); + addTableCell(result, row, getField(e, FieldName.SERIES)); addTableCell(result, row, getField(e, FieldName.EDITOR));//new AuthorLastFirst().format(getField(e, FieldName.EDITOR_FIELD))); addTableCell(result, row, getField(e, FieldName.PUBLISHER)); addTableCell(result, row, getField(e, "reporttype")); - addTableCell(result, row, getField(e, "howpublished")); - addTableCell(result, row, getField(e, "institution")); - addTableCell(result, row, getField(e, "organization")); - addTableCell(result, row, getField(e, "school")); + addTableCell(result, row, getField(e, FieldName.HOWPUBLISHED)); + addTableCell(result, row, getField(e, FieldName.INSTITUTION)); + addTableCell(result, row, getField(e, FieldName.ORGANIZATION)); + addTableCell(result, row, getField(e, FieldName.SCHOOL)); addTableCell(result, row, getField(e, "annote")); addTableCell(result, row, getField(e, "assignee")); addTableCell(result, row, getField(e, "day")); addTableCell(result, row, getField(e, "dayfiled")); addTableCell(result, row, getField(e, "monthfiled")); addTableCell(result, row, getField(e, "yearfiled")); - addTableCell(result, row, getField(e, "language")); + addTableCell(result, row, getField(e, FieldName.LANGUAGE)); addTableCell(result, row, getField(e, "nationality")); addTableCell(result, row, getField(e, "revision")); addTableCell(result, row, ""); diff --git a/src/main/java/net/sf/jabref/logic/exporter/OpenDocumentRepresentation.java b/src/main/java/net/sf/jabref/logic/exporter/OpenDocumentRepresentation.java index b8dbdc2abd6..e075d095c57 100644 --- a/src/main/java/net/sf/jabref/logic/exporter/OpenDocumentRepresentation.java +++ b/src/main/java/net/sf/jabref/logic/exporter/OpenDocumentRepresentation.java @@ -162,31 +162,31 @@ public Document getDOMrepresentation() { row = result.createElement("table:table-row"); addTableCell(result, row, getField(e, BibEntry.KEY_FIELD)); addTableCell(result, row, new GetOpenOfficeType().format(e.getType())); - addTableCell(result, row, getField(e, "address")); + addTableCell(result, row, getField(e, FieldName.ADDRESS)); addTableCell(result, row, getField(e, "assignee")); addTableCell(result, row, getField(e, "annote")); addTableCell(result, row, getField(e, FieldName.AUTHOR));//new AuthorLastFirst().format(getField(e, FieldName.AUTHOR_FIELD))); - addTableCell(result, row, getField(e, "booktitle")); + addTableCell(result, row, getField(e, FieldName.BOOKTITLE)); addTableCell(result, row, getField(e, "chapter")); addTableCell(result, row, getField(e, "day")); addTableCell(result, row, getField(e, "dayfiled")); - addTableCell(result, row, getField(e, "edition")); + addTableCell(result, row, getField(e, FieldName.EDITION)); addTableCell(result, row, getField(e, FieldName.EDITOR));//new AuthorLastFirst().format(getField(e, FieldName.EDITOR_FIELD))); - addTableCell(result, row, getField(e, "howpublished")); - addTableCell(result, row, getField(e, "institution")); + addTableCell(result, row, getField(e, FieldName.HOWPUBLISHED)); + addTableCell(result, row, getField(e, FieldName.INSTITUTION)); addTableCell(result, row, getField(e, FieldName.JOURNAL)); - addTableCell(result, row, getField(e, "language")); + addTableCell(result, row, getField(e, FieldName.LANGUAGE)); addTableCell(result, row, getField(e, FieldName.MONTH)); addTableCell(result, row, getField(e, "monthfiled")); addTableCell(result, row, getField(e, "nationality")); - addTableCell(result, row, getField(e, "note")); + addTableCell(result, row, getField(e, FieldName.NOTE)); addTableCell(result, row, getField(e, FieldName.NUMBER)); - addTableCell(result, row, getField(e, "organization")); + addTableCell(result, row, getField(e, FieldName.ORGANIZATION)); addTableCell(result, row, getField(e, FieldName.PAGES)); addTableCell(result, row, getField(e, FieldName.PUBLISHER)); addTableCell(result, row, getField(e, "revision")); - addTableCell(result, row, getField(e, "school")); - addTableCell(result, row, getField(e, "series")); + addTableCell(result, row, getField(e, FieldName.SCHOOL)); + addTableCell(result, row, getField(e, FieldName.SERIES)); addTableCell(result, row, new RemoveWhitespace().format(new RemoveBrackets().format(getField(e, FieldName.TITLE)))); addTableCell(result, row, getField(e, "reporttype")); addTableCell(result, row, getField(e, FieldName.VOLUME)); diff --git a/src/main/java/net/sf/jabref/logic/integrity/IntegrityCheck.java b/src/main/java/net/sf/jabref/logic/integrity/IntegrityCheck.java index 1a2920826f3..f27e7e96100 100644 --- a/src/main/java/net/sf/jabref/logic/integrity/IntegrityCheck.java +++ b/src/main/java/net/sf/jabref/logic/integrity/IntegrityCheck.java @@ -63,7 +63,7 @@ private List checkBibtexEntry(BibEntry entry) { result.addAll(new FileChecker(bibDatabaseContext).check(entry)); result.addAll(new TypeChecker().check(entry)); result.addAll(new AbbreviationChecker(FieldName.JOURNAL).check(entry)); - result.addAll(new AbbreviationChecker("booktitle").check(entry)); + result.addAll(new AbbreviationChecker(FieldName.BOOKTITLE).check(entry)); result.addAll(new BibStringChecker().check(entry)); result.addAll(new HTMLCharacterChecker().check(entry)); result.addAll(new BooktitleChecker().check(entry)); @@ -100,7 +100,7 @@ private static class BooktitleChecker implements Checker { @Override public List check(BibEntry entry) { - String field = "booktitle"; + String field = FieldName.BOOKTITLE; Optional value = entry.getFieldOptional(field); if (!value.isPresent()) { return Collections.emptyList(); diff --git a/src/main/java/net/sf/jabref/logic/labelpattern/LabelPatternUtil.java b/src/main/java/net/sf/jabref/logic/labelpattern/LabelPatternUtil.java index 88467cb77f4..507d422a68a 100644 --- a/src/main/java/net/sf/jabref/logic/labelpattern/LabelPatternUtil.java +++ b/src/main/java/net/sf/jabref/logic/labelpattern/LabelPatternUtil.java @@ -310,7 +310,7 @@ private static String generateInstitutionKey(String content) { if (k.matches("^[Tt][Ee][Cc][Hh].*")) { // Starts with "tech" case and locale independent isTechnology = true; } - if ("school".equalsIgnoreCase(k)) { + if (FieldName.SCHOOL.equalsIgnoreCase(k)) { isSchool = true; } if (k.matches("^[Dd][EeIi][Pp].*") || k.matches("^[Ll][Aa][Bb].*")) { // Starts with "dep"/"dip"/"lab", case and locale independent @@ -347,7 +347,7 @@ private static String generateInstitutionKey(String content) { StringBuilder schoolSB = new StringBuilder(); StringBuilder departmentSB = new StringBuilder(); for (String k : part) { - if (!k.matches("^[Dd][EeIi][Pp].*") && !"school".equalsIgnoreCase(k) + if (!k.matches("^[Dd][EeIi][Pp].*") && !FieldName.SCHOOL.equalsIgnoreCase(k) && !"faculty".equalsIgnoreCase(k) && !(k.replaceAll(STARTING_CAPITAL_PATTERN, "").isEmpty())) { if (isSchool) { diff --git a/src/main/java/net/sf/jabref/logic/mods/MODSEntry.java b/src/main/java/net/sf/jabref/logic/mods/MODSEntry.java index abf9d73c0b9..df6e3748da9 100644 --- a/src/main/java/net/sf/jabref/logic/mods/MODSEntry.java +++ b/src/main/java/net/sf/jabref/logic/mods/MODSEntry.java @@ -131,7 +131,7 @@ private void populateFromBibtex(BibEntry bibtex) { if ("article".equals(bibtex.getType()) || "inproceedings".equals(bibtex.getType())) { host = new MODSEntry(); host.entryType = "relatedItem"; - host.title = bibtex.getField("booktitle"); + host.title = bibtex.getField(FieldName.BOOKTITLE); host.publisher = bibtex.getField(FieldName.PUBLISHER); host.number = bibtex.getField(FieldName.NUMBER); if (bibtex.hasField(FieldName.VOLUME)) { diff --git a/src/main/java/net/sf/jabref/logic/msbib/BibTeXConverter.java b/src/main/java/net/sf/jabref/logic/msbib/BibTeXConverter.java index acd7292073f..c7a2257a224 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/BibTeXConverter.java +++ b/src/main/java/net/sf/jabref/logic/msbib/BibTeXConverter.java @@ -38,9 +38,9 @@ public static BibEntry convert(MSBibEntry entry) { } // Value must be converted - if (fieldValues.containsKey("language")) { - int lcid = Integer.valueOf(fieldValues.get("language")); - fieldValues.put("language", MSBibMapping.getLanguage(lcid)); + if (fieldValues.containsKey(FieldName.LANGUAGE)) { + int lcid = Integer.valueOf(fieldValues.get(FieldName.LANGUAGE)); + fieldValues.put(FieldName.LANGUAGE, MSBibMapping.getLanguage(lcid)); } addAuthor(fieldValues, FieldName.AUTHOR, entry.authors); @@ -66,11 +66,11 @@ public static BibEntry convert(MSBibEntry entry) { parseStandardNumber(entry.standardNumber, fieldValues); if (entry.address != null) { - fieldValues.put("address", entry.address); + fieldValues.put(FieldName.ADDRESS, entry.address); } // TODO: ConferenceName is saved as booktitle when converting from MSBIB to BibTeX if (entry.conferenceName != null) { - fieldValues.put("organization", entry.conferenceName); + fieldValues.put(FieldName.ORGANIZATION, entry.conferenceName); } if (entry.dateAccessed != null) { diff --git a/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java b/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java index 95506884b93..f7e9d808944 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java +++ b/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java @@ -32,8 +32,8 @@ public static MSBibEntry convert(BibEntry entry) { } // Duplicate: also added as BookTitle - if (entry.hasField("booktitle")) { - result.conferenceName = entry.getField("booktitle"); + if (entry.hasField(FieldName.BOOKTITLE)) { + result.conferenceName = entry.getField(FieldName.BOOKTITLE); } if (entry.hasField(FieldName.PAGES)) { @@ -55,8 +55,8 @@ public static MSBibEntry convert(BibEntry entry) { } // Value must be converted - if (entry.hasField("language")) { - result.fields.put("LCID", String.valueOf(MSBibMapping.getLCID(entry.getField("language")))); + if (entry.hasField(FieldName.LANGUAGE)) { + result.fields.put("LCID", String.valueOf(MSBibMapping.getLCID(entry.getField(FieldName.LANGUAGE)))); } result.standardNumber = ""; @@ -79,12 +79,12 @@ public static MSBibEntry convert(BibEntry entry) { result.standardNumber = null; } - if (entry.hasField("address")) { - result.address = entry.getField("address"); + if (entry.hasField(FieldName.ADDRESS)) { + result.address = entry.getField(FieldName.ADDRESS); } - if (entry.hasField("type")) { - result.thesisType = entry.getField("type"); + if (entry.hasField(FieldName.TYPE)) { + result.thesisType = entry.getField(FieldName.TYPE); } else { if ("techreport".equalsIgnoreCase(entry.getType())) { result.thesisType = "Tech. rep."; diff --git a/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java b/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java index 89a78d35778..eff6257ee4e 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java +++ b/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java @@ -20,27 +20,27 @@ public class MSBibMapping { bibtexToMSBib.put(FieldName.TITLE, "Title"); bibtexToMSBib.put(FieldName.YEAR, "Year"); bibtexToMSBib.put(FieldName.MONTH, "Month"); - bibtexToMSBib.put("note", "Comments"); + bibtexToMSBib.put(FieldName.NOTE, "Comments"); bibtexToMSBib.put(FieldName.VOLUME, "Volume"); - bibtexToMSBib.put("language", "LCID"); - bibtexToMSBib.put("edition", "Edition"); + bibtexToMSBib.put(FieldName.LANGUAGE, "LCID"); + bibtexToMSBib.put(FieldName.EDITION, "Edition"); bibtexToMSBib.put(FieldName.PUBLISHER, "Publisher"); - bibtexToMSBib.put("booktitle", "BookTitle"); - //bibtexToMSBib.put("booktitle", "ConferenceName"); + bibtexToMSBib.put(FieldName.BOOKTITLE, "BookTitle"); + //bibtexToMSBib.put(FieldName.BOOKTITLE, "ConferenceName"); //bibtexToMSBib.put(FieldName.PAGES, "Pages"); bibtexToMSBib.put("chapter", "ChapterNumber"); bibtexToMSBib.put(FieldName.JOURNAL, "JournalName"); bibtexToMSBib.put(FieldName.NUMBER, "Issue"); - bibtexToMSBib.put("school", "Department"); - bibtexToMSBib.put("institution", "Institution"); + bibtexToMSBib.put(FieldName.SCHOOL, "Department"); + bibtexToMSBib.put(FieldName.INSTITUTION, "Institution"); bibtexToMSBib.put(FieldName.DOI, "DOI"); bibtexToMSBib.put(FieldName.URL, "URL"); // BibTeX/Biblatex only fields - bibtexToMSBib.put("series", BIBTEX_PREFIX + "Series"); + bibtexToMSBib.put(FieldName.SERIES, BIBTEX_PREFIX + "Series"); bibtexToMSBib.put(FieldName.ABSTRACT, BIBTEX_PREFIX + "Abstract"); bibtexToMSBib.put(FieldName.KEYWORDS, BIBTEX_PREFIX + "KeyWords"); bibtexToMSBib.put(FieldName.CROSSREF, BIBTEX_PREFIX + "CrossRef"); - bibtexToMSBib.put("howpublished", BIBTEX_PREFIX + "HowPublished"); + bibtexToMSBib.put(FieldName.HOWPUBLISHED, BIBTEX_PREFIX + "HowPublished"); bibtexToMSBib.put("affiliation", BIBTEX_PREFIX + "Affiliation"); bibtexToMSBib.put("contents", BIBTEX_PREFIX + "Contents"); bibtexToMSBib.put("copyright", BIBTEX_PREFIX + "Copyright"); @@ -60,7 +60,7 @@ public class MSBibMapping { bibtexToMSBib.put(MSBIB_PREFIX + "distributor", "Distributor"); bibtexToMSBib.put(MSBIB_PREFIX + "broadcaster", "Broadcaster"); bibtexToMSBib.put(MSBIB_PREFIX + "station", "Station"); - bibtexToMSBib.put(MSBIB_PREFIX + "type", "Type"); + bibtexToMSBib.put(MSBIB_PREFIX + FieldName.TYPE, "Type"); bibtexToMSBib.put(MSBIB_PREFIX + "patentnumber", "PatentNumber"); bibtexToMSBib.put(MSBIB_PREFIX + "court", "Court"); bibtexToMSBib.put(MSBIB_PREFIX + "reporter", "Reporter"); diff --git a/src/main/java/net/sf/jabref/logic/xmp/XMPSchemaBibtex.java b/src/main/java/net/sf/jabref/logic/xmp/XMPSchemaBibtex.java index e5bb44522eb..08e081feb48 100644 --- a/src/main/java/net/sf/jabref/logic/xmp/XMPSchemaBibtex.java +++ b/src/main/java/net/sf/jabref/logic/xmp/XMPSchemaBibtex.java @@ -55,7 +55,7 @@ public class XMPSchemaBibtex extends XMPSchema { static { XMPSchemaBibtex.PRESERVE_WHITE_SPACE.add(FieldName.ABSTRACT); - XMPSchemaBibtex.PRESERVE_WHITE_SPACE.add("note"); + XMPSchemaBibtex.PRESERVE_WHITE_SPACE.add(FieldName.NOTE); XMPSchemaBibtex.PRESERVE_WHITE_SPACE.add(FieldName.REVIEW); } diff --git a/src/main/java/net/sf/jabref/model/entry/BibLatexEntryTypes.java b/src/main/java/net/sf/jabref/model/entry/BibLatexEntryTypes.java index cd428e972c4..87a04ed9c29 100644 --- a/src/main/java/net/sf/jabref/model/entry/BibLatexEntryTypes.java +++ b/src/main/java/net/sf/jabref/model/entry/BibLatexEntryTypes.java @@ -29,14 +29,14 @@ public class BibLatexEntryTypes { public static final BibLatexEntryType ARTICLE = new BibLatexEntryType() { private final List primaryOptionalFields = Collections.unmodifiableList( - Arrays.asList("subtitle", FieldName.EDITOR, "series", FieldName.VOLUME, FieldName.NUMBER, "eid", FieldName.ISSUE, FieldName.PAGES, - "note", FieldName.ISSN, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); + Arrays.asList("subtitle", FieldName.EDITOR, FieldName.SERIES, FieldName.VOLUME, FieldName.NUMBER, "eid", FieldName.ISSUE, FieldName.PAGES, + FieldName.NOTE, FieldName.ISSN, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.JOURNALTITLE, "year/date"); addAllOptional("translator", "annotator", "commentator", "subtitle", "titleaddon", FieldName.EDITOR, "editora", - "editorb", "editorc", "journalsubtitle", "issuetitle", "issuesubtitle", "language", "origlanguage", - "series", FieldName.VOLUME, FieldName.NUMBER, "eid", FieldName.ISSUE, FieldName.MONTH, FieldName.PAGES, "version", "note", FieldName.ISSN, + "editorb", "editorc", "journalsubtitle", "issuetitle", "issuesubtitle", FieldName.LANGUAGE, "origlanguage", + FieldName.SERIES, FieldName.VOLUME, FieldName.NUMBER, "eid", FieldName.ISSUE, FieldName.MONTH, FieldName.PAGES, "version", FieldName.NOTE, FieldName.ISSN, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -55,7 +55,7 @@ public List getPrimaryOptionalFields() { private final List primaryOptionalFields = Collections .unmodifiableList(Arrays.asList(FieldName.EDITOR, "subtitle", "titleaddon", "maintitle", - "mainsubtitle", "maintitleaddon", FieldName.VOLUME, "edition", FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, + "mainsubtitle", "maintitleaddon", FieldName.VOLUME, FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); @@ -63,8 +63,8 @@ public List getPrimaryOptionalFields() { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "year/date"); addAllOptional(FieldName.EDITOR, "editora", "editorb", "editorc", "translator", "annotator", "commentator", "introduction", "foreword", "afterword", "subtitle", "titleaddon", "maintitle", "mainsubtitle", - "maintitleaddon", "language", "origlanguage", FieldName.VOLUME, "part", "edition", "volumes", "series", - FieldName.NUMBER, "note", FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", + "maintitleaddon", FieldName.LANGUAGE, "origlanguage", FieldName.VOLUME, "part", FieldName.EDITION, "volumes", FieldName.SERIES, + FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -82,14 +82,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType MVBOOK = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList(FieldName.EDITOR, "subtitle", "titleaddon", "edition", FieldName.PUBLISHER, FieldName.ISBN, "pagetotal", + .unmodifiableList(Arrays.asList(FieldName.EDITOR, "subtitle", "titleaddon", FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "pagetotal", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "year/date"); addAllOptional(FieldName.EDITOR, "editora", "editorb", "editorc", "translator", "annotator", "commentator", - "introduction", "foreword", "afterword", "subtitle", "titleaddon", "language", "origlanguage", - "edition", "volumes", "series", FieldName.NUMBER, "note", FieldName.PUBLISHER, "location", FieldName.ISBN, "pagetotal", + "introduction", "foreword", "afterword", "subtitle", "titleaddon", FieldName.LANGUAGE, "origlanguage", + FieldName.EDITION, "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -108,16 +108,16 @@ public List getPrimaryOptionalFields() { private final List primaryOptionalFields = Collections.unmodifiableList(Arrays .asList("bookauthor", FieldName.EDITOR, "subtitle", "titleaddon", "maintitle", "mainsubtitle", - "maintitleaddon", "booksubtitle", "booktitleaddon", FieldName.VOLUME, "edition", FieldName.PUBLISHER, FieldName.ISBN, + "maintitleaddon", "booksubtitle", "booktitleaddon", FieldName.VOLUME, FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", "year/date"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, "year/date"); addAllOptional("bookauthor", FieldName.EDITOR, "editora", "editorb", "editorc", "translator", "annotator", "commentator", "introduction", "foreword", "afterword", "subtitle", "titleaddon", "maintitle", - "mainsubtitle", "maintitleaddon", "booksubtitle", "booktitleaddon", "language", "origlanguage", - FieldName.VOLUME, "part", "edition", "volumes", "series", FieldName.NUMBER, "note", FieldName.PUBLISHER, "location", FieldName.ISBN, + "mainsubtitle", "maintitleaddon", "booksubtitle", "booktitleaddon", FieldName.LANGUAGE, "origlanguage", + FieldName.VOLUME, "part", FieldName.EDITION, "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -184,12 +184,12 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType BOOKLET = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("subtitle", "titleaddon", "howpublished", "chapter", + .unmodifiableList(Arrays.asList("subtitle", "titleaddon", FieldName.HOWPUBLISHED, "chapter", FieldName.PAGES, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired("author/editor", FieldName.TITLE, "year/date"); - addAllOptional("subtitle", "titleaddon", "language", "howpublished", "type", "note", "location", "chapter", + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.HOWPUBLISHED, FieldName.TYPE, FieldName.NOTE, "location", "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -209,7 +209,7 @@ public List getPrimaryOptionalFields() { private final List primaryOptionalFields = Collections .unmodifiableList(Arrays.asList("translator", "subtitle", "titleaddon", "maintitle", - "mainsubtitle", "maintitleaddon", FieldName.VOLUME, "edition", FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, + "mainsubtitle", "maintitleaddon", FieldName.VOLUME, FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); @@ -217,7 +217,7 @@ public List getPrimaryOptionalFields() { addAllRequired(FieldName.EDITOR, FieldName.TITLE, "year/date"); addAllOptional("editora", "editorb", "editorc", "translator", "annotator", "commentator", "introduction", "foreword", "afterword", "subtitle", "titleaddon", "maintitle", "mainsubtitle", "maintitleaddon", - "language", "origlanguage", FieldName.VOLUME, "part", "edition", "volumes", "series", FieldName.NUMBER, "note", + FieldName.LANGUAGE, "origlanguage", FieldName.VOLUME, "part", FieldName.EDITION, "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -236,14 +236,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType MVCOLLECTION = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("translator", "subtitle", "titleaddon", "edition", FieldName.PUBLISHER, FieldName.ISBN, + .unmodifiableList(Arrays.asList("translator", "subtitle", "titleaddon", FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired(FieldName.EDITOR, FieldName.TITLE, "year/date"); addAllOptional("editora", "editorb", "editorc", "translator", "annotator", "commentator", "introduction", - "foreword", "afterword", "subtitle", "titleaddon", "language", "origlanguage", "edition", "volumes", "series", FieldName.NUMBER, "note", + "foreword", "afterword", "subtitle", "titleaddon", FieldName.LANGUAGE, "origlanguage", FieldName.EDITION, "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -263,16 +263,16 @@ public List getPrimaryOptionalFields() { private final List primaryOptionalFields = Collections.unmodifiableList( Arrays.asList("translator", "subtitle", "titleaddon", "maintitle", "mainsubtitle", - "maintitleaddon", "booksubtitle", "booktitleaddon", FieldName.VOLUME, "edition", FieldName.PUBLISHER, FieldName.ISBN, + "maintitleaddon", "booksubtitle", "booktitleaddon", FieldName.VOLUME, FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", "year/date"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, "year/date"); addAllOptional(FieldName.EDITOR, "editora", "editorb", "editorc", "translator", "annotator", "commentator", "introduction", "foreword", "afterword", "subtitle", "titleaddon", "maintitle", "mainsubtitle", "maintitleaddon", - "booksubtitle", "booktitleaddon", "language", "origlanguage", FieldName.VOLUME, "part", "edition", - "volumes", "series", FieldName.NUMBER, "note", FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, + "booksubtitle", "booktitleaddon", FieldName.LANGUAGE, "origlanguage", FieldName.VOLUME, "part", FieldName.EDITION, + "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -314,14 +314,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType MANUAL = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("subtitle", "titleaddon", "edition", FieldName.PUBLISHER, FieldName.ISBN, + .unmodifiableList(Arrays.asList("subtitle", "titleaddon", FieldName.EDITION, FieldName.PUBLISHER, FieldName.ISBN, "chapter", FieldName.PAGES, FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired("author/editor", FieldName.TITLE, "year/date"); - addAllOptional("subtitle", "titleaddon", "language", "edition", "type", "series", FieldName.NUMBER, "version", - "note", "organization", FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.EDITION, FieldName.TYPE, FieldName.SERIES, FieldName.NUMBER, "version", + FieldName.NOTE, FieldName.ORGANIZATION, FieldName.PUBLISHER, "location", FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -339,14 +339,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType MISC = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("subtitle", "titleaddon", "howpublished", "location", + .unmodifiableList(Arrays.asList("subtitle", "titleaddon", FieldName.HOWPUBLISHED, "location", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { addAllRequired("author/editor", FieldName.TITLE, "year/date"); - addAllOptional("subtitle", "titleaddon", "language", "howpublished", "type", "version", "note", - "organization", "location", FieldName.MONTH, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.HOWPUBLISHED, FieldName.TYPE, "version", FieldName.NOTE, + FieldName.ORGANIZATION, "location", FieldName.MONTH, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -364,12 +364,12 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType ONLINE = new BibLatexEntryType() { private final List primaryOptionalFields = Collections.unmodifiableList( - Arrays.asList("subtitle", "titleaddon", "note", "organization", "urldate")); + Arrays.asList("subtitle", "titleaddon", FieldName.NOTE, FieldName.ORGANIZATION, "urldate")); { addAllRequired("author/editor", FieldName.TITLE, "year/date", FieldName.URL); - addAllOptional("subtitle", "titleaddon", "language", "version", "note", "organization", FieldName.MONTH, "addendum", "pubstate", "urldate"); + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, "version", FieldName.NOTE, FieldName.ORGANIZATION, FieldName.MONTH, "addendum", "pubstate", "urldate"); } @Override @@ -391,7 +391,7 @@ public List getPrimaryOptionalFields() { { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.NUMBER, "year/date"); - addAllOptional("holder", "subtitle", "titleaddon", "type", "version", "location", "note", FieldName.MONTH, + addAllOptional("holder", "subtitle", "titleaddon", FieldName.TYPE, "version", "location", FieldName.NOTE, FieldName.MONTH, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -415,8 +415,8 @@ public List getPrimaryOptionalFields() { { addAllRequired(FieldName.EDITOR, FieldName.TITLE, "year/date"); - addAllOptional("editora", "editorb", "editorc", "subtitle", "issuetitle", "issuesubtitle", "language", - "series", FieldName.VOLUME, FieldName.NUMBER, FieldName.ISSUE, FieldName.MONTH, "note", FieldName.ISSN, "addendum", "pubstate", + addAllOptional("editora", "editorb", "editorc", "subtitle", "issuetitle", "issuesubtitle", FieldName.LANGUAGE, + FieldName.SERIES, FieldName.VOLUME, FieldName.NUMBER, FieldName.ISSUE, FieldName.MONTH, FieldName.NOTE, FieldName.ISSN, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -466,8 +466,8 @@ public List getPrimaryOptionalFields() { { addAllRequired(FieldName.TITLE, "year/date"); addAllOptional(FieldName.EDITOR, "subtitle", "titleaddon", "maintitle", "mainsubtitle", "maintitleaddon", "eventtitle", - "eventtitleaddon", "eventdate", "venue", "language", FieldName.VOLUME, "part", "volumes", "series", FieldName.NUMBER, "note", - "organization", FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.YEAR, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", + "eventtitleaddon", "eventdate", "venue", FieldName.LANGUAGE, FieldName.VOLUME, "part", "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, + FieldName.ORGANIZATION, FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.YEAR, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -493,8 +493,8 @@ public List getPrimaryOptionalFields() { { addAllRequired(FieldName.TITLE, "year/date"); addAllOptional(FieldName.EDITOR, "subtitle", "titleaddon", "eventtitle", - "eventtitleaddon", "eventdate", "venue", "language", "volumes", "series", FieldName.NUMBER, "note", - "organization", FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.ISBN, "pagetotal", + "eventtitleaddon", "eventdate", "venue", FieldName.LANGUAGE, "volumes", FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, + FieldName.ORGANIZATION, FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.ISBN, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -518,10 +518,10 @@ public List getPrimaryOptionalFields() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", "year/date"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, "year/date"); addAllOptional(FieldName.EDITOR, "subtitle", "titleaddon", "maintitle", "mainsubtitle", "maintitleaddon", "booksubtitle", - "booktitleaddon", "eventtitle", "eventtitleaddon", "eventdate", "venue", "language", FieldName.VOLUME, "part", "volumes", - "series", FieldName.NUMBER, "note", "organization", FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.ISBN, + "booktitleaddon", "eventtitle", "eventtitleaddon", "eventdate", "venue", FieldName.LANGUAGE, FieldName.VOLUME, "part", "volumes", + FieldName.SERIES, FieldName.NUMBER, FieldName.NOTE, FieldName.ORGANIZATION, FieldName.PUBLISHER, "location", FieldName.MONTH, FieldName.ISBN, "chapter", FieldName.PAGES, "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -617,8 +617,8 @@ public List getPrimaryOptionalFields() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "type", "institution", "year/date"); - addAllOptional("subtitle", "titleaddon", "language", FieldName.NUMBER, "version", "note", "location", FieldName.MONTH, + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.TYPE, FieldName.INSTITUTION, "year/date"); + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.NUMBER, "version", FieldName.NOTE, "location", FieldName.MONTH, "isrn", "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -653,8 +653,8 @@ public String getName() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "type", "institution", "year/date"); - addAllOptional("subtitle", "titleaddon", "language", "note", "location", FieldName.MONTH, FieldName.ISBN, "chapter", + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.TYPE, FieldName.INSTITUTION, "year/date"); + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.NOTE, "location", FieldName.MONTH, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -673,12 +673,12 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType UNPUBLISHED = new BibLatexEntryType() { private final List primaryOptionalFields = Collections.unmodifiableList( - Arrays.asList("subtitle", "titleaddon", "howpublished", "pubstate", FieldName.URL, "urldate")); + Arrays.asList("subtitle", "titleaddon", FieldName.HOWPUBLISHED, "pubstate", FieldName.URL, "urldate")); { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "year/date"); - addAllOptional("subtitle", "titleaddon", "language", "howpublished", "note", "location", FieldName.MONTH, + addAllOptional("subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.HOWPUBLISHED, FieldName.NOTE, "location", FieldName.MONTH, "addendum", "pubstate", FieldName.URL, "urldate"); } @@ -746,14 +746,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType MASTERSTHESIS = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("subtitle", "titleaddon", "type", "chapter", FieldName.PAGES, + .unmodifiableList(Arrays.asList("subtitle", "titleaddon", FieldName.TYPE, "chapter", FieldName.PAGES, "pagetotal", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { - // Treated as alias of "THESIS", except "type" field is optional - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "institution", "year/date"); - addAllOptional("type", "subtitle", "titleaddon", "language", "note", "location", FieldName.MONTH, FieldName.ISBN, "chapter", + // Treated as alias of "THESIS", except FieldName.TYPE field is optional + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.INSTITUTION, "year/date"); + addAllOptional(FieldName.TYPE, "subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.NOTE, "location", FieldName.MONTH, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -772,14 +772,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType PHDTHESIS = new BibLatexEntryType() { private final List primaryOptionalFields = Collections - .unmodifiableList(Arrays.asList("subtitle", "titleaddon", "type", "chapter", FieldName.PAGES, + .unmodifiableList(Arrays.asList("subtitle", "titleaddon", FieldName.TYPE, "chapter", FieldName.PAGES, "pagetotal", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { - // Treated as alias of "THESIS", except "type" field is optional - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "institution", "year/date"); - addAllOptional("type", "subtitle", "titleaddon", "language", "note", "location", FieldName.MONTH, FieldName.ISBN, "chapter", + // Treated as alias of "THESIS", except FieldName.TYPE field is optional + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.INSTITUTION, "year/date"); + addAllOptional(FieldName.TYPE, "subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.NOTE, "location", FieldName.MONTH, FieldName.ISBN, "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } @@ -798,14 +798,14 @@ public List getPrimaryOptionalFields() { public static final BibLatexEntryType TECHREPORT = new BibLatexEntryType() { private final List primaryOptionalFields = Collections.unmodifiableList( - Arrays.asList("subtitle", "titleaddon", "type", FieldName.NUMBER, "isrn", "chapter", FieldName.PAGES, + Arrays.asList("subtitle", "titleaddon", FieldName.TYPE, FieldName.NUMBER, "isrn", "chapter", FieldName.PAGES, "pagetotal", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate")); { - // Treated as alias of "REPORT", except "type" field is optional - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "institution", "year/date"); - addAllOptional("type", "subtitle", "titleaddon", "language", FieldName.NUMBER, "version", "note", "location", FieldName.MONTH, + // Treated as alias of "REPORT", except FieldName.TYPE field is optional + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.INSTITUTION, "year/date"); + addAllOptional(FieldName.TYPE, "subtitle", "titleaddon", FieldName.LANGUAGE, FieldName.NUMBER, "version", FieldName.NOTE, "location", FieldName.MONTH, "isrn", "chapter", FieldName.PAGES, "pagetotal", "addendum", "pubstate", FieldName.DOI, "eprint", "eprintclass", "eprinttype", FieldName.URL, "urldate"); } diff --git a/src/main/java/net/sf/jabref/model/entry/BibtexEntryTypes.java b/src/main/java/net/sf/jabref/model/entry/BibtexEntryTypes.java index 0c906913a55..313c5481217 100644 --- a/src/main/java/net/sf/jabref/model/entry/BibtexEntryTypes.java +++ b/src/main/java/net/sf/jabref/model/entry/BibtexEntryTypes.java @@ -21,7 +21,7 @@ public class BibtexEntryTypes { { addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.JOURNAL, FieldName.YEAR); - addAllOptional(FieldName.VOLUME, FieldName.NUMBER, FieldName.PAGES, FieldName.MONTH, "note"); + addAllOptional(FieldName.VOLUME, FieldName.NUMBER, FieldName.PAGES, FieldName.MONTH, FieldName.NOTE); } @Override @@ -40,7 +40,7 @@ public String getName() { { addAllRequired(FieldName.TITLE, FieldName.PUBLISHER, FieldName.YEAR, "author/editor"); - addAllOptional(FieldName.VOLUME, FieldName.NUMBER, "series", "address", "edition", FieldName.MONTH, "note"); + addAllOptional(FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.ADDRESS, FieldName.EDITION, FieldName.MONTH, FieldName.NOTE); } @Override @@ -59,7 +59,7 @@ public String getName() { { addAllRequired(FieldName.TITLE); - addAllOptional(FieldName.AUTHOR, "howpublished", "address", FieldName.MONTH, FieldName.YEAR, "note"); + addAllOptional(FieldName.AUTHOR, FieldName.HOWPUBLISHED, FieldName.ADDRESS, FieldName.MONTH, FieldName.YEAR, FieldName.NOTE); } @Override @@ -77,9 +77,9 @@ public String getName() { public static final EntryType CONFERENCE = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", FieldName.YEAR); - addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, "series", FieldName.PAGES, "address", FieldName.MONTH, "organization", - FieldName.PUBLISHER, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, FieldName.YEAR); + addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.PAGES, FieldName.ADDRESS, FieldName.MONTH, FieldName.ORGANIZATION, + FieldName.PUBLISHER, FieldName.NOTE); } @Override @@ -98,7 +98,7 @@ public String getName() { { addAllRequired("chapter/pages", FieldName.TITLE, FieldName.PUBLISHER, FieldName.YEAR, "author/editor"); - addAllOptional(FieldName.VOLUME, FieldName.NUMBER, "series", "type", "address", "edition", FieldName.MONTH, "note"); + addAllOptional(FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.TYPE, FieldName.ADDRESS, FieldName.EDITION, FieldName.MONTH, FieldName.NOTE); } @Override @@ -115,9 +115,9 @@ public String getName() { public static final EntryType INCOLLECTION = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", FieldName.PUBLISHER, FieldName.YEAR); - addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, "series", "type", "chapter", FieldName.PAGES, "address", "edition", - FieldName.MONTH, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, FieldName.PUBLISHER, FieldName.YEAR); + addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.TYPE, "chapter", FieldName.PAGES, FieldName.ADDRESS, FieldName.EDITION, + FieldName.MONTH, FieldName.NOTE); } @Override @@ -135,9 +135,9 @@ public String getName() { public static final EntryType INPROCEEDINGS = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "booktitle", FieldName.YEAR); - addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, "series", FieldName.PAGES, "address", FieldName.MONTH, "organization", - FieldName.PUBLISHER, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.BOOKTITLE, FieldName.YEAR); + addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.PAGES, FieldName.ADDRESS, FieldName.MONTH, FieldName.ORGANIZATION, + FieldName.PUBLISHER, FieldName.NOTE); } @Override @@ -155,7 +155,7 @@ public String getName() { { addAllRequired(FieldName.TITLE); - addAllOptional(FieldName.AUTHOR, "organization", "address", "edition", FieldName.MONTH, FieldName.YEAR, "note"); + addAllOptional(FieldName.AUTHOR, FieldName.ORGANIZATION, FieldName.ADDRESS, FieldName.EDITION, FieldName.MONTH, FieldName.YEAR, FieldName.NOTE); } @Override @@ -173,8 +173,8 @@ public String getName() { public static final EntryType MASTERSTHESIS = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "school", FieldName.YEAR); - addAllOptional("type", "address", FieldName.MONTH, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.SCHOOL, FieldName.YEAR); + addAllOptional(FieldName.TYPE, FieldName.ADDRESS, FieldName.MONTH, FieldName.NOTE); } @Override @@ -192,7 +192,7 @@ public String getName() { public static final EntryType MISC = new BibtexEntryType() { { - addAllOptional(FieldName.AUTHOR, FieldName.TITLE, "howpublished", FieldName.MONTH, FieldName.YEAR, "note"); + addAllOptional(FieldName.AUTHOR, FieldName.TITLE, FieldName.HOWPUBLISHED, FieldName.MONTH, FieldName.YEAR, FieldName.NOTE); } @Override @@ -210,8 +210,8 @@ public String getName() { public static final EntryType PHDTHESIS = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "school", FieldName.YEAR); - addAllOptional("type", "address", FieldName.MONTH, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.SCHOOL, FieldName.YEAR); + addAllOptional(FieldName.TYPE, FieldName.ADDRESS, FieldName.MONTH, FieldName.NOTE); } @Override @@ -230,8 +230,8 @@ public String getName() { { addAllRequired(FieldName.TITLE, FieldName.YEAR); - addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, "series", "address", FieldName.PUBLISHER, "note", FieldName.MONTH, - "organization"); + addAllOptional(FieldName.EDITOR, FieldName.VOLUME, FieldName.NUMBER, FieldName.SERIES, FieldName.ADDRESS, FieldName.PUBLISHER, FieldName.NOTE, FieldName.MONTH, + FieldName.ORGANIZATION); } @Override @@ -249,8 +249,8 @@ public String getName() { public static final EntryType TECHREPORT = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "institution", FieldName.YEAR); - addAllOptional("type", FieldName.NUMBER, "address", FieldName.MONTH, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.INSTITUTION, FieldName.YEAR); + addAllOptional(FieldName.TYPE, FieldName.NUMBER, FieldName.ADDRESS, FieldName.MONTH, FieldName.NOTE); } @Override @@ -268,7 +268,7 @@ public String getName() { public static final EntryType UNPUBLISHED = new BibtexEntryType() { { - addAllRequired(FieldName.AUTHOR, FieldName.TITLE, "note"); + addAllRequired(FieldName.AUTHOR, FieldName.TITLE, FieldName.NOTE); addAllOptional(FieldName.MONTH, FieldName.YEAR); } diff --git a/src/main/java/net/sf/jabref/model/entry/EntryConverter.java b/src/main/java/net/sf/jabref/model/entry/EntryConverter.java index ad48e6e1d32..67bae56b1f4 100644 --- a/src/main/java/net/sf/jabref/model/entry/EntryConverter.java +++ b/src/main/java/net/sf/jabref/model/entry/EntryConverter.java @@ -17,14 +17,14 @@ public class EntryConverter { static { EntryConverter.FIELD_ALIASES_TEX_TO_LTX = new HashMap<>(); - EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("address", "location"); + EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put(FieldName.ADDRESS, "location"); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("annote", "annotation"); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("archiveprefix", "eprinttype"); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put(FieldName.JOURNAL, FieldName.JOURNALTITLE); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("key", "sortkey"); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("pdf", FieldName.FILE); EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("primaryclass", "eprintclass"); - EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put("school", "institution"); + EntryConverter.FIELD_ALIASES_TEX_TO_LTX.put(FieldName.SCHOOL, FieldName.INSTITUTION); // inverse map EntryConverter.FIELD_ALIASES_LTX_TO_TEX = EntryConverter.FIELD_ALIASES_TEX_TO_LTX.entrySet() diff --git a/src/main/java/net/sf/jabref/model/entry/FieldName.java b/src/main/java/net/sf/jabref/model/entry/FieldName.java index 5de9895789d..0f74b25663f 100644 --- a/src/main/java/net/sf/jabref/model/entry/FieldName.java +++ b/src/main/java/net/sf/jabref/model/entry/FieldName.java @@ -4,28 +4,37 @@ public class FieldName { public static final String ABSTRACT = "abstract"; + public static final String ADDRESS = "address"; public static final String AUTHOR = "author"; + public static final String BOOKTITLE = "booktitle"; public static final String CROSSREF = "crossref"; public static final String DATE = "date"; public static final String DOI = "doi"; + public static final String EDITION = "edition"; public static final String EDITOR = "editor"; public static final String FILE = "file"; public static final String FOLDER = "folder"; + public static final String HOWPUBLISHED = "howpublished"; + public static final String INSTITUTION = "institution"; public static final String ISBN = "isbn"; public static final String ISSN = "issn"; public static final String ISSUE = "issue"; public static final String JOURNAL = "journal"; public static final String JOURNALTITLE = "journaltitle"; public static final String KEYWORDS = "keywords"; + public static final String LANGUAGE = "language"; public static final String MONTH = "month"; + public static final String NOTE = "note"; public static final String NUMBER = "number"; + public static final String ORGANIZATION = "organization"; public static final String PAGES = "pages"; public static final String PUBLISHER = "publisher"; public static final String REVIEW = "review"; + public static final String SCHOOL = "school"; + public static final String SERIES = "series"; public static final String TITLE = "title"; + public static final String TYPE = "type"; public static final String URL = "url"; public static final String VOLUME = "volume"; public static final String YEAR = "year"; - - } diff --git a/src/main/java/net/sf/jabref/model/entry/IEEETranEntryTypes.java b/src/main/java/net/sf/jabref/model/entry/IEEETranEntryTypes.java index fe0816f5b17..ab8e809dabe 100644 --- a/src/main/java/net/sf/jabref/model/entry/IEEETranEntryTypes.java +++ b/src/main/java/net/sf/jabref/model/entry/IEEETranEntryTypes.java @@ -20,8 +20,8 @@ public class IEEETranEntryTypes { public static final EntryType ELECTRONIC = new BibtexEntryType() { { - addAllOptional(FieldName.AUTHOR, FieldName.MONTH, FieldName.YEAR, FieldName.TITLE, "language", "howpublished", "organization", "address", - "note", FieldName.URL); + addAllOptional(FieldName.AUTHOR, FieldName.MONTH, FieldName.YEAR, FieldName.TITLE, FieldName.LANGUAGE, FieldName.HOWPUBLISHED, FieldName.ORGANIZATION, FieldName.ADDRESS, + FieldName.NOTE, FieldName.URL); } @@ -59,7 +59,7 @@ public String getName() { { addAllRequired(FieldName.TITLE, FieldName.YEAR); - addAllOptional(FieldName.EDITOR, "language", "series", FieldName.VOLUME, FieldName.NUMBER, "organization", FieldName.MONTH, "note", FieldName.URL); + addAllOptional(FieldName.EDITOR, FieldName.LANGUAGE, FieldName.SERIES, FieldName.VOLUME, FieldName.NUMBER, FieldName.ORGANIZATION, FieldName.MONTH, FieldName.NOTE, FieldName.URL); } @Override @@ -78,8 +78,8 @@ public String getName() { { addAllRequired("nationality", FieldName.NUMBER, "year/yearfiled"); - addAllOptional(FieldName.AUTHOR, FieldName.TITLE, "language", "assignee", "address", "type", FieldName.NUMBER, "day", "dayfiled", - FieldName.MONTH, "monthfiled", "note", FieldName.URL); + addAllOptional(FieldName.AUTHOR, FieldName.TITLE, FieldName.LANGUAGE, "assignee", FieldName.ADDRESS, FieldName.TYPE, FieldName.NUMBER, "day", "dayfiled", + FieldName.MONTH, "monthfiled", FieldName.NOTE, FieldName.URL); } @Override @@ -98,8 +98,8 @@ public String getName() { { addAllRequired(FieldName.TITLE, "organization/institution"); - addAllOptional(FieldName.AUTHOR, "language", "howpublished", "type", FieldName.NUMBER, "revision", "address", FieldName.MONTH, - FieldName.YEAR, "note", FieldName.URL); + addAllOptional(FieldName.AUTHOR, FieldName.LANGUAGE, FieldName.HOWPUBLISHED, FieldName.TYPE, FieldName.NUMBER, "revision", FieldName.ADDRESS, FieldName.MONTH, + FieldName.YEAR, FieldName.NOTE, FieldName.URL); } @Override diff --git a/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java b/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java index 4f8f4614e07..35cb282cac8 100644 --- a/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java +++ b/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java @@ -88,21 +88,21 @@ private InternalBibtexFields(boolean serializeSpecialFields) { // FIRST: all standard fields // These are the fields that BibTex might want to treat, so these // must conform to BibTex rules. - add(new BibtexSingleField("address", true, BibtexSingleField.SMALL_W)); + add(new BibtexSingleField(FieldName.ADDRESS, true, BibtexSingleField.SMALL_W)); // An annotation. It is not used by the standard bibliography styles, // but may be used by others that produce an annotated bibliography. // http://www.ecst.csuchico.edu/~jacobsd/bib/formats/bibtex.html add(new BibtexSingleField("annote", true, BibtexSingleField.LARGE_W)); add(new BibtexSingleField(FieldName.AUTHOR, true, BibtexSingleField.MEDIUM_W, 280)); - add(new BibtexSingleField("booktitle", true, 175)); + add(new BibtexSingleField(FieldName.BOOKTITLE, true, 175)); add(new BibtexSingleField("chapter", true, BibtexSingleField.SMALL_W)); dummy = new BibtexSingleField(FieldName.CROSSREF, true, BibtexSingleField.SMALL_W); dummy.setExtras(EnumSet.of(FieldProperties.CROSSREF)); add(dummy); - add(new BibtexSingleField("edition", true, BibtexSingleField.SMALL_W)); + add(new BibtexSingleField(FieldName.EDITION, true, BibtexSingleField.SMALL_W)); add(new BibtexSingleField(FieldName.EDITOR, true, BibtexSingleField.MEDIUM_W, 280)); - add(new BibtexSingleField("howpublished", true, BibtexSingleField.MEDIUM_W)); - add(new BibtexSingleField("institution", true, BibtexSingleField.MEDIUM_W)); + add(new BibtexSingleField(FieldName.HOWPUBLISHED, true, BibtexSingleField.MEDIUM_W)); + add(new BibtexSingleField(FieldName.INSTITUTION, true, BibtexSingleField.MEDIUM_W)); dummy = new BibtexSingleField(FieldName.JOURNAL, true, BibtexSingleField.SMALL_W); dummy.setExtras(EnumSet.of(FieldProperties.JOURNAL_NAME)); @@ -115,18 +115,18 @@ private InternalBibtexFields(boolean serializeSpecialFields) { dummy = new BibtexSingleField(FieldName.MONTH, true, BibtexSingleField.SMALL_W); dummy.setExtras(EnumSet.of(FieldProperties.MONTH)); add(dummy); - add(new BibtexSingleField("note", true, BibtexSingleField.MEDIUM_W)); + add(new BibtexSingleField(FieldName.NOTE, true, BibtexSingleField.MEDIUM_W)); add(new BibtexSingleField(FieldName.NUMBER, true, BibtexSingleField.SMALL_W, 60).setNumeric(true)); - add(new BibtexSingleField("organization", true, BibtexSingleField.MEDIUM_W)); + add(new BibtexSingleField(FieldName.ORGANIZATION, true, BibtexSingleField.MEDIUM_W)); add(new BibtexSingleField(FieldName.PAGES, true, BibtexSingleField.SMALL_W)); add(new BibtexSingleField(FieldName.PUBLISHER, true, BibtexSingleField.MEDIUM_W)); add(new BibtexSingleField("school", true, BibtexSingleField.MEDIUM_W)); - add(new BibtexSingleField("series", true, BibtexSingleField.SMALL_W)); + add(new BibtexSingleField(FieldName.SERIES, true, BibtexSingleField.SMALL_W)); add(new BibtexSingleField(FieldName.TITLE, true, 400)); - dummy = new BibtexSingleField("type", true, BibtexSingleField.SMALL_W); + dummy = new BibtexSingleField(FieldName.TYPE, true, BibtexSingleField.SMALL_W); dummy.getExtras().add(FieldProperties.TYPE); add(dummy); - add(new BibtexSingleField("language", true, BibtexSingleField.SMALL_W)); + add(new BibtexSingleField(FieldName.LANGUAGE, true, BibtexSingleField.SMALL_W)); add(new BibtexSingleField(FieldName.VOLUME, true, BibtexSingleField.SMALL_W, 60).setNumeric(true)); add(new BibtexSingleField(FieldName.YEAR, true, BibtexSingleField.SMALL_W, 60).setNumeric(true)); From dd1b246cce1d5ca755545921bdf3a03441403610 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Fri, 22 Jul 2016 01:43:02 +0200 Subject: [PATCH 2/2] Some Medline fixes --- .../importer/fileformat/MedlineImporter.java | 52 +++++++++---------- .../fileformat/MedlinePlainImporter.java | 1 - 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java index 2fec48b8975..92ff94aa859 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/MedlineImporter.java @@ -262,11 +262,11 @@ private void addBookInformation(HashMap fields, Book book) { if (book.getPublisher() != null) { Publisher publisher = book.getPublisher(); putIfValueNotNull(fields, "publocation", publisher.getPublisherLocation()); - putStringFromSerializableList(fields, "publisher", publisher.getPublisherName().getContent()); + putStringFromSerializableList(fields, FieldName.PUBLISHER, publisher.getPublisherName().getContent()); } if (book.getBookTitle() != null) { BookTitle title = book.getBookTitle(); - putStringFromSerializableList(fields, "title", title.getContent()); + putStringFromSerializableList(fields, FieldName.TITLE, title.getContent()); } if (book.getPubDate() != null) { addPubDate(fields, book.getPubDate()); @@ -283,7 +283,7 @@ private void addBookInformation(HashMap fields, Book book) { } } - putIfValueNotNull(fields, "volume", book.getVolume()); + putIfValueNotNull(fields, FieldName.VOLUME, book.getVolume()); putIfValueNotNull(fields, FieldName.EDITION, book.getEdition()); putIfValueNotNull(fields, "medium", book.getMedium()); putIfValueNotNull(fields, "reportnumber", book.getReportNumber()); @@ -294,7 +294,7 @@ private void addBookInformation(HashMap fields, Book book) { } } if (book.getIsbn() != null) { - fields.put("isbn", join(book.getIsbn(), ", ")); + fields.put(FieldName.ISBN, join(book.getIsbn(), ", ")); } } @@ -453,14 +453,14 @@ private void addKeyWords(HashMap fields, List allKe } } //Check whether MeshHeadingList exist or not - if (fields.get("keywords") == null) { - fields.put("keywords", join(keywordStrings, KEYWORD_SEPARATOR)); + if (fields.get(FieldName.KEYWORDS) == null) { + fields.put(FieldName.KEYWORDS, join(keywordStrings, KEYWORD_SEPARATOR)); } else { if (keywordStrings.size() > 0) { //if it exists, combine the MeshHeading with the keywords String result = join(keywordStrings, "; "); - result = fields.get("keywords") + KEYWORD_SEPARATOR + result; - fields.put("keywords", result); + result = fields.get(FieldName.KEYWORDS) + KEYWORD_SEPARATOR + result; + fields.put(FieldName.KEYWORDS, result); } } } @@ -474,7 +474,7 @@ private void addOtherId(HashMap fields, List otherID) { } private void addPersonalNames(HashMap fields, PersonalNameSubjectList personalNameSubjectList) { - if (fields.get("author") == null) { + if (fields.get(FieldName.AUTHOR) == null) { //if no authors appear, then add the personal names as authors List personalNames = new ArrayList<>(); if (personalNameSubjectList.getPersonalNameSubject() != null) { @@ -486,7 +486,7 @@ private void addPersonalNames(HashMap fields, PersonalNameSubjec } personalNames.add(name); } - fields.put("author", join(personalNames, " and ")); + fields.put(FieldName.AUTHOR, join(personalNames, " and ")); } } } @@ -502,7 +502,7 @@ private void addMeashHeading(HashMap fields, MeshHeadingList mes } keywords.add(result); } - fields.put("keywords", join(keywords, KEYWORD_SEPARATOR)); + fields.put(FieldName.KEYWORDS, join(keywords, KEYWORD_SEPARATOR)); } private void addGeneSymbols(HashMap fields, GeneSymbolList geneSymbolList) { @@ -524,19 +524,19 @@ private void addArticleInformation(HashMap fields, List for (Object object : content) { if (object instanceof Journal) { Journal journal = (Journal) object; - putIfValueNotNull(fields, "journal", journal.getTitle()); + putIfValueNotNull(fields, FieldName.JOURNAL, journal.getTitle()); ISSN issn = journal.getISSN(); - putIfValueNotNull(fields, "issn", issn.getContent()); + putIfValueNotNull(fields, FieldName.ISSN, issn.getContent()); JournalIssue journalIssue = journal.getJournalIssue(); - putIfValueNotNull(fields, "volume", journalIssue.getVolume()); - putIfValueNotNull(fields, "issue", journalIssue.getIssue()); + putIfValueNotNull(fields, FieldName.VOLUME, journalIssue.getVolume()); + putIfValueNotNull(fields, FieldName.ISSUE, journalIssue.getIssue()); addPubDate(fields, journalIssue.getPubDate()); } else if (object instanceof ArticleTitle) { ArticleTitle articleTitle = (ArticleTitle) object; - fields.put("title", StringUtil.stripBrackets(articleTitle.getContent().toString())); + fields.put(FieldName.TITLE, StringUtil.stripBrackets(articleTitle.getContent().toString())); } else if (object instanceof Pagination) { Pagination pagination = (Pagination) object; addPagination(fields, pagination); @@ -554,8 +554,8 @@ private void addArticleInformation(HashMap fields, List } private void addElocationID(HashMap fields, ELocationID eLocationID) { - if ("doi".equals(eLocationID.getEIdType())) { - fields.put("doi", eLocationID.getContent()); + if (FieldName.DOI.equals(eLocationID.getEIdType())) { + fields.put(FieldName.DOI, eLocationID.getContent()); } if ("pii".equals(eLocationID.getEIdType())) { fields.put("pii", eLocationID.getContent()); @@ -565,11 +565,11 @@ private void addElocationID(HashMap fields, ELocationID eLocatio private void addPubDate(HashMap fields, PubDate pubDate) { if (pubDate.getYear() == null) { //if year of the pubdate is null, the medlineDate shouldn't be null - fields.put("year", extractYear(pubDate.getMedlineDate())); + fields.put(FieldName.YEAR, extractYear(pubDate.getMedlineDate())); } else { - fields.put("year", pubDate.getYear()); + fields.put(FieldName.YEAR, pubDate.getYear()); if (pubDate.getMonth() != null) { - fields.put("month", pubDate.getMonth()); + fields.put(FieldName.MONTH, pubDate.getMonth()); } else if (pubDate.getSeason() != null) { fields.put("season", pubDate.getSeason()); } @@ -586,7 +586,7 @@ private void addAbstract(HashMap fields, Abstract abs) { } } } - fields.put("abstract", join(abstractText, " ")); + fields.put(FieldName.ABSTRACT, join(abstractText, " ")); } private void addPagination(HashMap fields, Pagination pagination) { @@ -594,15 +594,15 @@ private void addPagination(HashMap fields, Pagination pagination String endPage = ""; for (JAXBElement element : pagination.getContent()) { if ("MedlinePgn".equals(element.getName().getLocalPart())) { - putIfValueNotNull(fields, "pages", fixPageRange(element.getValue())); + putIfValueNotNull(fields, FieldName.PAGES, fixPageRange(element.getValue())); } else if ("StartPage".equals(element.getName().getLocalPart())) { //it could happen, that the article has only a start page startPage = element.getValue() + endPage; - putIfValueNotNull(fields, "pages", startPage); + putIfValueNotNull(fields, FieldName.PAGES, startPage); } else if ("EndPage".equals(element.getName().getLocalPart())) { endPage = element.getValue(); //but it should not happen, that a endpage appears without startpage - fields.put("pages", fixPageRange(startPage + "-" + endPage)); + fields.put(FieldName.PAGES, fixPageRange(startPage + "-" + endPage)); } } } @@ -630,7 +630,7 @@ private void handleAuthors(HashMap fields, AuthorList authors) { authorNames.add(authorName); } } - fields.put("author", join(authorNames, " and ")); + fields.put(FieldName.AUTHOR, join(authorNames, " and ")); } private static String join(List list, String string) { diff --git a/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java index 70fbcd4ca4a..8ba449009ac 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/MedlinePlainImporter.java @@ -162,7 +162,6 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { hashMap.put("PST", "publication-status"); hashMap.put("VI", FieldName.VOLUME); hashMap.put("LA", FieldName.LANGUAGE); - hashMap.put("LA", FieldName.LANGUAGE); hashMap.put("PUBM", "model"); hashMap.put("RN", "registry-number"); hashMap.put("NM", "substance-name");