diff --git a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java index c8c1cae125e..f6355797436 100644 --- a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java +++ b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java @@ -13,7 +13,7 @@ import org.jabref.gui.commonfxcontrols.FieldFormatterCleanupsPanel; import org.jabref.logic.FilePreferences; import org.jabref.logic.cleanup.CleanupPreferences; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.l10n.Localization; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.field.FieldTextMapper; @@ -168,7 +168,7 @@ public CleanupPreferences getCleanupPreset() { activeJobs.add(CleanupPreferences.CleanupStep.FIX_FILE_LINKS); - return new CleanupPreferences(activeJobs, new FieldFormatterCleanups( + return new CleanupPreferences(activeJobs, new FieldFormatterCleanupActions( !formatterCleanupsPanel.cleanupsDisableProperty().getValue(), formatterCleanupsPanel.cleanupsProperty())); } diff --git a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java index fa0ba437aa1..085bc05e45a 100644 --- a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java +++ b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java @@ -19,7 +19,7 @@ import org.jabref.gui.util.ValueTableCellFactory; import org.jabref.gui.util.ViewModelListCellFactory; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldTextMapper; diff --git a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java index 765561a50e7..441f03c79f0 100644 --- a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java @@ -15,8 +15,8 @@ import org.jabref.gui.StateManager; import org.jabref.gui.util.NoSelectionModel; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; @@ -41,9 +41,9 @@ public FieldFormatterCleanupsPanelViewModel(StateManager stateManager) { public void resetToRecommended() { stateManager.getActiveDatabase().ifPresent(databaseContext -> { if (databaseContext.isBiblatexMode()) { - cleanupsListProperty.setAll(FieldFormatterCleanups.RECOMMEND_BIBLATEX_ACTIONS); + cleanupsListProperty.setAll(FieldFormatterCleanupActions.RECOMMEND_BIBLATEX_ACTIONS); } else { - cleanupsListProperty.setAll(FieldFormatterCleanups.RECOMMEND_BIBTEX_ACTIONS); + cleanupsListProperty.setAll(FieldFormatterCleanupActions.RECOMMEND_BIBTEX_ACTIONS); } }); } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/DefaultMenu.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/DefaultMenu.java index ba5784034dc..c03164c955a 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/DefaultMenu.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/DefaultMenu.java @@ -8,7 +8,7 @@ import javafx.scene.control.SeparatorMenuItem; import javafx.scene.control.TextInputControl; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringUtil; diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java index 8f9cbf611f8..0c8fa3731d2 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java @@ -12,7 +12,7 @@ import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.icon.IconTheme; import org.jabref.gui.icon.JabRefIcon; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import org.jabref.logic.formatter.casechanger.UnprotectTermsFormatter; import org.jabref.logic.l10n.Localization; diff --git a/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java b/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java index 489fd81644c..bdc23497d9f 100644 --- a/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java @@ -15,7 +15,7 @@ import org.jabref.gui.libraryproperties.PropertiesTabViewModel; import org.jabref.logic.cleanup.CleanupPreferences; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.preferences.CliPreferences; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.field.Field; @@ -92,7 +92,7 @@ public void setValues() { // FieldFormatterCleanupsPanel, included via in FXML - Optional saveActions = initialMetaData.getSaveActions(); + Optional saveActions = initialMetaData.getSaveActions(); saveActions.ifPresentOrElse(value -> { cleanupsDisableProperty.setValue(!value.isEnabled()); cleanupsProperty.setValue(FXCollections.observableArrayList(value.getConfiguredActions())); @@ -113,18 +113,18 @@ public void storeSettings() { newMetaData.markAsNotProtected(); } - FieldFormatterCleanups fieldFormatterCleanups = new FieldFormatterCleanups( + FieldFormatterCleanupActions fieldFormatterCleanupActions = new FieldFormatterCleanupActions( !cleanupsDisableProperty().getValue(), cleanupsProperty()); - if (FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS.equals(fieldFormatterCleanups.getConfiguredActions())) { + if (FieldFormatterCleanupActions.DEFAULT_SAVE_ACTIONS.equals(fieldFormatterCleanupActions.getConfiguredActions())) { newMetaData.clearSaveActions(); } else { // if all actions have been removed, remove the save actions from the MetaData - if (fieldFormatterCleanups.getConfiguredActions().isEmpty()) { + if (fieldFormatterCleanupActions.getConfiguredActions().isEmpty()) { newMetaData.clearSaveActions(); } else { - newMetaData.setSaveActions(fieldFormatterCleanups); + newMetaData.setSaveActions(fieldFormatterCleanupActions); } } diff --git a/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 0ac6101a80d..f2b6de9fabb 100644 --- a/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -21,7 +21,7 @@ import org.jabref.gui.preferences.JabRefGuiPreferences; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.CleanupPreferences; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.l10n.Localization; import org.jabref.logic.os.OS; import org.jabref.logic.preferences.JabRefCliPreferences; @@ -531,9 +531,9 @@ private static void upgradeCleanups(JabRefCliPreferences prefs) { List formatterCleanups = List.of(StringUtil.unifyLineBreaks(prefs.get(V5_8_CLEANUP_FIELD_FORMATTERS), "\n") .split("\n")); if (formatterCleanups.size() >= 2 - && (FieldFormatterCleanups.ENABLED.equals(formatterCleanups.getFirst()) - || FieldFormatterCleanups.DISABLED.equals(formatterCleanups.getFirst()))) { - prefs.putBoolean(V6_0_CLEANUP_FIELD_FORMATTERS_ENABLED, FieldFormatterCleanups.ENABLED.equals(formatterCleanups.getFirst()) + && (FieldFormatterCleanupActions.ENABLED.equals(formatterCleanups.getFirst()) + || FieldFormatterCleanupActions.DISABLED.equals(formatterCleanups.getFirst()))) { + prefs.putBoolean(V6_0_CLEANUP_FIELD_FORMATTERS_ENABLED, FieldFormatterCleanupActions.ENABLED.equals(formatterCleanups.getFirst()) ? Boolean.TRUE : Boolean.FALSE); diff --git a/jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java b/jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java index cb46802d7f2..46c8569c640 100644 --- a/jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java +++ b/jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java @@ -18,7 +18,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.formatter.bibtexfields.RemoveEnclosingBracesFormatter; import org.jabref.logic.formatter.casechanger.Word; diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java b/jablib/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java index 61a04b9c455..014c13a7022 100644 --- a/jablib/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java +++ b/jablib/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java @@ -12,21 +12,21 @@ public class CleanupPreferences { private final ObservableSet activeJobs; - private final ObjectProperty fieldFormatterCleanups; + private final ObjectProperty fieldFormatterCleanups; public CleanupPreferences(EnumSet activeJobs) { - this(activeJobs, new FieldFormatterCleanups(false, new ArrayList<>())); + this(activeJobs, new FieldFormatterCleanupActions(false, new ArrayList<>())); } public CleanupPreferences(CleanupStep activeJob) { this(EnumSet.of(activeJob)); } - public CleanupPreferences(FieldFormatterCleanups formatterCleanups) { + public CleanupPreferences(FieldFormatterCleanupActions formatterCleanups) { this(EnumSet.noneOf(CleanupStep.class), formatterCleanups); } - public CleanupPreferences(EnumSet activeJobs, FieldFormatterCleanups formatterCleanups) { + public CleanupPreferences(EnumSet activeJobs, FieldFormatterCleanupActions formatterCleanups) { this.activeJobs = FXCollections.observableSet(activeJobs); this.fieldFormatterCleanups = new SimpleObjectProperty<>(formatterCleanups); } @@ -60,15 +60,15 @@ public Boolean isActive(CleanupStep step) { return activeJobs.contains(step); } - public FieldFormatterCleanups getFieldFormatterCleanups() { + public FieldFormatterCleanupActions getFieldFormatterCleanups() { return fieldFormatterCleanups.get(); } - public ObjectProperty fieldFormatterCleanupsProperty() { + public ObjectProperty fieldFormatterCleanupsProperty() { return fieldFormatterCleanups; } - public void setFieldFormatterCleanups(FieldFormatterCleanups fieldFormatters) { + public void setFieldFormatterCleanups(FieldFormatterCleanupActions fieldFormatters) { fieldFormatterCleanups.setValue(fieldFormatters); } diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java index 3528cdc5df9..855b318d473 100644 --- a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java +++ b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java @@ -6,6 +6,7 @@ import java.util.Objects; import java.util.Set; +import org.jabref.logic.formatter.Formatter; import org.jabref.model.FieldChange; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.event.EntriesEventSource; diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupActions.java similarity index 67% rename from jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java rename to jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupActions.java index b5eb9811f41..dbd17291721 100644 --- a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java +++ b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupActions.java @@ -1,16 +1,11 @@ package org.jabref.logic.cleanup; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import java.util.Objects; -import java.util.StringJoiner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.formatter.IdentityFormatter; import org.jabref.logic.formatter.bibtexfields.ConvertMSCCodesFormatter; @@ -24,11 +19,8 @@ import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; import org.jabref.logic.layout.format.LatexToUnicodeFormatter; import org.jabref.logic.layout.format.ReplaceUnicodeLigaturesFormatter; -import org.jabref.logic.util.strings.StringUtil; import org.jabref.model.FieldChange; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.field.Field; -import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; @@ -36,7 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class FieldFormatterCleanups { +public class FieldFormatterCleanupActions { public static final List DEFAULT_SAVE_ACTIONS; public static final List RECOMMEND_BIBTEX_ACTIONS; @@ -45,7 +37,7 @@ public class FieldFormatterCleanups { public static final String ENABLED = "enabled"; public static final String DISABLED = "disabled"; - private static final Logger LOGGER = LoggerFactory.getLogger(FieldFormatterCleanups.class); + private static final Logger LOGGER = LoggerFactory.getLogger(FieldFormatterCleanupActions.class); /** * This parses the key/list map of fields and clean up actions for the field. @@ -58,7 +50,6 @@ public class FieldFormatterCleanups { *

* Example: pages[normalize_page_numbers]title[escapeAmpersands,escapeDollarSign,escapeUnderscores,latex_cleanup] */ - private static final Pattern FIELD_FORMATTER_CLEANUP_PATTERN = Pattern.compile("([^\\[]+)\\[([^]]+)]"); static { DEFAULT_SAVE_ACTIONS = List.of( @@ -87,41 +78,16 @@ public class FieldFormatterCleanups { private final boolean enabled; private final List actions; - public FieldFormatterCleanups(boolean enabled, @NonNull List actions) { + public FieldFormatterCleanupActions(boolean enabled, @NonNull List actions) { this.enabled = enabled; this.actions = actions; } /** - * Note: String parsing is done at {@link FieldFormatterCleanups#parse(String)} + * Note: String parsing is done at {@link FieldFormatterCleanupActions#parse(String)} */ public static String getMetaDataString(List actionList, String newLineSeparator) { - // First, group all formatters by the field for which they apply - // Order of the list should be kept - Map> groupedByField = new LinkedHashMap<>(); - for (FieldFormatterCleanup cleanup : actionList) { - Field key = cleanup.getField(); - // add new list into the hashmap if needed - groupedByField.computeIfAbsent(key, k -> new ArrayList<>()); - - // add the formatter to the map if it is not already there - List formattersForKey = groupedByField.get(key); - if (!formattersForKey.contains(cleanup.getFormatter().getKey())) { - formattersForKey.add(cleanup.getFormatter().getKey()); - } - } - - // convert the contents of the hashmap into the correct serialization - StringBuilder result = new StringBuilder(); - for (Map.Entry> entry : groupedByField.entrySet()) { - result.append(entry.getKey().getName()); - - StringJoiner joiner = new StringJoiner(",", "[", "]" + newLineSeparator); - entry.getValue().forEach(joiner::add); - result.append(joiner); - } - - return result.toString(); + return FieldFormatterCleanupParser.serializeActions(actionList, newLineSeparator); } public boolean isEnabled() { @@ -151,30 +117,7 @@ private List applyAllActions(BibEntry entry) { } public static List parse(String formatterString) { - if ((formatterString == null) || formatterString.isEmpty()) { - // no save actions defined in the meta data - return List.of(); - } - - List result = new ArrayList<>(); - - // first remove all newlines for easier parsing - String formatterStringWithoutLineBreaks = StringUtil.unifyLineBreaks(formatterString, ""); - - Matcher matcher = FIELD_FORMATTER_CLEANUP_PATTERN.matcher(formatterStringWithoutLineBreaks); - while (matcher.find()) { - String fieldKey = matcher.group(1); - Field field = FieldFactory.parseField(fieldKey); - - String fieldString = matcher.group(2); - - List fieldFormatterCleanups = Arrays.stream(fieldString.split(",")) - .map(FieldFormatterCleanups::getFormatterFromString) - .map(formatter -> new FieldFormatterCleanup(field, formatter)) - .toList(); - result.addAll(fieldFormatterCleanups); - } - return result; + return FieldFormatterCleanupParser.parseAction(formatterString); } static Formatter getFormatterFromString(String formatterName) { @@ -200,7 +143,7 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (obj instanceof FieldFormatterCleanups other) { + if (obj instanceof FieldFormatterCleanupActions other) { return Objects.equals(actions, other.actions) && (enabled == other.enabled); } return false; @@ -208,7 +151,7 @@ public boolean equals(Object obj) { @Override public String toString() { - return "FieldFormatterCleanups{" + + return "FieldFormatterCleanupActions{" + "enabled=" + enabled + "," + "actions=" + actions + "}"; diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupParser.java b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupParser.java new file mode 100644 index 00000000000..ce6b0aa6141 --- /dev/null +++ b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanupParser.java @@ -0,0 +1,71 @@ +package org.jabref.logic.cleanup; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringJoiner; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.jabref.logic.util.strings.StringUtil; +import org.jabref.model.entry.field.Field; +import org.jabref.model.entry.field.FieldFactory; + +class FieldFormatterCleanupParser { + private static final Pattern FIELD_FORMATTER_CLEANUP_PATTERN = Pattern.compile("([^\\[]+)\\[([^]]+)]"); + + private FieldFormatterCleanupParser() { + } + + static List parseAction(String formatterString) { + if ((formatterString == null) || formatterString.isEmpty()) { + // no save actions defined in the metadata + return List.of(); + } + + List result = new ArrayList<>(); + + // first remove all newlines for easier parsing + String formatterStringWithoutLineBreaks = StringUtil.unifyLineBreaks(formatterString, ""); + + Matcher matcher = FIELD_FORMATTER_CLEANUP_PATTERN.matcher(formatterStringWithoutLineBreaks); + while (matcher.find()) { + String fieldKey = matcher.group(1); + Field field = FieldFactory.parseField(fieldKey); + + String fieldString = matcher.group(2); + + List fieldFormatterCleanups = Arrays + .stream(fieldString.split(",")) + .map(FieldFormatterCleanupActions::getFormatterFromString) + .map(formatter -> new FieldFormatterCleanup(field, formatter)) + .toList(); + result.addAll(fieldFormatterCleanups); + } + return result; + } + + static String serializeActions(List actionList, String newLineSeparator) { + // First, group all formatters by the field for which they apply + // Order of the list should be kept + Map> groupedByField = new LinkedHashMap<>(); + for (FieldFormatterCleanup cleanup : actionList) { + // add the formatter to map if not already in there, order sensitive + groupedByField.computeIfAbsent(cleanup.getField(), _ -> new LinkedHashSet<>()) + .add(cleanup.getFormatter().getKey()); + } + + // convert the contents of the hashmap into the correct serialization + StringBuilder result = new StringBuilder(); + for (Map.Entry> entry : groupedByField.entrySet()) { + StringJoiner joiner = new StringJoiner(",", "[", "]" + newLineSeparator); + entry.getValue().forEach(joiner::add); + result.append(entry.getKey().getName()).append(joiner); + } + return result.toString(); + } +} diff --git a/jablib/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java b/jablib/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java index 61449bb5562..4f9a880aa74 100644 --- a/jablib/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java +++ b/jablib/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java @@ -29,7 +29,7 @@ import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.cleanup.NormalizeWhitespacesCleanup; import org.jabref.logic.formatter.bibtexfields.TrimWhitespaceFormatter; import org.jabref.logic.preferences.CliPreferences; @@ -106,7 +106,7 @@ public BibDatabaseWriter(@NonNull Writer writer, private static List applySaveActions(List toChange, MetaData metaData, FieldPreferences fieldPreferences) { List changes = new ArrayList<>(); - Optional saveActions = metaData.getSaveActions(); + Optional saveActions = metaData.getSaveActions(); saveActions.ifPresent(actions -> { // save actions defined -> apply for every entry for (BibEntry entry : toChange) { diff --git a/jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java b/jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java index 6615cf6f2e2..8fc33f61098 100644 --- a/jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java +++ b/jablib/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java @@ -10,7 +10,7 @@ import org.jabref.logic.citationkeypattern.AbstractCitationKeyPatterns; import org.jabref.logic.citationkeypattern.CitationKeyPattern; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.os.OS; import org.jabref.logic.util.strings.StringUtil; import org.jabref.model.entry.BibEntryType; @@ -113,8 +113,8 @@ private static Map serializeMetaData(Map> s string += StringUtil.quote(dataItem, MetaData.SEPARATOR_STRING, MetaData.ESCAPE_CHARACTER); // in case of save actions, add an additional newline after the enabled flag lastWasSaveActionsEnablement = isSaveActions - && (FieldFormatterCleanups.ENABLED.equals(dataItem) - || FieldFormatterCleanups.DISABLED.equals(dataItem)); + && (FieldFormatterCleanupActions.ENABLED.equals(dataItem) + || FieldFormatterCleanupActions.DISABLED.equals(dataItem)); joiner.add(string); } String serializedItem = joiner.toString(); @@ -171,17 +171,17 @@ public static String serializeCustomEntryTypes(BibEntryType entryType) { "]"; } - public static List getAsStringList(FieldFormatterCleanups fieldFormatterCleanups, String delimiter) { + public static List getAsStringList(FieldFormatterCleanupActions fieldFormatterCleanupActions, String delimiter) { List stringRepresentation = new ArrayList<>(); - if (fieldFormatterCleanups.isEnabled()) { - stringRepresentation.add(FieldFormatterCleanups.ENABLED); + if (fieldFormatterCleanupActions.isEnabled()) { + stringRepresentation.add(FieldFormatterCleanupActions.ENABLED); } else { - stringRepresentation.add(FieldFormatterCleanups.DISABLED); + stringRepresentation.add(FieldFormatterCleanupActions.DISABLED); } - String formatterString = FieldFormatterCleanups.getMetaDataString( - fieldFormatterCleanups.getConfiguredActions(), delimiter); + String formatterString = FieldFormatterCleanupActions.getMetaDataString( + fieldFormatterCleanupActions.getConfiguredActions(), delimiter); stringRepresentation.add(formatterString); return stringRepresentation; } diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/Formatter.java b/jablib/src/main/java/org/jabref/logic/formatter/Formatter.java similarity index 98% rename from jablib/src/main/java/org/jabref/logic/cleanup/Formatter.java rename to jablib/src/main/java/org/jabref/logic/formatter/Formatter.java index 116708296c8..21b2a8d9173 100644 --- a/jablib/src/main/java/org/jabref/logic/cleanup/Formatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/Formatter.java @@ -1,4 +1,4 @@ -package org.jabref.logic.cleanup; +package org.jabref.logic.formatter; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java b/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java index 4920039cdc7..4c47ebe0901 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java @@ -8,7 +8,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.bibtexfields.CleanupUrlFormatter; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.ConvertMSCCodesFormatter; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java index 50e81406e19..3d970e79d50 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java @@ -1,6 +1,5 @@ package org.jabref.logic.formatter; -import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java index 23c14cc2094..2c2e48c7c93 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java index 46f3a250710..e8b4699dcc5 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java @@ -7,7 +7,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java index e0a1c36de0b..96f0c4ddb24 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ConvertMSCCodesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ConvertMSCCodesFormatter.java index 1d765e5d371..d8c9d434dec 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ConvertMSCCodesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ConvertMSCCodesFormatter.java @@ -5,7 +5,7 @@ import java.util.Iterator; import java.util.List; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.preferences.JabRefCliPreferences; @@ -64,7 +64,7 @@ public String format(@NonNull String text) { } // Using Injector to avoid widespread refactoring for constructor injection. - // Class that calls formatters (FieldFormatterCleanups.java) has many usages that would need updates. + // Class that calls formatters (FieldFormatterCleanupActions.java) has many usages that would need updates. JabRefCliPreferences cliPreferences = Injector.instantiateModelOrService(JabRefCliPreferences.class); // get preferences for BibEntry diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java index 2b2a6562914..11f41d2bb56 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeDollarSignFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeDollarSignFormatter.java index 1d1ff7a961a..2775ab4d153 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeDollarSignFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeDollarSignFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Matcher; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java index 9b9abec6cba..c91386ec840 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java index bc4dcfac4dd..175b0b116e1 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java @@ -4,7 +4,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.HTMLUnicodeConversionMaps; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java index b77487b149c..12135931384 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java @@ -3,7 +3,7 @@ import java.util.regex.Pattern; import org.jabref.architecture.AllowedToUseApacheCommonsLang3; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java index 71dcbcdfa04..679bf06b129 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java index 5efb2e74bd5..920a16bf744 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java @@ -2,7 +2,7 @@ import java.util.Optional; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.Date; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java index 54eafae254b..d6189d9a9f9 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java index 6c8e82f757d..f8269b90c5d 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.identifier.ISSN; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java index 1f5c1abea8b..47a95bedfda 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java @@ -2,7 +2,7 @@ import java.util.Optional; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.Month; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java index dc1c1f041f5..66435fb4629 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.AuthorList; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java index 163363a2fbc..3180c543464 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java @@ -3,7 +3,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.casechanger.UnprotectTermsFormatter; import org.jabref.logic.l10n.Localization; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeUnicodeFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeUnicodeFormatter.java index 9dca5d7995f..7141867f332 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeUnicodeFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeUnicodeFormatter.java @@ -2,7 +2,7 @@ import java.text.Normalizer; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeWhitespaceFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeWhitespaceFormatter.java index c9215e2b36b..d20733343de 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeWhitespaceFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeWhitespaceFormatter.java @@ -3,6 +3,7 @@ import java.util.regex.Pattern; import org.jabref.logic.bibtex.FieldPreferences; +import org.jabref.logic.formatter.Formatter; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; @@ -12,7 +13,7 @@ * Replaces two subsequent whitespaces (and tabs) to one space in case of single-line fields. In case of multine fields, * the field content is kept as is. *

- * Due to the distinction between single line and multiline fields, this formatter does not implement the interface {@link org.jabref.logic.cleanup.Formatter}. + * Due to the distinction between single line and multiline fields, this formatter does not implement the interface {@link Formatter}. */ public class NormalizeWhitespaceFormatter { diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java index 37cb68cc671..2044861bb41 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java @@ -3,7 +3,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java index 1aa7131e004..652ed23f98c 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java @@ -6,7 +6,7 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java index de17362fc27..97a57817655 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveEnclosingBracesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveEnclosingBracesFormatter.java index 31b071aac12..07e0700be79 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveEnclosingBracesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveEnclosingBracesFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NullMarked; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java index 89f89cb2ef0..b4f035b0b35 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java index fb5e0a259a6..97e79c05a3a 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java index ade885787b6..9fbd714c47c 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveWordEnclosingAndOuterEnclosingBracesFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveWordEnclosingAndOuterEnclosingBracesFormatter.java index b655fdc96c7..49a5651b52e 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveWordEnclosingAndOuterEnclosingBracesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveWordEnclosingAndOuterEnclosingBracesFormatter.java @@ -2,7 +2,7 @@ import java.util.StringJoiner; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringUtil; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java index f7aa741f001..3dd37676bde 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java @@ -2,7 +2,7 @@ import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java index cb128143b6b..1c0ea08b912 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java @@ -3,7 +3,7 @@ import java.util.function.Predicate; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.importer.util.ShortDOIService; import org.jabref.logic.importer.util.ShortDOIServiceException; import org.jabref.logic.l10n.Localization; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java index 22a2a799aa9..73e9d2d0764 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.bibtexfields; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java index e8c0b3385b8..50a29439097 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java @@ -2,7 +2,7 @@ import java.util.Map; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.HTMLUnicodeConversionMaps; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java index 11d01d31797..2a7cf56a1c7 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java @@ -4,7 +4,7 @@ import java.util.Arrays; import java.util.List; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringLengthComparator; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelFormatter.java index 28fede0de30..ec6a1f2455d 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelFormatter.java @@ -2,7 +2,7 @@ import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelNFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelNFormatter.java index 7778842aeee..e154b114483 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelNFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CamelNFormatter.java @@ -2,7 +2,7 @@ import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java index 0e7894ada38..463eb8d462f 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.casechanger; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java index cbe52c077ff..feec1d01ead 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.casechanger; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java index 27c51fd4d95..e369238641b 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java @@ -2,7 +2,7 @@ import java.util.List; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.protectedterms.ProtectedTermsLoader; import org.jabref.logic.util.strings.StringLengthComparator; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java index 439581e3220..fa501572086 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java @@ -2,7 +2,7 @@ import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringUtil; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ShortTitleFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ShortTitleFormatter.java index 62b482a7ad1..8d070ff9579 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ShortTitleFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/ShortTitleFormatter.java @@ -3,7 +3,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java index ce599cf8281..a7c58a925f8 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java @@ -2,7 +2,7 @@ import java.util.stream.Collectors; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringUtil; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatter.java index cd953c43eea..3e7284e293b 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.casechanger; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java index 9699d68c1a8..b704f6f656d 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.casechanger; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/VeryShortTitleFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/VeryShortTitleFormatter.java index 86c0b9f588f..30d3e80e265 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/casechanger/VeryShortTitleFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/casechanger/VeryShortTitleFormatter.java @@ -3,7 +3,7 @@ import java.util.Optional; import java.util.function.Predicate; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java index 20aeae81f17..c0e1aeac4bd 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.minifier; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java b/jablib/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java index 1d9f90a2707..7280865bad8 100644 --- a/jablib/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.formatter.minifier; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/importer/ParserFetcher.java b/jablib/src/main/java/org/jabref/logic/importer/ParserFetcher.java index 847eea92e20..4bf81bfaaf1 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/ParserFetcher.java +++ b/jablib/src/main/java/org/jabref/logic/importer/ParserFetcher.java @@ -1,6 +1,6 @@ package org.jabref.logic.importer; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.model.entry.BibEntry; public interface ParserFetcher { diff --git a/jablib/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java b/jablib/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java index d7efde03c6c..ad0890ddb98 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java +++ b/jablib/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java @@ -8,7 +8,7 @@ import org.jabref.logic.cleanup.DoiCleanup; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.help.HelpFile; import org.jabref.logic.importer.ImportFormatPreferences; @@ -63,7 +63,7 @@ public void doPostCleanup(BibEntry entry) { DoiCleanup doiCleaner = new DoiCleanup(); doiCleaner.cleanup(entry); - FieldFormatterCleanups cleanups = new FieldFormatterCleanups(true, + FieldFormatterCleanupActions cleanups = new FieldFormatterCleanupActions(true, List.of( new FieldFormatterCleanup(StandardField.TIMESTAMP, new ClearFormatter()), // unescape the contents of the URL field, e.g., some\_url\_part becomes some_url_part diff --git a/jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java b/jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java index 87d796d0153..97feccf759b 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java +++ b/jablib/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java @@ -14,7 +14,7 @@ import org.jabref.logic.citationkeypattern.CitationKeyPattern; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; @@ -255,15 +255,15 @@ private static Optional getNextUnit(Reader reader) throws IOException { return Optional.empty(); } - public static FieldFormatterCleanups fieldFormatterCleanupsParse(List formatterMetaList) { + public static FieldFormatterCleanupActions fieldFormatterCleanupsParse(List formatterMetaList) { if ((formatterMetaList != null) && (formatterMetaList.size() >= 2)) { - boolean enablementStatus = FieldFormatterCleanups.ENABLED.equals(formatterMetaList.getFirst()); + boolean enablementStatus = FieldFormatterCleanupActions.ENABLED.equals(formatterMetaList.getFirst()); String formatterString = formatterMetaList.get(1); - return new FieldFormatterCleanups(enablementStatus, FieldFormatterCleanups.parse(formatterString)); + return new FieldFormatterCleanupActions(enablementStatus, FieldFormatterCleanupActions.parse(formatterString)); } else { // return default actions - return new FieldFormatterCleanups(false, DEFAULT_SAVE_ACTIONS); + return new FieldFormatterCleanupActions(false, DEFAULT_SAVE_ACTIONS); } } diff --git a/jablib/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java b/jablib/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java index 4a0b84baa13..b53b352bef3 100644 --- a/jablib/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.layout; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jspecify.annotations.NonNull; diff --git a/jablib/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java b/jablib/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java index a8c09453fe8..5b7690bf428 100644 --- a/jablib/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java @@ -1,6 +1,6 @@ package org.jabref.logic.layout.format; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.model.strings.LatexToUnicodeAdapter; diff --git a/jablib/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java b/jablib/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java index 7a82fc45110..89ea5535887 100644 --- a/jablib/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java +++ b/jablib/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java @@ -4,7 +4,7 @@ import java.util.Map; import java.util.regex.Pattern; -import org.jabref.logic.cleanup.Formatter; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.UnicodeLigaturesMap; diff --git a/jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java b/jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java index ef8119baced..ea996565852 100644 --- a/jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java +++ b/jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java @@ -44,7 +44,7 @@ import org.jabref.logic.citationstyle.CSLStyleLoader; import org.jabref.logic.citationstyle.CSLStyleUtils; import org.jabref.logic.cleanup.CleanupPreferences; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.exporter.BibDatabaseWriter; import org.jabref.logic.exporter.ExportPreferences; import org.jabref.logic.exporter.MetaDataSerializer; @@ -696,7 +696,7 @@ public JabRefCliPreferences() { defaults.put(ASK_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE); defaults.put(CLEANUP_JOBS, convertListToString(getDefaultCleanupJobs().stream().map(Enum::name).toList())); defaults.put(CLEANUP_FIELD_FORMATTERS_ENABLED, Boolean.FALSE); - defaults.put(CLEANUP_FIELD_FORMATTERS, FieldFormatterCleanups.getMetaDataString(FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS, OS.NEWLINE)); + defaults.put(CLEANUP_FIELD_FORMATTERS, FieldFormatterCleanupActions.getMetaDataString(FieldFormatterCleanupActions.DEFAULT_SAVE_ACTIONS, OS.NEWLINE)); defaults.put(AUTO_RENAME_FILES_ON_CHANGE, false); // use citation key appended with filename as default pattern @@ -1914,8 +1914,8 @@ public CleanupPreferences getCleanupPreferences() { EnumSet.copyOf(getStringList(CLEANUP_JOBS).stream() .map(CleanupPreferences.CleanupStep::valueOf) .collect(Collectors.toSet())), - new FieldFormatterCleanups(getBoolean(CLEANUP_FIELD_FORMATTERS_ENABLED), - FieldFormatterCleanups.parse(StringUtil.unifyLineBreaks(get(CLEANUP_FIELD_FORMATTERS), "")) + new FieldFormatterCleanupActions(getBoolean(CLEANUP_FIELD_FORMATTERS_ENABLED), + FieldFormatterCleanupActions.parse(StringUtil.unifyLineBreaks(get(CLEANUP_FIELD_FORMATTERS), "")) )); cleanupPreferences.getObservableActiveJobs().addListener((SetChangeListener) _ -> @@ -1923,7 +1923,7 @@ public CleanupPreferences getCleanupPreferences() { EasyBind.listen(cleanupPreferences.fieldFormatterCleanupsProperty(), (_, _, newValue) -> { putBoolean(CLEANUP_FIELD_FORMATTERS_ENABLED, newValue.isEnabled()); - put(CLEANUP_FIELD_FORMATTERS, FieldFormatterCleanups.getMetaDataString(newValue.getConfiguredActions(), OS.NEWLINE)); + put(CLEANUP_FIELD_FORMATTERS, FieldFormatterCleanupActions.getMetaDataString(newValue.getConfiguredActions(), OS.NEWLINE)); }); return cleanupPreferences; @@ -1933,9 +1933,9 @@ public CleanupPreferences getCleanupPreferences() { public CleanupPreferences getDefaultCleanupPreset() { return new CleanupPreferences( getDefaultCleanupJobs(), - new FieldFormatterCleanups( + new FieldFormatterCleanupActions( (Boolean) defaults.get(CLEANUP_FIELD_FORMATTERS_ENABLED), - FieldFormatterCleanups.parse((String) defaults.get(CLEANUP_FIELD_FORMATTERS)) + FieldFormatterCleanupActions.parse((String) defaults.get(CLEANUP_FIELD_FORMATTERS)) )); } diff --git a/jablib/src/main/java/org/jabref/model/metadata/MetaData.java b/jablib/src/main/java/org/jabref/model/metadata/MetaData.java index 28e494100c1..5d8bfac1a2e 100644 --- a/jablib/src/main/java/org/jabref/model/metadata/MetaData.java +++ b/jablib/src/main/java/org/jabref/model/metadata/MetaData.java @@ -18,7 +18,7 @@ import org.jabref.logic.citationkeypattern.CitationKeyPattern; import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPatterns; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.util.Version; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.database.event.ChangePropagation; @@ -73,7 +73,7 @@ public class MetaData { private Charset encoding; private SaveOrder saveOrder; private String defaultCiteKeyPattern; - private FieldFormatterCleanups saveActions; + private FieldFormatterCleanupActions saveActions; private BibDatabaseMode mode; private boolean isProtected; private String librarySpecificFileDirectory; @@ -170,11 +170,11 @@ public void setCiteKeyPattern(CitationKeyPattern defaultValue, Map getSaveActions() { + public Optional getSaveActions() { return Optional.ofNullable(saveActions); } - public void setSaveActions(@NonNull FieldFormatterCleanups saveActions) { + public void setSaveActions(@NonNull FieldFormatterCleanupActions saveActions) { this.saveActions = saveActions; postChange(); } diff --git a/jablib/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/jablib/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 20e010dc54c..1a217d81939 100644 --- a/jablib/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/jablib/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -165,7 +165,7 @@ void cleanupDoiReturnsChangeWhenDoiInURLField() { @Test void cleanupMonthChangesNumberToBibtex() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.MONTH, new NormalizeMonthFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.MONTH, "01"); @@ -176,7 +176,7 @@ void cleanupMonthChangesNumberToBibtex() { @Test void cleanupPageNumbersConvertsSingleDashToDouble() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.PAGES, new NormalizePagesFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.PAGES, "1-2"); @@ -187,7 +187,7 @@ void cleanupPageNumbersConvertsSingleDashToDouble() { @Test void cleanupDatesConvertsToCorrectFormat() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.DATE, new NormalizeDateFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.DATE, "01/1999"); @@ -255,7 +255,7 @@ void cleanupRenamePdfRenamesRelativeFile() throws IOException { @Test void cleanupHtmlToLatexConvertsEpsilonToLatex() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new HtmlToLatexFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Ε"); @@ -266,7 +266,7 @@ void cleanupHtmlToLatexConvertsEpsilonToLatex() { @Test void cleanupUnitsConvertsOneAmpereToLatex() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new UnitsToLatexFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "1 A"); @@ -281,7 +281,7 @@ void cleanupCasesAddsBracketAroundAluminiumGalliumArsenid() { new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), List.of(), List.of(), List.of())); assertNotEquals(List.of(), protectedTermsLoader.getProtectedTerms()); - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new ProtectTermsFormatter(protectedTermsLoader))))); + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new ProtectTermsFormatter(protectedTermsLoader))))); BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "AlGaAs"); @@ -291,7 +291,7 @@ void cleanupCasesAddsBracketAroundAluminiumGalliumArsenid() { @Test void cleanupLatexMergesTwoLatexMathEnvironments() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(true, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new LatexCleanupFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "$\\alpha$$\\beta$"); @@ -324,7 +324,7 @@ void convertToBiblatexMovesJournalToJournalTitle() { @Test void cleanupWithDisabledFieldFormatterChangesNothing() { - CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanups(false, + CleanupPreferences preset = new CleanupPreferences(new FieldFormatterCleanupActions(false, List.of(new FieldFormatterCleanup(StandardField.MONTH, new NormalizeMonthFormatter())))); BibEntry entry = new BibEntry(); entry.setField(StandardField.MONTH, "01"); diff --git a/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java b/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupActionsTest.java similarity index 88% rename from jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java rename to jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupActionsTest.java index a36c7cb2a2f..7cf037486e2 100644 --- a/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java +++ b/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupActionsTest.java @@ -6,6 +6,7 @@ import java.util.Optional; import java.util.stream.Stream; +import org.jabref.logic.formatter.Formatter; import org.jabref.logic.formatter.IdentityFormatter; import org.jabref.logic.formatter.bibtexfields.EscapeAmpersandsFormatter; import org.jabref.logic.formatter.bibtexfields.EscapeDollarSignFormatter; @@ -30,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FieldFormatterCleanupsTest { +public class FieldFormatterCleanupActionsTest { private BibEntry entry; @@ -50,7 +51,7 @@ void setUp() { @Test void checkSimpleUseCase() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[identity]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("title[identity]")); FieldFormatterCleanup identityInTitle = new FieldFormatterCleanup(StandardField.TITLE, new IdentityFormatter()); assertEquals(List.of(identityInTitle), actions.getConfiguredActions()); @@ -62,7 +63,7 @@ void checkSimpleUseCase() { @Test void invalidSaveActionSting() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("title")); assertEquals(List.of(), actions.getConfiguredActions()); @@ -73,7 +74,7 @@ void invalidSaveActionSting() { @Test void checkLowerCaseSaveAction() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("title[lower_case]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); assertEquals(List.of(lowerCaseTitle), actions.getConfiguredActions()); @@ -85,7 +86,7 @@ void checkLowerCaseSaveAction() { @Test void checkTwoSaveActionsForOneField() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case,identity]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("title[lower_case,identity]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); FieldFormatterCleanup identityInTitle = new FieldFormatterCleanup(StandardField.TITLE, new IdentityFormatter()); @@ -98,7 +99,7 @@ void checkTwoSaveActionsForOneField() { @Test void checkThreeSaveActionsForOneField() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case,identity,normalize_date]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("title[lower_case,identity,normalize_date]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); FieldFormatterCleanup identityInTitle = new FieldFormatterCleanup(StandardField.TITLE, new IdentityFormatter()); @@ -112,7 +113,7 @@ void checkThreeSaveActionsForOneField() { @Test void checkMultipleSaveActions() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("pages[normalize_page_numbers]title[lower_case]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("pages[normalize_page_numbers]title[lower_case]")); List formatterCleanups = actions.getConfiguredActions(); FieldFormatterCleanup normalizePages = new FieldFormatterCleanup(StandardField.PAGES, new NormalizePagesFormatter()); @@ -127,8 +128,8 @@ void checkMultipleSaveActions() { @Test void checkMultipleSaveActionsWithMultipleFormatters() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, - FieldFormatterCleanups.parse("pages[normalize_page_numbers,normalize_date]title[lower_case]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, + FieldFormatterCleanupActions.parse("pages[normalize_page_numbers,normalize_date]title[lower_case]")); List formatterCleanups = actions.getConfiguredActions(); FieldFormatterCleanup normalizePages = new FieldFormatterCleanup(StandardField.PAGES, new NormalizePagesFormatter()); @@ -144,7 +145,7 @@ void checkMultipleSaveActionsWithMultipleFormatters() { @Test void clearFormatterRemovesField() { - FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("month[clear]")); + FieldFormatterCleanupActions actions = new FieldFormatterCleanupActions(true, FieldFormatterCleanupActions.parse("month[clear]")); actions.applySaveActions(entry); assertEquals(Optional.empty(), entry.getField(StandardField.MONTH)); @@ -152,7 +153,7 @@ void clearFormatterRemovesField() { @Test void parserKeepsSaveActions() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" month[normalize_month] pages[normalize_page_numbers] title[escapeAmpersands,escapeDollarSign,escapeUnderscores,latex_cleanup] @@ -177,7 +178,7 @@ void parserKeepsSaveActions() { @Test void parserParsesLatexCleanupFormatter() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[latex_cleanup] """); assertEquals( @@ -187,7 +188,7 @@ void parserParsesLatexCleanupFormatter() { @Test void parserParsesTwoFormatters() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeUnderscores,latex_cleanup] """); assertEquals( @@ -200,7 +201,7 @@ void parserParsesTwoFormatters() { @Test void parserParsesFourFormatters() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeAmpersands,escapeDollarSign,escapeUnderscores,latex_cleanup] """); assertEquals( @@ -215,7 +216,7 @@ void parserParsesFourFormatters() { @Test void parserParsesTwoFormattersWithCommas() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeUnderscores,latex_cleanup] booktitle[escapeAmpersands,escapeDollarSign] """); @@ -231,7 +232,7 @@ void parserParsesTwoFormattersWithCommas() { @Test void parserParsesTwoFormattersOneWithComma() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" pages[normalize_page_numbers] booktitle[escapeAmpersands,escapeDollarSign] """); @@ -246,7 +247,7 @@ void parserParsesTwoFormattersOneWithComma() { @Test void parserParsesThreeFormattersTwoWithComma() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" pages[normalize_page_numbers] title[escapeUnderscores,latex_cleanup] booktitle[escapeAmpersands,escapeDollarSign] @@ -264,7 +265,7 @@ void parserParsesThreeFormattersTwoWithComma() { @Test void parserWithTwoAndThree() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeAmpersands,escapeUnderscores,latex_cleanup] booktitle[escapeAmpersands,escapeUnderscores,latex_cleanup] """); @@ -281,7 +282,7 @@ void parserWithTwoAndThree() { @Test void parserWithFourEntries() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeUnderscores,latex_cleanup] booktitle[escapeAmpersands,escapeUnderscores,latex_cleanup] """); @@ -298,7 +299,7 @@ void parserWithFourEntries() { @Test void parserTest() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" title[escapeAmpersands,escapeUnderscores,latex_cleanup] booktitle[escapeAmpersands,latex_cleanup] """); @@ -315,7 +316,7 @@ void parserTest() { @Test void identityCanBeParsed() { - List fieldFormatterCleanups = FieldFormatterCleanups.parse(""" + List fieldFormatterCleanups = FieldFormatterCleanupActions.parse(""" all-text-fields[identity] date[normalize_date] month[normalize_month] @@ -340,12 +341,12 @@ void getMetaDataStringWorks() { all-text-fields[replace_unicode_ligatures] keywords[MSC_codes_to_descriptions] issn[normalize_issn] - """, FieldFormatterCleanups.getMetaDataString(FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS, "\n")); + """, FieldFormatterCleanupActions.getMetaDataString(FieldFormatterCleanupActions.DEFAULT_SAVE_ACTIONS, "\n")); } @Test void parsingOfDefaultSaveActions() { - assertEquals(FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS, FieldFormatterCleanups.parse(""" + assertEquals(FieldFormatterCleanupActions.DEFAULT_SAVE_ACTIONS, FieldFormatterCleanupActions.parse(""" pages[normalize_page_numbers] date[normalize_date] month[normalize_month] @@ -365,6 +366,6 @@ public static Stream formatterFromString() { @ParameterizedTest @MethodSource void formatterFromString(Formatter expected, String input) { - assertEquals(expected, FieldFormatterCleanups.getFormatterFromString(input)); + assertEquals(expected, FieldFormatterCleanupActions.getFormatterFromString(input)); } } diff --git a/jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java b/jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java index 01f1accbcec..7c1e9b5a474 100644 --- a/jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java +++ b/jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java @@ -19,7 +19,7 @@ import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPatterns; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.formatter.casechanger.TitleCaseFormatter; import org.jabref.logic.formatter.casechanger.UpperCaseFormatter; @@ -739,7 +739,7 @@ void reformatStringIfAskedToDoSo() throws IOException { @Test void writeSaveActions() throws IOException { - FieldFormatterCleanups saveActions = new FieldFormatterCleanups(true, + FieldFormatterCleanupActions saveActions = new FieldFormatterCleanupActions(true, Arrays.asList( new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()), new FieldFormatterCleanup(StandardField.JOURNAL, new TitleCaseFormatter()), diff --git a/jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java b/jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java index fd9528e133d..3d0075108b2 100644 --- a/jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java +++ b/jablib/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java @@ -10,7 +10,7 @@ import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.importer.util.MetaDataParser; import org.jabref.logic.os.OS; @@ -59,7 +59,7 @@ void serializeNewMetadataReturnsEmptyMap() { @Test void serializeSingleSaveAction() { - FieldFormatterCleanups saveActions = new FieldFormatterCleanups(true, + FieldFormatterCleanupActions saveActions = new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()))); metaData.setSaveActions(saveActions); diff --git a/jablib/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/jablib/src/test/java/org/jabref/logic/formatter/FormatterTest.java index a5717db0f01..776b910c8df 100644 --- a/jablib/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/jablib/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -5,7 +5,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import org.jabref.logic.formatter.minifier.TruncateFormatter; import org.jabref.logic.protectedterms.ProtectedTermsLoader; diff --git a/jablib/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/jablib/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index 9bde0c834a9..11c207d307c 100644 --- a/jablib/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/jablib/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -17,7 +17,7 @@ import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPatterns; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.exporter.SaveConfiguration; import org.jabref.logic.formatter.bibtexfields.EscapeAmpersandsFormatter; import org.jabref.logic.formatter.bibtexfields.EscapeDollarSignFormatter; @@ -1217,7 +1217,7 @@ void parseRecognizesSaveActionsAfterEntry() throws IOException { @comment{jabref-meta: saveActions:enabled;title[lower_case]}""")); - FieldFormatterCleanups saveActions = parserResult.getMetaData().getSaveActions().get(); + FieldFormatterCleanupActions saveActions = parserResult.getMetaData().getSaveActions().get(); assertTrue(saveActions.isEnabled()); assertEquals(List.of(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter())), @@ -1250,7 +1250,7 @@ void parserKeepsSaveActions() throws IOException { ;} """)); - FieldFormatterCleanups saveActions = parserResult.getMetaData().getSaveActions().get(); + FieldFormatterCleanupActions saveActions = parserResult.getMetaData().getSaveActions().get(); assertTrue(saveActions.isEnabled()); @@ -1307,7 +1307,7 @@ void integrationTestSaveActions() throws IOException { ParserResult parserResult = parser .parse(Reader.of("@comment{jabref-meta: saveActions:enabled;title[lower_case]}")); - FieldFormatterCleanups saveActions = parserResult.getMetaData().getSaveActions().get(); + FieldFormatterCleanupActions saveActions = parserResult.getMetaData().getSaveActions().get(); assertTrue(saveActions.isEnabled()); assertEquals(List.of(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter())), diff --git a/jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java b/jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java index 3ca6d7e61e6..2d2bafe5d18 100644 --- a/jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java +++ b/jablib/src/test/java/org/jabref/logic/importer/util/MetaDataParserTest.java @@ -7,7 +7,7 @@ import java.util.stream.Stream; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.exporter.MetaDataSerializerTest; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.importer.ParseException; @@ -75,8 +75,8 @@ void saveActions() throws ParseException { MetaData parsed = metaDataParser.parse(new MetaData(), data, ',', "userAndHost"); MetaData expected = new MetaData(); - FieldFormatterCleanups fieldFormatterCleanups = new FieldFormatterCleanups(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()))); - expected.setSaveActions(fieldFormatterCleanups); + FieldFormatterCleanupActions fieldFormatterCleanupActions = new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()))); + expected.setSaveActions(fieldFormatterCleanupActions); assertEquals(expected, parsed); } diff --git a/jablib/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/jablib/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index 41eebb1ef3d..d93c9dbf53a 100644 --- a/jablib/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/jablib/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -10,7 +10,7 @@ import org.jabref.logic.bibtex.FieldPreferences; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns; import org.jabref.logic.cleanup.FieldFormatterCleanup; -import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanupActions; import org.jabref.logic.exporter.MetaDataSerializer; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; @@ -233,7 +233,7 @@ void applyMetaData() { bibDatabase.insertEntry(bibEntry); MetaData testMetaData = new MetaData(); - testMetaData.setSaveActions(new FieldFormatterCleanups(true, List.of(new FieldFormatterCleanup(StandardField.AUTHOR, new LowerCaseFormatter())))); + testMetaData.setSaveActions(new FieldFormatterCleanupActions(true, List.of(new FieldFormatterCleanup(StandardField.AUTHOR, new LowerCaseFormatter())))); dbmsSynchronizer.setMetaData(testMetaData); dbmsSynchronizer.applyMetaData();