From aff620af0641f765e95326647981c5700ecc9037 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 4 Apr 2018 11:04:27 +0200 Subject: [PATCH] implement journal abbrev formatter --- .../JournalMedlineAbbreviator.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main/java/org/jabref/logic/formatter/bibtexfields/JournalMedlineAbbreviator.java diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/JournalMedlineAbbreviator.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/JournalMedlineAbbreviator.java new file mode 100644 index 00000000000..4b386145fa2 --- /dev/null +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/JournalMedlineAbbreviator.java @@ -0,0 +1,54 @@ +package org.jabref.logic.formatter.bibtexfields; + +import java.util.Objects; + +import org.jabref.logic.journals.JournalAbbreviationLoader; +import org.jabref.logic.journals.JournalAbbreviationPreferences; +import org.jabref.model.cleanup.Formatter; + +public class JournalMedlineAbbreviator implements Formatter { + + //TODO: How do I pass the prefs at best? + public JournalMedlineAbbreviator(JournalAbbreviationLoader repostioryLoader, + JournalAbbreviationPreferences journalAbbreviationPreferences) { + this.repostioryLoader = Objects.requireNonNull(repostioryLoader); + this.journalAbbreviationPreferences = Objects.requireNonNull(journalAbbreviationPreferences); + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getKey() { + // TODO Auto-generated method stub + return null; + } + + private final JournalAbbreviationLoader repostioryLoader; + private final JournalAbbreviationPreferences journalAbbreviationPreferences; + + + + @Override + public String format(String fieldText) { + return repostioryLoader.getRepository(journalAbbreviationPreferences) + .getIsoAbbreviation(fieldText) + .orElse(fieldText); + } + + @Override + public String getDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getExampleInput() { + // TODO Auto-generated method stub + return null; + } + +}