From 1b35f8cb0040fdfb515974e78532598f07e11af2 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 2 Sep 2020 13:40:52 +0200 Subject: [PATCH] Arch fix (#6825) --- build.gradle | 6 + docs/adr/0015-allow-model-access-logic.md | 40 +++ src/main/java/org/jabref/JabRefGUI.java | 2 +- .../architecture/AllowedToUseLogic.java | 10 + .../java/org/jabref/cli/AuxCommandLine.java | 4 +- src/main/java/org/jabref/gui/BasePanel.java | 2 +- src/main/java/org/jabref/gui/JabRefFrame.java | 2 +- .../auximport/AuxParserResultViewModel.java | 2 +- .../jabref/gui/auximport/FromAuxDialog.java | 4 +- .../CitationKeyPatternDialog.java | 2 +- .../CitationKeyPatternPanel.java | 4 +- .../org/jabref/gui/cleanup/CleanupDialog.java | 2 +- .../gui/cleanup/CleanupPresetPanel.java | 4 +- .../CitationKeyPatternPanel.java | 2 +- .../CitationKeyPatternPanelViewModel.java | 2 +- .../FieldFormatterCleanupsPanel.java | 4 +- .../FieldFormatterCleanupsPanelViewModel.java | 4 +- .../gui/exporter/SaveDatabaseAction.java | 2 +- .../externalfiles/AutoSetFileLinksUtil.java | 4 +- .../ExternalFilesEntryLinker.java | 2 +- .../externalfiletype/ExternalFileTypes.java | 2 +- .../fieldeditors/AbstractEditorViewModel.java | 5 +- .../gui/fieldeditors/LinkedFileViewModel.java | 2 +- .../LinkedFilesEditorViewModel.java | 4 +- .../contextmenu/CaseChangeMenu.java | 2 +- .../contextmenu/ConversionMenu.java | 2 +- .../contextmenu/ProtectedTermsMenu.java | 2 +- .../gui/importer/ImportEntriesViewModel.java | 7 +- .../importer/actions/OpenDatabaseAction.java | 2 +- .../LibraryPropertiesDialogViewModel.java | 6 +- .../gui/maintable/BibEntryTableViewModel.java | 2 +- .../CitationKeyPatternTabViewModel.java | 2 +- .../preferences/LinkedFilesTabViewModel.java | 2 +- .../shared/PullChangesFromSharedAction.java | 2 +- .../shared/SharedDatabaseLoginDialogView.java | 2 +- .../SharedDatabaseLoginDialogViewModel.java | 6 +- .../gui/shared/SharedDatabaseUIManager.java | 4 +- .../autosaveandbackup/AutosaveManager.java | 2 +- .../autosaveandbackup/BackupManager.java | 2 +- .../{model => logic}/auxparser/AuxParser.java | 2 +- .../auxparser/AuxParserResult.java | 2 +- .../logic/auxparser/DefaultAuxParser.java | 2 - .../bibtex}/FileFieldWriter.java | 4 +- .../AbstractCitationKeyPattern.java | 59 +++-- .../citationkeypattern/BracketedPattern.java | 2 +- .../CitationKeyGenerator.java | 2 - .../CitationKeyPatternPreferences.java | 2 - .../DatabaseCitationKeyPattern.java | 2 +- .../GlobalCitationKeyPattern.java | 2 +- .../{model => logic}/cleanup/CleanupJob.java | 2 +- .../logic/cleanup/CleanupPreferences.java | 2 +- .../jabref/logic/cleanup/CleanupPreset.java | 2 - .../jabref/logic/cleanup/CleanupWorker.java | 3 +- .../org/jabref/logic/cleanup/Cleanups.java | 3 - .../cleanup/ConvertToBiblatexCleanup.java | 1 - .../logic/cleanup/ConvertToBibtexCleanup.java | 1 - .../org/jabref/logic/cleanup/DoiCleanup.java | 2 - .../jabref/logic/cleanup/EprintCleanup.java | 1 - .../cleanup/FieldFormatterCleanup.java | 2 +- .../cleanup/FieldFormatterCleanups.java | 64 ++--- .../logic/cleanup/FileLinksCleanup.java | 3 +- .../{model => logic}/cleanup/Formatter.java | 2 +- .../org/jabref/logic/cleanup/ISSNCleanup.java | 1 - .../logic/cleanup/MoveFieldCleanup.java | 1 - .../logic/cleanup/MoveFilesCleanup.java | 3 +- .../cleanup/NormalizeNewlinesFormatter.java | 2 +- .../logic/cleanup/RelativePathsCleanup.java | 3 +- .../logic/cleanup/RenamePdfCleanup.java | 3 +- .../cleanup/UpgradePdfPsToFileCleanup.java | 3 +- .../logic/exporter/BibDatabaseWriter.java | 8 +- .../logic/exporter/MetaDataSerializer.java | 6 +- .../externalfiles/LinkedFileHandler.java | 2 +- .../jabref/logic/formatter/Formatters.java | 2 +- .../logic/formatter/IdentityFormatter.java | 2 +- .../bibtexfields/AddBracesFormatter.java | 2 +- .../bibtexfields/CleanupUrlFormatter.java | 2 +- .../bibtexfields/ClearFormatter.java | 2 +- .../EscapeAmpersandsFormatter.java | 2 +- .../EscapeUnderscoresFormatter.java | 2 +- .../bibtexfields/HtmlToLatexFormatter.java | 2 +- .../bibtexfields/HtmlToUnicodeFormatter.java | 2 +- .../bibtexfields/LatexCleanupFormatter.java | 2 +- .../bibtexfields/NormalizeDateFormatter.java | 2 +- .../NormalizeEnDashesFormatter.java | 2 +- .../bibtexfields/NormalizeMonthFormatter.java | 2 +- .../bibtexfields/NormalizeNamesFormatter.java | 2 +- .../bibtexfields/NormalizePagesFormatter.java | 2 +- .../OrdinalsToSuperscriptFormatter.java | 2 +- .../bibtexfields/RegexFormatter.java | 2 +- .../bibtexfields/RemoveBracesFormatter.java | 2 +- .../bibtexfields/RemoveDigitsFormatter.java | 2 +- .../RemoveHyphenatedNewlinesFormatter.java | 2 +- .../bibtexfields/RemoveNewlinesFormatter.java | 2 +- .../RemoveRedundantSpacesFormatter.java | 2 +- .../ReplaceTabsBySpaceFormater.java | 2 +- .../bibtexfields/ShortenDOIFormatter.java | 2 +- .../bibtexfields/TrimWhitespaceFormatter.java | 2 +- .../bibtexfields/UnicodeToLatexFormatter.java | 2 +- .../bibtexfields/UnitsToLatexFormatter.java | 2 +- .../casechanger/CapitalizeFormatter.java | 2 +- .../casechanger/LowerCaseFormatter.java | 2 +- .../casechanger/ProtectTermsFormatter.java | 2 +- .../casechanger/SentenceCaseFormatter.java | 2 +- .../casechanger/TitleCaseFormatter.java | 2 +- .../casechanger/UpperCaseFormatter.java | 2 +- .../minifier/MinifyNameListFormatter.java | 2 +- .../formatter/minifier/TruncateFormatter.java | 2 +- .../importer}/AuthorListParser.java | 128 +++++----- .../importer/EntryBasedParserFetcher.java | 2 +- .../logic/importer/IdBasedParserFetcher.java | 2 +- .../logic/importer/IdParserFetcher.java | 2 +- .../importer/SearchBasedParserFetcher.java | 2 +- .../fetcher/AstrophysicsDataSystem.java | 2 +- .../logic/importer/fetcher/CiteSeer.java | 4 +- ...fComputerScienceBibliographiesFetcher.java | 2 +- .../logic/importer/fetcher/CrossRef.java | 2 +- .../logic/importer/fetcher/DBLPFetcher.java | 4 +- .../logic/importer/fetcher/DoiFetcher.java | 2 +- .../importer/fetcher/INSPIREFetcher.java | 2 +- .../fetcher/IsbnViaEbookDeFetcher.java | 2 +- .../logic/importer/fetcher/MathSciNet.java | 2 +- .../importer/fetcher/MedlineFetcher.java | 2 +- .../jabref/logic/importer/fetcher/ZbMATH.java | 2 +- .../importer/util}/FileFieldParser.java | 4 +- .../jabref/logic/integrity/FieldCheckers.java | 2 +- .../jabref/logic/integrity/FileChecker.java | 4 +- .../logic/integrity/IntegrityCheck.java | 2 +- .../layout/LayoutFormatterBasedFormatter.java | 4 +- .../jabref/logic/layout/format/FileLink.java | 2 +- .../format/LatexToUnicodeFormatter.java | 2 +- .../ReplaceUnicodeLigaturesFormatter.java | 2 +- .../logic/layout/format/WrapFileLinks.java | 2 +- .../logic/pdf/EntryAnnotationImporter.java | 2 +- .../jabref/logic/pdf/FileAnnotationCache.java | 2 +- .../jabref/logic/shared/DBMSConnection.java | 2 - .../shared/DBMSConnectionProperties.java | 2 - .../DBMSConnectionPropertiesBuilder.java | 2 - .../jabref/logic/shared/DBMSProcessor.java | 3 - .../jabref/logic/shared/DBMSSynchronizer.java | 6 +- .../database => logic}/shared/DBMSType.java | 10 +- .../shared/DatabaseConnection.java | 2 +- .../shared/DatabaseConnectionProperties.java | 2 +- .../shared/DatabaseLocation.java | 2 +- .../shared/DatabaseNotSupportedException.java | 5 +- .../shared/DatabaseSynchronizer.java | 2 +- .../jabref/logic/shared/MySQLProcessor.java | 2 - .../jabref/logic/shared/OracleProcessor.java | 1 - .../logic/shared/PostgreSQLProcessor.java | 1 - .../prefs/SharedDatabasePreferences.java | 2 +- .../logic/texparser/DefaultLatexParser.java | 1 - .../texparser/LatexParser.java | 4 +- .../util}/CoarseChangeFilter.java | 4 +- .../logic/util/io/DatabaseFileLookup.java | 2 +- .../migrations/PreferencesMigrations.java | 2 +- .../model/database/BibDatabaseContext.java | 10 +- .../org/jabref/model/entry/AuthorList.java | 7 +- .../java/org/jabref/model/entry/BibEntry.java | 4 + .../org/jabref/model/entry/LinkedFile.java | 2 +- .../org/jabref/model/groups/TexGroup.java | 6 +- .../org/jabref/model/metadata/MetaData.java | 10 +- .../org/jabref/model/util/FileHelper.java | 2 +- .../FilePreferences.java | 2 +- .../jabref/preferences/JabRefPreferences.java | 5 +- .../preferences/PreferencesService.java | 3 +- src/main/resources/l10n/JabRef_en.properties | 9 +- .../architecture/MainArchitectureTests.java | 228 ++++++++++-------- .../MainArchitectureTestsWithArchUnit.java | 71 ------ .../gui/exporter/SaveDatabaseActionTest.java | 4 +- .../AutoSetFileLinksUtilTest.java | 2 +- .../fieldeditors/LinkedFileViewModelTest.java | 2 +- .../jabref/logic/auxparser/AuxParserTest.java | 2 - .../bibtex}/FileFieldWriterTest.java | 5 +- .../CitationKeyGeneratorTest.java | 1 - .../MakeLabelWithDatabaseTest.java | 2 - .../logic/cleanup/CleanupWorkerTest.java | 6 +- .../cleanup/FieldFormatterCleanupTest.java | 1 - .../jabref/logic/cleanup/ISSNCleanupTest.java | 2 +- .../logic/cleanup/MoveFilesCleanupTest.java | 4 +- .../logic/cleanup/RenamePdfCleanupTest.java | 4 +- .../logic/database/DatabaseMergerTest.java | 3 +- .../exporter/BibtexDatabaseWriterTest.java | 10 +- .../exporter/FieldFormatterCleanupsTest.java | 4 +- .../exporter/MetaDataSerializerTest.java | 6 +- .../jabref/logic/formatter/FormatterTest.java | 2 +- .../importer}/AuthorListParserTest.java | 8 +- .../logic/importer/OpenDatabaseTest.java | 4 +- .../importer/fileformat/BibtexParserTest.java | 10 +- .../fileformat/MedlinePlainImporterTest.java | 10 +- .../logic/integrity/IntegrityCheckTest.java | 4 +- .../pdf/EntryAnnotationImporterTest.java | 2 +- .../ProtectedTermsLoaderTest.java | 9 +- .../shared/DBMSConnectionPropertiesTest.java | 2 - .../logic/shared/DBMSConnectionTest.java | 1 - .../logic/shared/DBMSProcessorTest.java | 1 - .../logic/shared/DBMSSynchronizerTest.java | 7 +- .../org/jabref/logic/shared/DBMSTypeTest.java | 1 - .../shared/SynchronizationTestSimulator.java | 2 +- .../jabref/logic/shared/TestConnector.java | 1 - .../org/jabref/logic/shared/TestManager.java | 2 - .../database/BibDatabaseContextTest.java | 2 +- .../org/jabref/model/groups/TexGroupTest.java | 2 + 201 files changed, 556 insertions(+), 609 deletions(-) create mode 100644 docs/adr/0015-allow-model-access-logic.md create mode 100644 src/main/java/org/jabref/architecture/AllowedToUseLogic.java rename src/main/java/org/jabref/{model => logic}/auxparser/AuxParser.java (91%) rename src/main/java/org/jabref/{model => logic}/auxparser/AuxParserResult.java (98%) rename src/main/java/org/jabref/{model/entry => logic/bibtex}/FileFieldWriter.java (96%) rename src/main/java/org/jabref/{model/bibtexkeypattern => logic/citationkeypattern}/AbstractCitationKeyPattern.java (85%) rename src/main/java/org/jabref/{model/bibtexkeypattern => logic/citationkeypattern}/DatabaseCitationKeyPattern.java (92%) rename src/main/java/org/jabref/{model/bibtexkeypattern => logic/citationkeypattern}/GlobalCitationKeyPattern.java (92%) rename src/main/java/org/jabref/{model => logic}/cleanup/CleanupJob.java (87%) rename src/main/java/org/jabref/{model => logic}/cleanup/FieldFormatterCleanup.java (99%) rename src/main/java/org/jabref/{model => logic}/cleanup/FieldFormatterCleanups.java (99%) rename src/main/java/org/jabref/{model => logic}/cleanup/Formatter.java (98%) rename src/main/java/org/jabref/{model => logic}/cleanup/NormalizeNewlinesFormatter.java (97%) rename src/main/java/org/jabref/{model/entry => logic/importer}/AuthorListParser.java (92%) rename src/main/java/org/jabref/{model/entry => logic/importer/util}/FileFieldParser.java (96%) rename src/main/java/org/jabref/{model/database => logic}/shared/DBMSType.java (97%) rename src/main/java/org/jabref/{model/database => logic}/shared/DatabaseConnection.java (78%) rename src/main/java/org/jabref/{model/database => logic}/shared/DatabaseConnectionProperties.java (89%) rename src/main/java/org/jabref/{model/database => logic}/shared/DatabaseLocation.java (81%) rename src/main/java/org/jabref/{model/database => logic}/shared/DatabaseNotSupportedException.java (68%) rename src/main/java/org/jabref/{model/database => logic}/shared/DatabaseSynchronizer.java (91%) rename src/main/java/org/jabref/{model => logic}/texparser/LatexParser.java (90%) rename src/main/java/org/jabref/{model/database/event => logic/util}/CoarseChangeFilter.java (96%) rename src/main/java/org/jabref/{model/metadata => preferences}/FilePreferences.java (98%) delete mode 100644 src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java rename src/test/java/org/jabref/{model/entry => logic/bibtex}/FileFieldWriterTest.java (96%) rename src/test/java/org/jabref/{model/entry => logic/importer}/AuthorListParserTest.java (88%) diff --git a/build.gradle b/build.gradle index fb234d6534e..564f51b7288 100644 --- a/build.gradle +++ b/build.gradle @@ -210,6 +210,7 @@ dependencies { testImplementation 'org.mockito:mockito-core:3.5.7' testImplementation 'org.xmlunit:xmlunit-core:2.7.0' testImplementation 'org.xmlunit:xmlunit-matchers:2.7.0' + testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.14.1' testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.14.1' testImplementation "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT" testImplementation "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT" @@ -442,6 +443,11 @@ test { excludeTags 'DatabaseTest', 'FetcherTest', 'GUITest' } + moduleOptions { + // TODO: Remove this as soon as archunit is modularized + runOnClasspath = true + } + testLogging { // set options for log level LIFECYCLE // for debugging tests: add "STANDARD_OUT", "STANDARD_ERROR" diff --git a/docs/adr/0015-allow-model-access-logic.md b/docs/adr/0015-allow-model-access-logic.md new file mode 100644 index 00000000000..5567fe198d4 --- /dev/null +++ b/docs/adr/0015-allow-model-access-logic.md @@ -0,0 +1,40 @@ +# Allow org.jabref.model to access org.jabref.logic + +## Context and Problem Statement + +- How to create a maintainable architecture? +- How to split model, logic, and UI + +## Decision Drivers + +- New comers should find the architecture "split" natural +- The architecture should be a help (and not a burden) + +## Considered Options + +- `org.jabref.model` uses `org.jabref.model` (and external libraries) only +- `org.jabref.model` may use `org.jabref.logic` in defined cases +- `org.jabref.model` and `org.jabref.logic` may access each other freely + +## Decision Outcome + +Chosen option: "`org.jabref.model` may use `org.jabref.logic` in defined cases", because comes out best \(see below\). + +## Pros and Cons of the Options + +### `org.jabref.model` uses `org.jabref.model` (and external libraries) only + +- Good, because clear separation of model and logic +- Bad, because this leads to an [Anemic Domain Model](https://martinfowler.com/bliki/AnemicDomainModel.html) + +### `org.jabref.model` may use `org.jabref.logic` in defined cases + +- Good, because model and logic are still separated +- Neutral, because each exception has to be discussed and agreed +- Bad, because new comers have to be informed that there are certain (agreed) exceptions for model to access logic + +### `org.jabref.model` and `org.jabref.logic` may access each other freely + +- Bad, because may lead to spaghetti code +- Bad, because coupling between model and logic is increased +- Bad, because cohesion inside model is decreased diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index fd228609a3d..ab5d0200fe6 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -23,9 +23,9 @@ import org.jabref.logic.importer.OpenDatabase; import org.jabref.logic.importer.ParserResult; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.shared.DatabaseNotSupportedException; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; import org.jabref.logic.shared.exception.NotASharedDatabaseException; -import org.jabref.model.database.shared.DatabaseNotSupportedException; import org.jabref.preferences.JabRefPreferences; import impl.org.controlsfx.skin.DecorationPane; diff --git a/src/main/java/org/jabref/architecture/AllowedToUseLogic.java b/src/main/java/org/jabref/architecture/AllowedToUseLogic.java new file mode 100644 index 00000000000..ed6be5be7c4 --- /dev/null +++ b/src/main/java/org/jabref/architecture/AllowedToUseLogic.java @@ -0,0 +1,10 @@ +package org.jabref.architecture; + +/** + * Annotation to indicate that this logic class can be used in the model package. + */ +public @interface AllowedToUseLogic { + + // The rationale + String value(); +} diff --git a/src/main/java/org/jabref/cli/AuxCommandLine.java b/src/main/java/org/jabref/cli/AuxCommandLine.java index 00cb424fb54..61f4c133008 100644 --- a/src/main/java/org/jabref/cli/AuxCommandLine.java +++ b/src/main/java/org/jabref/cli/AuxCommandLine.java @@ -3,9 +3,9 @@ import java.nio.file.Path; import org.jabref.gui.auximport.AuxParserResultViewModel; +import org.jabref.logic.auxparser.AuxParser; +import org.jabref.logic.auxparser.AuxParserResult; import org.jabref.logic.auxparser.DefaultAuxParser; -import org.jabref.model.auxparser.AuxParser; -import org.jabref.model.auxparser.AuxParserResult; import org.jabref.model.database.BibDatabase; import org.jabref.model.strings.StringUtil; diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index eacb550283a..91b401415fb 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -33,6 +33,7 @@ import org.jabref.logic.l10n.Localization; import org.jabref.logic.pdf.FileAnnotationCache; import org.jabref.logic.search.SearchQuery; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.logic.util.UpdateField; import org.jabref.model.FieldChange; import org.jabref.model.database.BibDatabase; @@ -40,7 +41,6 @@ import org.jabref.model.database.event.BibDatabaseContextChangedEvent; import org.jabref.model.database.event.EntriesAddedEvent; import org.jabref.model.database.event.EntriesRemovedEvent; -import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.event.EntriesEventSource; import org.jabref.model.entry.event.EntryChangedEvent; diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index a7590558a1c..43fddebf96f 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -128,13 +128,13 @@ import org.jabref.logic.importer.ParserResult; import org.jabref.logic.importer.WebFetchers; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.logic.undo.AddUndoableActionEvent; import org.jabref.logic.undo.UndoChangeEvent; import org.jabref.logic.undo.UndoRedoEvent; import org.jabref.logic.util.OS; import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.SpecialField; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java b/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java index e30753c8542..d565151eb71 100644 --- a/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java +++ b/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java @@ -1,7 +1,7 @@ package org.jabref.gui.auximport; +import org.jabref.logic.auxparser.AuxParserResult; import org.jabref.logic.l10n.Localization; -import org.jabref.model.auxparser.AuxParserResult; public class AuxParserResultViewModel { diff --git a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java index ccbf6c53c29..518b09efc2b 100644 --- a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java +++ b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java @@ -16,11 +16,11 @@ import org.jabref.gui.JabRefFrame; import org.jabref.gui.util.BaseDialog; import org.jabref.gui.util.FileDialogConfiguration; +import org.jabref.logic.auxparser.AuxParser; +import org.jabref.logic.auxparser.AuxParserResult; import org.jabref.logic.auxparser.DefaultAuxParser; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.StandardFileType; -import org.jabref.model.auxparser.AuxParser; -import org.jabref.model.auxparser.AuxParserResult; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.preferences.PreferencesService; diff --git a/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternDialog.java b/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternDialog.java index e051ff2dcbb..6639840417b 100644 --- a/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternDialog.java +++ b/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternDialog.java @@ -5,8 +5,8 @@ import org.jabref.Globals; import org.jabref.gui.BasePanel; import org.jabref.gui.util.BaseDialog; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; import org.jabref.logic.l10n.Localization; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; import org.jabref.model.metadata.MetaData; public class CitationKeyPatternDialog extends BaseDialog { diff --git a/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternPanel.java b/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternPanel.java index c9114dc89dd..1f1a705bec3 100644 --- a/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternPanel.java +++ b/src/main/java/org/jabref/gui/citationkeypattern/CitationKeyPatternPanel.java @@ -15,10 +15,10 @@ import org.jabref.gui.actions.ActionFactory; import org.jabref.gui.actions.StandardActions; import org.jabref.gui.help.HelpAction; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; +import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPattern; import org.jabref.logic.help.HelpFile; import org.jabref.logic.l10n.Localization; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.DatabaseCitationKeyPattern; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.types.EntryType; diff --git a/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java b/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java index 83d9e810b05..20d3648e940 100644 --- a/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java +++ b/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java @@ -6,7 +6,7 @@ import org.jabref.logic.cleanup.CleanupPreset; import org.jabref.logic.l10n.Localization; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class CleanupDialog extends BaseDialog { diff --git a/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java b/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java index 3ea9fa7c8c7..3d94fee18bc 100644 --- a/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java +++ b/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java @@ -14,11 +14,11 @@ import org.jabref.gui.commonfxcontrols.FieldFormatterCleanupsPanel; import org.jabref.logic.cleanup.CleanupPreset; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import com.airhacks.afterburner.views.ViewLoader; diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanel.java b/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanel.java index b3ede249f9b..ac61606744c 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanel.java @@ -13,8 +13,8 @@ import org.jabref.gui.icon.IconTheme; import org.jabref.gui.util.ValueTableCellFactory; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; import org.jabref.logic.l10n.Localization; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.types.EntryType; import org.jabref.preferences.PreferencesService; diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanelViewModel.java b/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanelViewModel.java index dbfad157b9f..fa3a1978b29 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanelViewModel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/CitationKeyPatternPanelViewModel.java @@ -9,8 +9,8 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; import org.jabref.logic.l10n.Localization; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.types.EntryType; import org.jabref.preferences.PreferencesService; diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java b/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java index d0ded8f1863..ed6df61fce5 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanel.java @@ -18,9 +18,9 @@ import org.jabref.gui.util.FieldsUtil; 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.l10n.Localization; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.field.Field; import com.airhacks.afterburner.views.ViewLoader; diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java b/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java index 24258baa7ac..2626446a5f9 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/FieldFormatterCleanupsPanelViewModel.java @@ -12,8 +12,8 @@ import org.jabref.Globals; import org.jabref.gui.util.NoSelectionModel; import org.jabref.logic.cleanup.Cleanups; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.Formatter; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.Formatter; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; diff --git a/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java b/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java index 871d0acfdcd..42c5a572c48 100644 --- a/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java +++ b/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java @@ -28,11 +28,11 @@ import org.jabref.logic.exporter.SavePreferences; import org.jabref.logic.l10n.Encodings; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.logic.shared.prefs.SharedDatabasePreferences; import org.jabref.logic.util.StandardFileType; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.event.ChangePropagation; -import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.preferences.JabRefPreferences; diff --git a/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java b/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java index f771d0bed44..70927daa0a6 100644 --- a/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java +++ b/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java @@ -14,17 +14,17 @@ import org.jabref.gui.undo.NamedCompound; import org.jabref.gui.undo.UndoableFieldChange; import org.jabref.gui.util.DefaultTaskExecutor; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.logic.util.io.AutoLinkPreferences; import org.jabref.logic.util.io.FileFinder; import org.jabref.logic.util.io.FileFinders; import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.FileHelper; +import org.jabref.preferences.FilePreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/gui/externalfiles/ExternalFilesEntryLinker.java b/src/main/java/org/jabref/gui/externalfiles/ExternalFilesEntryLinker.java index 657ece362e5..2c5dfa66571 100644 --- a/src/main/java/org/jabref/gui/externalfiles/ExternalFilesEntryLinker.java +++ b/src/main/java/org/jabref/gui/externalfiles/ExternalFilesEntryLinker.java @@ -14,7 +14,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class ExternalFilesEntryLinker { diff --git a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java index 485a050523c..0412157ed38 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java +++ b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java @@ -11,7 +11,7 @@ import java.util.TreeSet; import org.jabref.Globals; -import org.jabref.model.entry.FileFieldWriter; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.strings.StringUtil; import org.jabref.model.util.FileHelper; diff --git a/src/main/java/org/jabref/gui/fieldeditors/AbstractEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/AbstractEditorViewModel.java index 064b8808bdf..f806fe76ded 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/AbstractEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/AbstractEditorViewModel.java @@ -23,7 +23,6 @@ import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; import de.saxsys.mvvmfx.utils.validation.ValidationMessage; import de.saxsys.mvvmfx.utils.validation.Validator; -import org.apache.commons.lang3.StringUtils; import org.controlsfx.control.textfield.AutoCompletionBinding; public class AbstractEditorViewModel extends AbstractViewModel { @@ -66,10 +65,10 @@ public void bindToEntry(BibEntry entry) { newValue -> { if (newValue != null) { // Controlsfx uses hardcoded \n for multiline fields, but JabRef stores them in OS Newlines format - String oldValue = entry.getField(field).map(value -> value.replace(OS.NEWLINE, "\n")).orElse(null); + String oldValue = entry.getField(field).map(value -> value.replace(OS.NEWLINE, "\n").trim()).orElse(null); // Autosave and save action trigger the entry editor to reload the fields, so we have to // check for changes here, otherwise the cursor position is annoyingly reset every few seconds - if (!(newValue.trim()).equals(StringUtils.trim(oldValue))) { + if (!(newValue.trim()).equals(oldValue)) { entry.setField(field, newValue); UndoManager undoManager = JabRefGUI.getMainFrame().getUndoManager(); undoManager.addEdit(new UndoableFieldChange(entry, field, oldValue, newValue)); diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index 2ba1f4dc78c..15d030ae8de 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -45,10 +45,10 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.strings.StringUtil; import org.jabref.model.util.FileHelper; import org.jabref.model.util.OptionalUtil; +import org.jabref.preferences.FilePreferences; import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; import de.saxsys.mvvmfx.utils.validation.ValidationMessage; diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java index c230aa9010d..e4ec2b9e3a2 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java @@ -27,14 +27,14 @@ import org.jabref.gui.util.BindingsHelper; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.gui.util.TaskExecutor; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.logic.importer.FulltextFetchers; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.logic.integrity.FieldCheckers; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldParser; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.Field; import org.jabref.model.util.FileHelper; diff --git a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/CaseChangeMenu.java b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/CaseChangeMenu.java index 6539516b776..8cb78b2049f 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/CaseChangeMenu.java +++ b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/CaseChangeMenu.java @@ -11,10 +11,10 @@ import javafx.scene.control.Tooltip; import org.jabref.Globals; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; class CaseChangeMenu extends Menu { diff --git a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ConversionMenu.java b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ConversionMenu.java index 1bf5a1cd5ed..8e6743933b4 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ConversionMenu.java +++ b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ConversionMenu.java @@ -6,9 +6,9 @@ import javafx.scene.control.Menu; import javafx.scene.control.Tooltip; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Menu to show up on right-click in a text field for converting text formats diff --git a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java index 85e4f8f46a1..9fb0975b0b9 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java +++ b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java @@ -9,11 +9,11 @@ import javafx.scene.control.TextInputControl; import org.jabref.Globals; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.protectedterms.ProtectedTermsList; import org.jabref.logic.protectedterms.ProtectedTermsLoader; -import org.jabref.model.cleanup.Formatter; class ProtectedTermsMenu extends Menu { diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 0097cb03440..e0f3217aa2c 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -29,17 +29,12 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.FileUpdateMonitor; +import org.jabref.preferences.FilePreferences; import org.jabref.preferences.PreferencesService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class ImportEntriesViewModel extends AbstractViewModel { - private static final Logger LOGGER = LoggerFactory.getLogger(ImportEntriesViewModel.class); - private final StringProperty message; private final TaskExecutor taskExecutor; private final BibDatabaseContext databaseContext; diff --git a/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java b/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java index cf78a65f58d..584ed828960 100644 --- a/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java +++ b/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java @@ -27,10 +27,10 @@ import org.jabref.logic.importer.OpenDatabase; import org.jabref.logic.importer.ParserResult; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.shared.DatabaseNotSupportedException; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; import org.jabref.logic.shared.exception.NotASharedDatabaseException; import org.jabref.logic.util.StandardFileType; -import org.jabref.model.database.shared.DatabaseNotSupportedException; import org.jabref.preferences.JabRefPreferences; import org.slf4j.Logger; diff --git a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java index 80a11f70b63..a05c2ef2c7c 100644 --- a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java @@ -18,12 +18,12 @@ import org.jabref.gui.DialogService; import org.jabref.gui.util.DirectoryDialogConfiguration; import org.jabref.logic.cleanup.Cleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.l10n.Encodings; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; -import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.field.InternalField; diff --git a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java index 1d368e5496c..75a72b4cdf3 100644 --- a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java +++ b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java @@ -14,9 +14,9 @@ import javafx.beans.value.ObservableValue; import org.jabref.gui.specialfields.SpecialFieldValueViewModel; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldParser; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.OrFields; diff --git a/src/main/java/org/jabref/gui/preferences/CitationKeyPatternTabViewModel.java b/src/main/java/org/jabref/gui/preferences/CitationKeyPatternTabViewModel.java index e718922687a..324d4cba644 100644 --- a/src/main/java/org/jabref/gui/preferences/CitationKeyPatternTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/CitationKeyPatternTabViewModel.java @@ -17,7 +17,7 @@ import org.jabref.gui.commonfxcontrols.CitationKeyPatternPanelItemModel; import org.jabref.gui.commonfxcontrols.CitationKeyPatternPanelViewModel; import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.preferences.PreferencesService; public class CitationKeyPatternTabViewModel implements PreferenceTabViewModel { diff --git a/src/main/java/org/jabref/gui/preferences/LinkedFilesTabViewModel.java b/src/main/java/org/jabref/gui/preferences/LinkedFilesTabViewModel.java index 0a40a7f6679..66539b9f197 100644 --- a/src/main/java/org/jabref/gui/preferences/LinkedFilesTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/LinkedFilesTabViewModel.java @@ -17,7 +17,7 @@ import org.jabref.gui.util.DirectoryDialogConfiguration; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.io.AutoLinkPreferences; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import org.jabref.preferences.PreferencesService; import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; diff --git a/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java b/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java index 72bf0e9c129..c3c75e18e2a 100644 --- a/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java +++ b/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java @@ -3,7 +3,7 @@ import org.jabref.gui.StateManager; import org.jabref.gui.actions.ActionHelper; import org.jabref.gui.actions.SimpleCommand; -import org.jabref.model.database.shared.DatabaseSynchronizer; +import org.jabref.logic.shared.DatabaseSynchronizer; public class PullChangesFromSharedAction extends SimpleCommand { diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java index fefdbbd68f6..df2562ddd5d 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java @@ -18,7 +18,7 @@ import org.jabref.gui.util.ControlHelper; import org.jabref.gui.util.IconValidationDecorator; import org.jabref.logic.l10n.Localization; -import org.jabref.model.database.shared.DBMSType; +import org.jabref.logic.shared.DBMSType; import com.airhacks.afterburner.views.ViewLoader; import com.tobiasdiez.easybind.EasyBind; diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java index 28ab38de947..249af2eea4e 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java @@ -32,14 +32,14 @@ import org.jabref.logic.l10n.Localization; import org.jabref.logic.shared.DBMSConnectionProperties; import org.jabref.logic.shared.DBMSConnectionPropertiesBuilder; +import org.jabref.logic.shared.DBMSType; +import org.jabref.logic.shared.DatabaseLocation; +import org.jabref.logic.shared.DatabaseNotSupportedException; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; import org.jabref.logic.shared.prefs.SharedDatabasePreferences; import org.jabref.logic.shared.security.Password; import org.jabref.logic.util.StandardFileType; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.shared.DBMSType; -import org.jabref.model.database.shared.DatabaseLocation; -import org.jabref.model.database.shared.DatabaseNotSupportedException; import org.jabref.preferences.JabRefPreferences; import com.tobiasdiez.easybind.EasyBind; diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java index 41047ab80ec..8737af6ace1 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java @@ -22,6 +22,8 @@ import org.jabref.logic.shared.DBMSConnection; import org.jabref.logic.shared.DBMSConnectionProperties; import org.jabref.logic.shared.DBMSSynchronizer; +import org.jabref.logic.shared.DatabaseNotSupportedException; +import org.jabref.logic.shared.DatabaseSynchronizer; import org.jabref.logic.shared.event.ConnectionLostEvent; import org.jabref.logic.shared.event.SharedEntriesNotPresentEvent; import org.jabref.logic.shared.event.UpdateRefusedEvent; @@ -29,8 +31,6 @@ import org.jabref.logic.shared.exception.NotASharedDatabaseException; import org.jabref.logic.shared.prefs.SharedDatabasePreferences; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.shared.DatabaseNotSupportedException; -import org.jabref.model.database.shared.DatabaseSynchronizer; import org.jabref.model.entry.BibEntry; import com.google.common.eventbus.Subscribe; diff --git a/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java b/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java index 4b657b4946f..1ba127033d1 100644 --- a/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java +++ b/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java @@ -4,11 +4,11 @@ import java.util.Set; import java.util.concurrent.ScheduledThreadPoolExecutor; +import org.jabref.logic.util.CoarseChangeFilter; import org.jabref.logic.util.DelayTaskThrottler; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.event.AutosaveEvent; import org.jabref.model.database.event.BibDatabaseContextChangedEvent; -import org.jabref.model.database.event.CoarseChangeFilter; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; diff --git a/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java b/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java index 80d9e48d80d..36d1b0a1f53 100644 --- a/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java +++ b/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java @@ -15,11 +15,11 @@ import org.jabref.logic.exporter.AtomicFileWriter; import org.jabref.logic.exporter.BibtexDatabaseWriter; import org.jabref.logic.exporter.SavePreferences; +import org.jabref.logic.util.CoarseChangeFilter; import org.jabref.logic.util.DelayTaskThrottler; import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.event.BibDatabaseContextChangedEvent; -import org.jabref.model.database.event.CoarseChangeFilter; import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.preferences.JabRefPreferences; diff --git a/src/main/java/org/jabref/model/auxparser/AuxParser.java b/src/main/java/org/jabref/logic/auxparser/AuxParser.java similarity index 91% rename from src/main/java/org/jabref/model/auxparser/AuxParser.java rename to src/main/java/org/jabref/logic/auxparser/AuxParser.java index ff0c168ba39..0869923e29e 100644 --- a/src/main/java/org/jabref/model/auxparser/AuxParser.java +++ b/src/main/java/org/jabref/logic/auxparser/AuxParser.java @@ -1,4 +1,4 @@ -package org.jabref.model.auxparser; +package org.jabref.logic.auxparser; import java.nio.file.Path; diff --git a/src/main/java/org/jabref/model/auxparser/AuxParserResult.java b/src/main/java/org/jabref/logic/auxparser/AuxParserResult.java similarity index 98% rename from src/main/java/org/jabref/model/auxparser/AuxParserResult.java rename to src/main/java/org/jabref/logic/auxparser/AuxParserResult.java index 28bdbeef840..d9ca4460f74 100644 --- a/src/main/java/org/jabref/model/auxparser/AuxParserResult.java +++ b/src/main/java/org/jabref/logic/auxparser/AuxParserResult.java @@ -1,4 +1,4 @@ -package org.jabref.model.auxparser; +package org.jabref.logic.auxparser; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java b/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java index fdc36748b5a..62b22934c01 100644 --- a/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java +++ b/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java @@ -11,8 +11,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.model.auxparser.AuxParser; -import org.jabref.model.auxparser.AuxParserResult; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/model/entry/FileFieldWriter.java b/src/main/java/org/jabref/logic/bibtex/FileFieldWriter.java similarity index 96% rename from src/main/java/org/jabref/model/entry/FileFieldWriter.java rename to src/main/java/org/jabref/logic/bibtex/FileFieldWriter.java index 590f377f090..68f59c1e403 100644 --- a/src/main/java/org/jabref/model/entry/FileFieldWriter.java +++ b/src/main/java/org/jabref/logic/bibtex/FileFieldWriter.java @@ -1,10 +1,12 @@ -package org.jabref.model.entry; +package org.jabref.logic.bibtex; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +import org.jabref.model.entry.LinkedFile; + public class FileFieldWriter { private FileFieldWriter() { diff --git a/src/main/java/org/jabref/model/bibtexkeypattern/AbstractCitationKeyPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/AbstractCitationKeyPattern.java similarity index 85% rename from src/main/java/org/jabref/model/bibtexkeypattern/AbstractCitationKeyPattern.java rename to src/main/java/org/jabref/logic/citationkeypattern/AbstractCitationKeyPattern.java index 4674bbb41d7..083aebb736c 100644 --- a/src/main/java/org/jabref/model/bibtexkeypattern/AbstractCitationKeyPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/AbstractCitationKeyPattern.java @@ -1,4 +1,4 @@ -package org.jabref.model.bibtexkeypattern; +package org.jabref.logic.citationkeypattern; import java.util.ArrayList; import java.util.HashMap; @@ -21,6 +21,28 @@ public abstract class AbstractCitationKeyPattern { protected Map> data = new HashMap<>(); + /** + * This method takes a string of the form [field1]spacer[field2]spacer[field3]..., where the fields are the + * (required) fields of a BibTex entry. The string is split into fields and spacers by recognizing the [ and ]. + * + * @param bibtexKeyPattern a String + * @return an ArrayList The first item of the list is a string representation of the key pattern (the + * parameter), the remaining items are the fields + */ + public static List split(String bibtexKeyPattern) { + // A holder for fields of the entry to be used for the key + List fieldList = new ArrayList<>(); + + // Before we do anything, we add the parameter to the ArrayLIst + fieldList.add(bibtexKeyPattern); + + StringTokenizer tok = new StringTokenizer(bibtexKeyPattern, "[]", true); + while (tok.hasMoreTokens()) { + fieldList.add(tok.nextToken()); + } + return fieldList; + } + public void addCitationKeyPattern(EntryType type, String pattern) { data.put(type, AbstractCitationKeyPattern.split(pattern)); } @@ -52,12 +74,10 @@ public int hashCode() { } /** - * Gets an object for a desired key from this CitationKeyPattern or one of it's - * parents (in the case of DatabaseCitationKeyPattern). This method first tries to obtain the object from this - * CitationKeyPattern via the get method of Hashtable. - * If this fails, we try the default.
- * If that fails, we try the parent.
- * If that fails, we return the DEFAULT_LABELPATTERN
+ * Gets an object for a desired key from this CitationKeyPattern or one of it's parents (in the case of + * DatabaseCitationKeyPattern). This method first tries to obtain the object from this CitationKeyPattern via the + * get method of Hashtable. If this fails, we try the default.
If that fails, we try + * the parent.
If that fails, we return the DEFAULT_LABELPATTERN
* * @param entryType a String * @return the list of Strings for the given key. First entry: the complete key @@ -75,31 +95,6 @@ public List getValue(EntryType entryType) { } } return result; - - } - - /** - * This method takes a string of the form [field1]spacer[field2]spacer[field3]..., - * where the fields are the (required) fields of a BibTex entry. The string is split - * into fields and spacers by recognizing the [ and ]. - * - * @param bibtexKeyPattern a String - * @return an ArrayList The first item of the list - * is a string representation of the key pattern (the parameter), - * the remaining items are the fields - */ - public static List split(String bibtexKeyPattern) { - // A holder for fields of the entry to be used for the key - List fieldList = new ArrayList<>(); - - // Before we do anything, we add the parameter to the ArrayLIst - fieldList.add(bibtexKeyPattern); - - StringTokenizer tok = new StringTokenizer(bibtexKeyPattern, "[]", true); - while (tok.hasMoreTokens()) { - fieldList.add(tok.nextToken()); - } - return fieldList; } /** diff --git a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java index 4254ed940bf..fc02dc44e3e 100644 --- a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java @@ -15,10 +15,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.Formatters; import org.jabref.logic.formatter.casechanger.Word; import org.jabref.logic.layout.format.RemoveLatexCommandsFormatter; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.AuthorList; import org.jabref.model.entry.BibEntry; diff --git a/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java b/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java index dd858bfcd46..e070de0ea97 100644 --- a/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java @@ -8,8 +8,6 @@ import java.util.Optional; import org.jabref.model.FieldChange; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; diff --git a/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java b/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java index bda74688b06..3017dbaec15 100644 --- a/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java @@ -1,7 +1,5 @@ package org.jabref.logic.citationkeypattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; - public class CitationKeyPatternPreferences { public enum KeySuffix { diff --git a/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseCitationKeyPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/DatabaseCitationKeyPattern.java similarity index 92% rename from src/main/java/org/jabref/model/bibtexkeypattern/DatabaseCitationKeyPattern.java rename to src/main/java/org/jabref/logic/citationkeypattern/DatabaseCitationKeyPattern.java index 5604696914c..33e643d4a4c 100644 --- a/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseCitationKeyPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/DatabaseCitationKeyPattern.java @@ -1,4 +1,4 @@ -package org.jabref.model.bibtexkeypattern; +package org.jabref.logic.citationkeypattern; import java.util.List; diff --git a/src/main/java/org/jabref/model/bibtexkeypattern/GlobalCitationKeyPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/GlobalCitationKeyPattern.java similarity index 92% rename from src/main/java/org/jabref/model/bibtexkeypattern/GlobalCitationKeyPattern.java rename to src/main/java/org/jabref/logic/citationkeypattern/GlobalCitationKeyPattern.java index e85f6696442..38c6b3000b9 100644 --- a/src/main/java/org/jabref/model/bibtexkeypattern/GlobalCitationKeyPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/GlobalCitationKeyPattern.java @@ -1,4 +1,4 @@ -package org.jabref.model.bibtexkeypattern; +package org.jabref.logic.citationkeypattern; import java.util.List; diff --git a/src/main/java/org/jabref/model/cleanup/CleanupJob.java b/src/main/java/org/jabref/logic/cleanup/CleanupJob.java similarity index 87% rename from src/main/java/org/jabref/model/cleanup/CleanupJob.java rename to src/main/java/org/jabref/logic/cleanup/CleanupJob.java index cca52a11fdf..a36f12a2408 100644 --- a/src/main/java/org/jabref/model/cleanup/CleanupJob.java +++ b/src/main/java/org/jabref/logic/cleanup/CleanupJob.java @@ -1,4 +1,4 @@ -package org.jabref.model.cleanup; +package org.jabref.logic.cleanup; import java.util.List; diff --git a/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java b/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java index 5f548e16edf..5a0d5c5271d 100644 --- a/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java +++ b/src/main/java/org/jabref/logic/cleanup/CleanupPreferences.java @@ -1,7 +1,7 @@ package org.jabref.logic.cleanup; import org.jabref.logic.layout.LayoutFormatterPreferences; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class CleanupPreferences { diff --git a/src/main/java/org/jabref/logic/cleanup/CleanupPreset.java b/src/main/java/org/jabref/logic/cleanup/CleanupPreset.java index a326dc6eed8..d35d70affdb 100644 --- a/src/main/java/org/jabref/logic/cleanup/CleanupPreset.java +++ b/src/main/java/org/jabref/logic/cleanup/CleanupPreset.java @@ -6,8 +6,6 @@ import java.util.Objects; import java.util.Set; -import org.jabref.model.cleanup.FieldFormatterCleanups; - public class CleanupPreset { private final Set activeJobs; diff --git a/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java b/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java index 1831064a286..1fe79ea0258 100644 --- a/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java +++ b/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java @@ -5,10 +5,9 @@ import java.util.Objects; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class CleanupWorker { diff --git a/src/main/java/org/jabref/logic/cleanup/Cleanups.java b/src/main/java/org/jabref/logic/cleanup/Cleanups.java index d5bbc705523..726da9eb134 100644 --- a/src/main/java/org/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/org/jabref/logic/cleanup/Cleanups.java @@ -14,9 +14,6 @@ import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; import org.jabref.logic.layout.format.LatexToUnicodeFormatter; import org.jabref.logic.layout.format.ReplaceUnicodeLigaturesFormatter; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanup.java b/src/main/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanup.java index 006bf203f9e..c6e2ab13309 100644 --- a/src/main/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanup.java @@ -6,7 +6,6 @@ import java.util.Optional; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.Date; import org.jabref.model.entry.EntryConverter; diff --git a/src/main/java/org/jabref/logic/cleanup/ConvertToBibtexCleanup.java b/src/main/java/org/jabref/logic/cleanup/ConvertToBibtexCleanup.java index a58812703ad..20a524cfac8 100644 --- a/src/main/java/org/jabref/logic/cleanup/ConvertToBibtexCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/ConvertToBibtexCleanup.java @@ -5,7 +5,6 @@ import java.util.Map; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.EntryConverter; import org.jabref.model.entry.field.Field; diff --git a/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java b/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java index 8c339b91b54..c830e86ab7d 100644 --- a/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java @@ -7,8 +7,6 @@ import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/cleanup/EprintCleanup.java b/src/main/java/org/jabref/logic/cleanup/EprintCleanup.java index df76bd3e7ac..8f332ae029a 100644 --- a/src/main/java/org/jabref/logic/cleanup/EprintCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/EprintCleanup.java @@ -6,7 +6,6 @@ import java.util.Optional; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanup.java b/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java similarity index 99% rename from src/main/java/org/jabref/model/cleanup/FieldFormatterCleanup.java rename to src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java index 1509d1a100e..b02049573c5 100644 --- a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanup.java @@ -1,4 +1,4 @@ -package org.jabref.model.cleanup; +package org.jabref.logic.cleanup; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java b/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java similarity index 99% rename from src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java rename to src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java index a63bc577fa2..d480f5bfc9f 100644 --- a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java +++ b/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java @@ -1,4 +1,4 @@ -package org.jabref.model.cleanup; +package org.jabref.logic.cleanup; import java.util.ArrayList; import java.util.Collections; @@ -27,6 +27,37 @@ public FieldFormatterCleanups(boolean enabled, List actio this.actions = Objects.requireNonNull(actions); } + private static String getMetaDataString(List actionList, String newline) { + // first, group all formatters by the field for which they apply + Map> groupedByField = new TreeMap<>(Comparator.comparing(Field::getName)); + for (FieldFormatterCleanup cleanup : actionList) { + Field key = cleanup.getField(); + + // add new list into the hashmap if needed + if (!groupedByField.containsKey(key)) { + groupedByField.put(key, 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(",", "[", "]" + newline); + entry.getValue().forEach(joiner::add); + result.append(joiner.toString()); + } + + return result.toString(); + } + public boolean isEnabled() { return enabled; } @@ -88,35 +119,4 @@ public List getAsStringList(String newline) { stringRepresentation.add(formatterString); return stringRepresentation; } - - private static String getMetaDataString(List actionList, String newline) { - // first, group all formatters by the field for which they apply - Map> groupedByField = new TreeMap<>(Comparator.comparing(Field::getName)); - for (FieldFormatterCleanup cleanup : actionList) { - Field key = cleanup.getField(); - - // add new list into the hashmap if needed - if (!groupedByField.containsKey(key)) { - groupedByField.put(key, 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(",", "[", "]" + newline); - entry.getValue().forEach(joiner::add); - result.append(joiner.toString()); - } - - return result.toString(); - } } diff --git a/src/main/java/org/jabref/logic/cleanup/FileLinksCleanup.java b/src/main/java/org/jabref/logic/cleanup/FileLinksCleanup.java index f863dea0795..fb72153186f 100644 --- a/src/main/java/org/jabref/logic/cleanup/FileLinksCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/FileLinksCleanup.java @@ -4,10 +4,9 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/model/cleanup/Formatter.java b/src/main/java/org/jabref/logic/cleanup/Formatter.java similarity index 98% rename from src/main/java/org/jabref/model/cleanup/Formatter.java rename to src/main/java/org/jabref/logic/cleanup/Formatter.java index fa149b720c3..e1e377fdcc3 100644 --- a/src/main/java/org/jabref/model/cleanup/Formatter.java +++ b/src/main/java/org/jabref/logic/cleanup/Formatter.java @@ -1,4 +1,4 @@ -package org.jabref.model.cleanup; +package org.jabref.logic.cleanup; /** * The Formatter is used for a Filter design-pattern. Extending classes have to accept a String and returned a formatted diff --git a/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java b/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java index 261efb404ab..735e408b3a5 100644 --- a/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java @@ -5,7 +5,6 @@ import java.util.Optional; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.identifier.ISSN; diff --git a/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java b/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java index 0b5d5744ab2..bdf61432441 100644 --- a/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java @@ -4,7 +4,6 @@ import java.util.Optional; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.util.OptionalUtil; diff --git a/src/main/java/org/jabref/logic/cleanup/MoveFilesCleanup.java b/src/main/java/org/jabref/logic/cleanup/MoveFilesCleanup.java index 01c64512fa8..4fad8316175 100644 --- a/src/main/java/org/jabref/logic/cleanup/MoveFilesCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/MoveFilesCleanup.java @@ -8,12 +8,11 @@ import org.jabref.logic.externalfiles.LinkedFileHandler; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.OptionalUtil; +import org.jabref.preferences.FilePreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/model/cleanup/NormalizeNewlinesFormatter.java b/src/main/java/org/jabref/logic/cleanup/NormalizeNewlinesFormatter.java similarity index 97% rename from src/main/java/org/jabref/model/cleanup/NormalizeNewlinesFormatter.java rename to src/main/java/org/jabref/logic/cleanup/NormalizeNewlinesFormatter.java index 80c620fcd4e..42e59d01928 100644 --- a/src/main/java/org/jabref/model/cleanup/NormalizeNewlinesFormatter.java +++ b/src/main/java/org/jabref/logic/cleanup/NormalizeNewlinesFormatter.java @@ -1,4 +1,4 @@ -package org.jabref.model.cleanup; +package org.jabref.logic.cleanup; import java.util.Objects; diff --git a/src/main/java/org/jabref/logic/cleanup/RelativePathsCleanup.java b/src/main/java/org/jabref/logic/cleanup/RelativePathsCleanup.java index c21c267650a..c7d08c70cf2 100644 --- a/src/main/java/org/jabref/logic/cleanup/RelativePathsCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/RelativePathsCleanup.java @@ -9,11 +9,10 @@ import org.jabref.logic.util.io.FileUtil; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class RelativePathsCleanup implements CleanupJob { diff --git a/src/main/java/org/jabref/logic/cleanup/RenamePdfCleanup.java b/src/main/java/org/jabref/logic/cleanup/RenamePdfCleanup.java index a62a616da41..c9d04e14596 100644 --- a/src/main/java/org/jabref/logic/cleanup/RenamePdfCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/RenamePdfCleanup.java @@ -9,12 +9,11 @@ import org.jabref.logic.externalfiles.LinkedFileHandler; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.OptionalUtil; +import org.jabref.preferences.FilePreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java b/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java index 188dc80d060..721cea7d883 100644 --- a/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java @@ -6,10 +6,9 @@ import java.util.List; import java.util.Map; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java b/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java index f848f4edaa3..7a7aac978e8 100644 --- a/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java +++ b/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java @@ -25,12 +25,12 @@ import org.jabref.logic.bibtex.comparator.FieldComparatorStack; import org.jabref.logic.bibtex.comparator.IdComparator; import org.jabref.logic.citationkeypattern.CitationKeyGenerator; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; +import org.jabref.logic.cleanup.NormalizeNewlinesFormatter; import org.jabref.logic.formatter.bibtexfields.TrimWhitespaceFormatter; import org.jabref.model.FieldChange; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; -import org.jabref.model.cleanup.NormalizeNewlinesFormatter; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; diff --git a/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java b/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java index befd11f3648..b43af7288f2 100644 --- a/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java +++ b/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java @@ -7,10 +7,10 @@ import java.util.Map; import java.util.TreeMap; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.util.OS; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.entry.types.EntryType; import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.metadata.ContentSelector; diff --git a/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java b/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java index 2640f45ae79..6c1c280ff38 100644 --- a/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java +++ b/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java @@ -13,8 +13,8 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.FileHelper; +import org.jabref.preferences.FilePreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/formatter/Formatters.java b/src/main/java/org/jabref/logic/formatter/Formatters.java index 405c854a1ec..a97c3a85235 100644 --- a/src/main/java/org/jabref/logic/formatter/Formatters.java +++ b/src/main/java/org/jabref/logic/formatter/Formatters.java @@ -7,6 +7,7 @@ import java.util.Optional; import java.util.regex.Pattern; +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.EscapeAmpersandsFormatter; @@ -32,7 +33,6 @@ import org.jabref.logic.formatter.minifier.MinifyNameListFormatter; import org.jabref.logic.formatter.minifier.TruncateFormatter; import org.jabref.logic.layout.format.LatexToUnicodeFormatter; -import org.jabref.model.cleanup.Formatter; public class Formatters { private static final Pattern TRUNCATE_PATTERN = Pattern.compile("\\Atruncate\\d+\\z"); diff --git a/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java b/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java index 23cf683c283..c5f63de22fa 100644 --- a/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/IdentityFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * It may seem useless, but is needed as a fallback option diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java index 7c1e03c2215..3d787e1f28b 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class AddBracesFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java index ac5bbf13b3f..6f480ac40e1 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatter.java @@ -5,8 +5,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java index c2ace6a7295..ec54760965b 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/ClearFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class ClearFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java index 75f08042b90..e7854336d7a 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeAmpersandsFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class EscapeAmpersandsFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java index a0dbd78195b..8a5a3c1a3b4 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/EscapeUnderscoresFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class EscapeUnderscoresFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java index a526b637281..33faf96345b 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatter.java @@ -5,10 +5,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.HTMLUnicodeConversionMaps; -import org.jabref.model.cleanup.Formatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java index c5d7dafa01f..5ff4e95bb71 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java @@ -1,9 +1,9 @@ package org.jabref.logic.formatter.bibtexfields; import org.jabref.architecture.ApacheCommonsLang3Allowed; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; -import org.jabref.model.cleanup.Formatter; import org.apache.commons.lang3.StringEscapeUtils; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java index 20dc360ba0f..5415156bb7b 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java @@ -2,8 +2,8 @@ import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Simplifies LaTeX syntax. {@see org.jabref.logic.layout.format.RemoveLatexCommandsFormatter} for a formatter removing LaTeX commands completely. diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java index 2ef6cb3dab3..385b36996ca 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatter.java @@ -2,8 +2,8 @@ import java.util.Optional; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.Date; /** diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java index cb50cc6a10d..41fb5e5cd5d 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.bibtexfields; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class NormalizeEnDashesFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java index 2e71be8ea24..5dcc74847d2 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.Optional; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.Month; public class NormalizeMonthFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java index 8ef592833fa..10383eb983d 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.AuthorList; /** diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java index 7829a0c928b..ff0d6d7028e 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java @@ -4,8 +4,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import com.google.common.base.Strings; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java index d5b9506c2bc..ff30823e416 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatter.java @@ -4,8 +4,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * This class transforms ordinal numbers into LaTeX superscripts. diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java index 1cd72c31660..0fdb4166e3e 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RegexFormatter.java @@ -6,8 +6,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class RegexFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatter.java index 11cf48722b1..fdbc4f21d09 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class RemoveBracesFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java index 3f27e81aa8c..124b7dc8907 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class RemoveDigitsFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java index c05786154cc..b31099fcc1a 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Removes all hyphenated line breaks in the string. diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java index b4a8dabc04f..8f24a0aee0e 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Removes all line breaks in the string. diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java index 0a44f6f09fe..6cdd0ff373b 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatter.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Finds any occurrence of consecutive spaces and replaces it with a single space diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java index f6f5bd5eaa3..3d42f46a68c 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormater.java @@ -3,8 +3,8 @@ import java.util.Objects; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Replaces any tab with a space diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java index e689cc962da..5393210ec7d 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatter.java @@ -2,10 +2,10 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.importer.util.ShortDOIService; import org.jabref.logic.importer.util.ShortDOIServiceException; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.identifier.DOI; import org.slf4j.Logger; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java index 6fefcb15b40..da83f421c63 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Trim all whitespace characters(defined in java) in the string. diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java index 41147892971..cc5fc9f350e 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnicodeToLatexFormatter.java @@ -3,10 +3,10 @@ import java.util.Map; import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.HTMLUnicodeConversionMaps; -import org.jabref.model.cleanup.Formatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java index 140d8966b83..2f9413f9296 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java @@ -6,9 +6,9 @@ import java.util.List; import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.strings.StringLengthComparator; -import org.jabref.model.cleanup.Formatter; public class UnitsToLatexFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java index bf225dcf80d..01a7a6d5fc2 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.casechanger; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class CapitalizeFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java index 239b35f8712..f608994fcf7 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.casechanger; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class LowerCaseFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java index c0b7c81612e..19280858b36 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatter.java @@ -3,10 +3,10 @@ import java.util.List; import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.protectedterms.ProtectedTermsLoader; import org.jabref.logic.util.strings.StringLengthComparator; -import org.jabref.model.cleanup.Formatter; public class ProtectTermsFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java index ab6098c44d2..3697f48d653 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.casechanger; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class SentenceCaseFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java index 3d0f8e0c819..e70fd3a97fa 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.casechanger; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class TitleCaseFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java b/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java index 6b743d7acf7..59f7e737f85 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatter.java @@ -1,7 +1,7 @@ package org.jabref.logic.formatter.casechanger; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class UpperCaseFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java b/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java index 136f8a38a39..0c2ccd0ed5e 100644 --- a/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; /** * Replaces three or more authors with and others diff --git a/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java b/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java index 200fcf3e867..07930cd2064 100644 --- a/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java @@ -2,8 +2,8 @@ import java.util.Objects; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.Formatter; public class TruncateFormatter extends Formatter { private final int TRUNCATE_AFTER; diff --git a/src/main/java/org/jabref/model/entry/AuthorListParser.java b/src/main/java/org/jabref/logic/importer/AuthorListParser.java similarity index 92% rename from src/main/java/org/jabref/model/entry/AuthorListParser.java rename to src/main/java/org/jabref/logic/importer/AuthorListParser.java index eca4ee598e9..25a11475f56 100644 --- a/src/main/java/org/jabref/model/entry/AuthorListParser.java +++ b/src/main/java/org/jabref/logic/importer/AuthorListParser.java @@ -1,4 +1,4 @@ -package org.jabref.model.entry; +package org.jabref.logic.importer; import java.util.ArrayList; import java.util.Arrays; @@ -10,6 +10,9 @@ import java.util.Optional; import java.util.Set; +import org.jabref.model.entry.Author; +import org.jabref.model.entry.AuthorList; + public class AuthorListParser { // Avoid partition where these values are contained @@ -25,19 +28,9 @@ public class AuthorListParser { private static final int OFFSET_TOKEN_TERM = 2; // Character -- token terminator (either " " or // "-") comma) - - // Token types (returned by getToken procedure) - private enum Token { - EOF, - AND, - COMMA, - WORD - } - // Constant HashSet containing names of TeX special characters private static final Set TEX_NAMES = Set.of( "aa", "ae", "l", "o", "oe", "i", "AA", "AE", "L", "O", "OE", "j"); - /** * the raw bibtex author/editor field */ @@ -64,6 +57,36 @@ private enum Token { */ private boolean tokenCase; + /** + * Builds a new array of strings with stringbuilder. Regarding to the name affixes. + * + * @return New string with correct seperation + */ + private static StringBuilder buildWithAffix(Collection indexArray, List nameList) { + StringBuilder stringBuilder = new StringBuilder(); + // avoidedTimes needs to be increased by the count of avoided terms for correct odd/even calculation + int avoidedTimes = 0; + for (int i = 0; i < nameList.size(); i++) { + if (indexArray.contains(i)) { + // We hit a name affix + stringBuilder.append(nameList.get(i)); + stringBuilder.append(','); + avoidedTimes++; + } else { + stringBuilder.append(nameList.get(i)); + if (((i + avoidedTimes) % 2) == 0) { + // Hit separation between last name and firstname --> comma has to be kept + stringBuilder.append(','); + } else { + // Hit separation between full names (e.g., Ali Babar, M. and Dingsøyr, T.) --> semicolon has to be used + // Will be treated correctly by AuthorList.parse(authors); + stringBuilder.append(';'); + } + } + } + return stringBuilder; + } + /** * Parses the String containing person names and returns a list of person information. * @@ -130,42 +153,10 @@ public AuthorList parse(String listOfNames) { return new AuthorList(authors); } - /** - * Builds a new array of strings with stringbuilder. - * Regarding to the name affixes. - * - * @return New string with correct seperation - */ - private static StringBuilder buildWithAffix(Collection indexArray, List nameList) { - StringBuilder stringBuilder = new StringBuilder(); - // avoidedTimes needs to be increased by the count of avoided terms for correct odd/even calculation - int avoidedTimes = 0; - for (int i = 0; i < nameList.size(); i++) { - if (indexArray.contains(i)) { - // We hit a name affix - stringBuilder.append(nameList.get(i)); - stringBuilder.append(','); - avoidedTimes++; - } else { - stringBuilder.append(nameList.get(i)); - if (((i + avoidedTimes) % 2) == 0) { - // Hit separation between last name and firstname --> comma has to be kept - stringBuilder.append(','); - } else { - // Hit separation between full names (e.g., Ali Babar, M. and Dingsøyr, T.) --> semicolon has to be used - // Will be treated correctly by AuthorList.parse(authors); - stringBuilder.append(';'); - } - } - } - return stringBuilder; - } - /** * Parses one author name and returns preformatted information. * - * @return Preformatted author name; Optional.empty() if author name is - * empty. + * @return Preformatted author name; Optional.empty() if author name is empty. */ private Optional getAuthor() { List tokens = new ArrayList<>(); // initialization @@ -337,13 +328,13 @@ private Optional getAuthor() { } /** - * Concatenates list of tokens from 'tokens' Vector. Tokens are separated by - * spaces or dashes, depending on stored in 'tokens'. Callers always ensure - * that start < end; thus, there exists at least one token to be - * concatenated. + * Concatenates list of tokens from 'tokens' Vector. Tokens are separated by spaces or dashes, depending on stored + * in 'tokens'. Callers always ensure that start < end; thus, there exists at least one token to be concatenated. * - * @param start index of the first token to be concatenated in 'tokens' Vector (always divisible by TOKEN_GROUP_LENGTH). - * @param end index of the first token not to be concatenated in 'tokens' Vector (always divisible by TOKEN_GROUP_LENGTH). + * @param start index of the first token to be concatenated in 'tokens' Vector (always divisible by + * TOKEN_GROUP_LENGTH). + * @param end index of the first token not to be concatenated in 'tokens' Vector (always divisible by + * TOKEN_GROUP_LENGTH). * @param offset offset within token group (used to request concatenation of either full tokens or abbreviation). * @param dotAfter true -- add period after each token, false -- * do not add. @@ -371,27 +362,24 @@ private String concatTokens(List tokens, int start, int end, int offset, /** * Parses the next token. *

- * The string being parsed is stored in global variable original, - * and position which parsing has to start from is stored in global variable + * The string being parsed is stored in global variable original, and position which parsing has to + * start from is stored in global variable * token_end; thus, token_end has to be set - * to 0 before the first invocation. Procedure updates token_end; - * thus, subsequent invocations do not require any additional variable - * settings. + * to 0 before the first invocation. Procedure updates token_end; thus, subsequent invocations do not + * require any additional variable settings. *

- * The type of the token is returned; if it is Token.WORD, - * additional information is given in global variables token_start, + * The type of the token is returned; if it is Token.WORD, additional information is given in global + * variables token_start, * token_end, token_abbr, token_term, - * and token_case; namely: original.substring(token_start,token_end) - * is the text of the token, original.substring(token_start,token_abbr) - * is the token abbreviation, token_term contains token - * terminator (space or dash), and token_case is true, - * if token is upper-case and false if token is lower-case. + * and token_case; namely: original.substring(token_start,token_end) is the text of the + * token, original.substring(token_start,token_abbr) is the token abbreviation, token_term + * contains token terminator (space or dash), and token_case is true, if token is + * upper-case and false if token is lower-case. * * @return Token.EOF -- no more tokens, Token.COMMA -- - * token is comma, Token.AND -- token is the word - * "and" (or "And", or "aND", etc.) or a semicolon, Token.WORD -- - * token is a word; additional information is given in global - * variables token_start, token_end, + * token is comma, Token.AND -- token is the word "and" (or "And", or "aND", etc.) or a semicolon, + * Token.WORD -- token is a word; additional information is given in global variables + * token_start, token_end, * token_abbr, token_term, and * token_case. */ @@ -476,4 +464,12 @@ private Token getToken() { return Token.WORD; } } + + // Token types (returned by getToken procedure) + private enum Token { + EOF, + AND, + COMMA, + WORD + } } diff --git a/src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java b/src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java index 5297d5ad1d2..48348c8f582 100644 --- a/src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java +++ b/src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Objects; -import org.jabref.model.cleanup.Formatter; +import org.jabref.logic.cleanup.Formatter; import org.jabref.model.entry.BibEntry; /** diff --git a/src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java b/src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java index 56547e303d0..bf3ba431063 100644 --- a/src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java +++ b/src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Optional; -import org.jabref.model.cleanup.Formatter; +import org.jabref.logic.cleanup.Formatter; import org.jabref.model.entry.BibEntry; import org.jabref.model.strings.StringUtil; diff --git a/src/main/java/org/jabref/logic/importer/IdParserFetcher.java b/src/main/java/org/jabref/logic/importer/IdParserFetcher.java index 26d67a8e190..bf4b2bb32b9 100644 --- a/src/main/java/org/jabref/logic/importer/IdParserFetcher.java +++ b/src/main/java/org/jabref/logic/importer/IdParserFetcher.java @@ -11,7 +11,7 @@ import java.util.Objects; import java.util.Optional; -import org.jabref.model.cleanup.Formatter; +import org.jabref.logic.cleanup.Formatter; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.identifier.Identifier; diff --git a/src/main/java/org/jabref/logic/importer/SearchBasedParserFetcher.java b/src/main/java/org/jabref/logic/importer/SearchBasedParserFetcher.java index 1e403a4829d..e8b40c963ad 100644 --- a/src/main/java/org/jabref/logic/importer/SearchBasedParserFetcher.java +++ b/src/main/java/org/jabref/logic/importer/SearchBasedParserFetcher.java @@ -8,8 +8,8 @@ import java.util.Collections; import java.util.List; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.importer.fetcher.ComplexSearchQuery; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.BibEntry; import org.jabref.model.strings.StringUtil; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java index a1253589ce7..8b9da62ff09 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java @@ -12,6 +12,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.cleanup.MoveFieldCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; @@ -29,7 +30,6 @@ import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.net.URLDownload; import org.jabref.logic.util.BuildInfo; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java b/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java index 77c386a75be..1b51cf04b00 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java @@ -12,6 +12,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.formatter.bibtexfields.HtmlToUnicodeFormatter; import org.jabref.logic.formatter.casechanger.TitleCaseFormatter; import org.jabref.logic.help.HelpFile; @@ -20,8 +22,6 @@ import org.jabref.logic.importer.SearchBasedParserFetcher; import org.jabref.logic.importer.fileformat.CoinsParser; import org.jabref.logic.util.OS; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcher.java index 0d3b58e2847..3bcbd26a2fb 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcher.java @@ -5,6 +5,7 @@ import java.net.URL; import java.util.Arrays; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.RemoveDigitsFormatter; import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter; import org.jabref.logic.formatter.bibtexfields.RemoveRedundantSpacesFormatter; @@ -13,7 +14,6 @@ import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.logic.importer.Parser; import org.jabref.logic.importer.SearchBasedParserFetcher; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java b/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java index 6eb3d8d07db..fc7603ecd5f 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter; import org.jabref.logic.importer.EntryBasedParserFetcher; @@ -19,7 +20,6 @@ import org.jabref.logic.importer.SearchBasedParserFetcher; import org.jabref.logic.importer.util.JsonReader; import org.jabref.logic.util.strings.StringSimilarity; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.AuthorList; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java index b8daa91975a..cb223ce061d 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java @@ -8,6 +8,8 @@ import java.util.Optional; import org.jabref.logic.cleanup.DoiCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.help.HelpFile; import org.jabref.logic.importer.FetcherException; @@ -17,8 +19,6 @@ import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.layout.LayoutFormatterBasedFormatter; import org.jabref.logic.layout.format.RemoveLatexCommandsFormatter; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.util.DummyFileUpdateMonitor; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java index b22f73f496e..ae1e3ab5961 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; import org.jabref.logic.help.HelpFile; @@ -18,7 +19,6 @@ import org.jabref.logic.importer.util.MediaTypes; import org.jabref.logic.l10n.Localization; import org.jabref.logic.net.URLDownload; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.identifier.DOI; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java index 69ef0a86fdc..bc571309d93 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java @@ -5,6 +5,7 @@ import java.net.URL; import java.util.Optional; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter; import org.jabref.logic.help.HelpFile; @@ -15,7 +16,6 @@ import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.importer.util.MediaTypes; import org.jabref.logic.net.URLDownload; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcher.java index fa9c7b74e9a..a83f04e39af 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcher.java @@ -4,11 +4,11 @@ import java.net.URISyntaxException; import java.net.URL; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; import org.jabref.logic.importer.FetcherException; import org.jabref.logic.importer.ImportFormatPreferences; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MathSciNet.java b/src/main/java/org/jabref/logic/importer/fetcher/MathSciNet.java index f8085c6afe9..3ff0bd243b8 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MathSciNet.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MathSciNet.java @@ -14,6 +14,7 @@ import java.util.stream.Collectors; import org.jabref.logic.cleanup.DoiCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.cleanup.MoveFieldCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.importer.EntryBasedParserFetcher; @@ -24,7 +25,6 @@ import org.jabref.logic.importer.SearchBasedParserFetcher; import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.util.OS; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java index 5b1017b5d52..0050bc1fbf7 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java @@ -19,6 +19,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter; @@ -30,7 +31,6 @@ import org.jabref.logic.importer.SearchBasedFetcher; import org.jabref.logic.importer.fileformat.MedlineImporter; import org.jabref.logic.l10n.Localization; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/ZbMATH.java b/src/main/java/org/jabref/logic/importer/fetcher/ZbMATH.java index 4ef889a7f34..75cd901c667 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/ZbMATH.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/ZbMATH.java @@ -5,6 +5,7 @@ import java.net.URL; import java.util.Objects; +import org.jabref.logic.cleanup.FieldFormatterCleanup; import org.jabref.logic.cleanup.MoveFieldCleanup; import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter; import org.jabref.logic.importer.FetcherException; @@ -13,7 +14,6 @@ import org.jabref.logic.importer.SearchBasedParserFetcher; import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.net.URLDownload; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; diff --git a/src/main/java/org/jabref/model/entry/FileFieldParser.java b/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java similarity index 96% rename from src/main/java/org/jabref/model/entry/FileFieldParser.java rename to src/main/java/org/jabref/logic/importer/util/FileFieldParser.java index 86ac1b2c443..3f00ab57f62 100644 --- a/src/main/java/org/jabref/model/entry/FileFieldParser.java +++ b/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java @@ -1,8 +1,10 @@ -package org.jabref.model.entry; +package org.jabref.logic.importer.util; import java.util.ArrayList; import java.util.List; +import org.jabref.model.entry.LinkedFile; + public class FileFieldParser { public static List parse(String value) { diff --git a/src/main/java/org/jabref/logic/integrity/FieldCheckers.java b/src/main/java/org/jabref/logic/integrity/FieldCheckers.java index de3461050db..e2b27412010 100644 --- a/src/main/java/org/jabref/logic/integrity/FieldCheckers.java +++ b/src/main/java/org/jabref/logic/integrity/FieldCheckers.java @@ -10,7 +10,7 @@ import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; diff --git a/src/main/java/org/jabref/logic/integrity/FileChecker.java b/src/main/java/org/jabref/logic/integrity/FileChecker.java index a4b242744c0..70d4fc6a568 100644 --- a/src/main/java/org/jabref/logic/integrity/FileChecker.java +++ b/src/main/java/org/jabref/logic/integrity/FileChecker.java @@ -6,12 +6,12 @@ import java.util.Optional; import java.util.stream.Collectors; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.logic.l10n.Localization; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.entry.FileFieldParser; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.strings.StringUtil; +import org.jabref.preferences.FilePreferences; public class FileChecker implements ValueChecker { diff --git a/src/main/java/org/jabref/logic/integrity/IntegrityCheck.java b/src/main/java/org/jabref/logic/integrity/IntegrityCheck.java index 58f38dc674b..d37264b9a24 100644 --- a/src/main/java/org/jabref/logic/integrity/IntegrityCheck.java +++ b/src/main/java/org/jabref/logic/integrity/IntegrityCheck.java @@ -9,7 +9,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; public class IntegrityCheck { diff --git a/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java b/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java index 72762fc8142..e5bc6682a26 100644 --- a/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java +++ b/src/main/java/org/jabref/logic/layout/LayoutFormatterBasedFormatter.java @@ -1,9 +1,9 @@ package org.jabref.logic.layout; -import org.jabref.model.cleanup.Formatter; +import org.jabref.logic.cleanup.Formatter; /** - * When having to use a LayoutFormatter as Formatter, this class is helpful. One usecase is {@link org.jabref.model.cleanup.FieldFormatterCleanup} + * When having to use a LayoutFormatter as Formatter, this class is helpful. One usecase is {@link org.jabref.logic.cleanup.FieldFormatterCleanup} */ public class LayoutFormatterBasedFormatter extends Formatter { diff --git a/src/main/java/org/jabref/logic/layout/format/FileLink.java b/src/main/java/org/jabref/logic/layout/format/FileLink.java index aa3352a83de..384d9544f75 100644 --- a/src/main/java/org/jabref/logic/layout/format/FileLink.java +++ b/src/main/java/org/jabref/logic/layout/format/FileLink.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.stream.Collectors; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.logic.layout.ParamLayoutFormatter; -import org.jabref.model.entry.FileFieldParser; import org.jabref.model.entry.LinkedFile; /** diff --git a/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java b/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java index 920b3a67ec7..d0d40370cd3 100644 --- a/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java +++ b/src/main/java/org/jabref/logic/layout/format/LatexToUnicodeFormatter.java @@ -1,8 +1,8 @@ package org.jabref.logic.layout.format; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; -import org.jabref.model.cleanup.Formatter; import org.jabref.model.strings.LatexToUnicodeAdapter; /** diff --git a/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java b/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java index 5afa3bc90fc..0824258087b 100644 --- a/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java +++ b/src/main/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatter.java @@ -4,10 +4,10 @@ import java.util.Map; import java.util.regex.Pattern; +import org.jabref.logic.cleanup.Formatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatter; import org.jabref.logic.util.strings.UnicodeLigaturesMap; -import org.jabref.model.cleanup.Formatter; public class ReplaceUnicodeLigaturesFormatter extends Formatter implements LayoutFormatter { diff --git a/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java b/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java index 8157efa9814..a7c44a2a795 100644 --- a/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java +++ b/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java @@ -8,8 +8,8 @@ import java.util.Map; import java.util.stream.Collectors; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.logic.layout.AbstractParamLayoutFormatter; -import org.jabref.model.entry.FileFieldParser; import org.jabref.model.entry.LinkedFile; import org.jabref.model.util.FileHelper; diff --git a/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java b/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java index 29537801f4a..e6d6c09beb7 100644 --- a/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java +++ b/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java @@ -9,8 +9,8 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.pdf.FileAnnotation; +import org.jabref.preferences.FilePreferences; /** * Here all PDF files attached to a BibEntry are scanned for annotations using a PdfAnnotationImporter. diff --git a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java index 86a3c29b53f..aa3f43f6fb0 100644 --- a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java +++ b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java @@ -6,8 +6,8 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.pdf.FileAnnotation; +import org.jabref.preferences.FilePreferences; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/src/main/java/org/jabref/logic/shared/DBMSConnection.java b/src/main/java/org/jabref/logic/shared/DBMSConnection.java index b137a5cd8b6..a37f1d9532d 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSConnection.java +++ b/src/main/java/org/jabref/logic/shared/DBMSConnection.java @@ -8,8 +8,6 @@ import org.jabref.logic.l10n.Localization; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; -import org.jabref.model.database.shared.DBMSType; -import org.jabref.model.database.shared.DatabaseConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/shared/DBMSConnectionProperties.java b/src/main/java/org/jabref/logic/shared/DBMSConnectionProperties.java index e6d6a68ff43..c41c19d6167 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSConnectionProperties.java +++ b/src/main/java/org/jabref/logic/shared/DBMSConnectionProperties.java @@ -8,8 +8,6 @@ import org.jabref.logic.shared.prefs.SharedDatabasePreferences; import org.jabref.logic.shared.security.Password; -import org.jabref.model.database.shared.DBMSType; -import org.jabref.model.database.shared.DatabaseConnectionProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/shared/DBMSConnectionPropertiesBuilder.java b/src/main/java/org/jabref/logic/shared/DBMSConnectionPropertiesBuilder.java index 35e01f6e7f7..3547358dee8 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSConnectionPropertiesBuilder.java +++ b/src/main/java/org/jabref/logic/shared/DBMSConnectionPropertiesBuilder.java @@ -1,7 +1,5 @@ package org.jabref.logic.shared; -import org.jabref.model.database.shared.DBMSType; - public class DBMSConnectionPropertiesBuilder { private DBMSType type; private String host; diff --git a/src/main/java/org/jabref/logic/shared/DBMSProcessor.java b/src/main/java/org/jabref/logic/shared/DBMSProcessor.java index 08ad86646ba..539ac974e61 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSProcessor.java +++ b/src/main/java/org/jabref/logic/shared/DBMSProcessor.java @@ -19,9 +19,6 @@ import java.util.stream.Collectors; import org.jabref.logic.shared.exception.OfflineLockException; -import org.jabref.model.database.shared.DBMSType; -import org.jabref.model.database.shared.DatabaseConnection; -import org.jabref.model.database.shared.DatabaseConnectionProperties; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.SharedBibEntryData; import org.jabref.model.entry.event.EntriesEventSource; diff --git a/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java b/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java index d46925ec5a3..9aefa1049bb 100644 --- a/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java +++ b/src/main/java/org/jabref/logic/shared/DBMSSynchronizer.java @@ -10,6 +10,7 @@ import java.util.Set; import java.util.stream.Collectors; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.logic.exporter.BibDatabaseWriter; import org.jabref.logic.exporter.MetaDataSerializer; import org.jabref.logic.importer.ParseException; @@ -18,15 +19,10 @@ import org.jabref.logic.shared.event.SharedEntriesNotPresentEvent; import org.jabref.logic.shared.event.UpdateRefusedEvent; import org.jabref.logic.shared.exception.OfflineLockException; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.event.EntriesAddedEvent; import org.jabref.model.database.event.EntriesRemovedEvent; -import org.jabref.model.database.shared.DatabaseConnection; -import org.jabref.model.database.shared.DatabaseConnectionProperties; -import org.jabref.model.database.shared.DatabaseNotSupportedException; -import org.jabref.model.database.shared.DatabaseSynchronizer; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.event.EntriesEvent; import org.jabref.model.entry.event.EntriesEventSource; diff --git a/src/main/java/org/jabref/model/database/shared/DBMSType.java b/src/main/java/org/jabref/logic/shared/DBMSType.java similarity index 97% rename from src/main/java/org/jabref/model/database/shared/DBMSType.java rename to src/main/java/org/jabref/logic/shared/DBMSType.java index cdf71b12449..c054f82f7aa 100644 --- a/src/main/java/org/jabref/model/database/shared/DBMSType.java +++ b/src/main/java/org/jabref/logic/shared/DBMSType.java @@ -1,4 +1,4 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; import java.util.Arrays; import java.util.Optional; @@ -24,6 +24,10 @@ private DBMSType(String type, String driverPath, String urlPattern, int defaultP this.defaultPort = defaultPort; } + public static Optional fromString(String typeName) { + return Arrays.stream(DBMSType.values()).filter(dbmsType -> dbmsType.type.equalsIgnoreCase(typeName)).findAny(); + } + @Override public String toString() { return this.type; @@ -49,8 +53,4 @@ public String getUrl(String host, int port, String database) { public int getDefaultPort() { return this.defaultPort; } - - public static Optional fromString(String typeName) { - return Arrays.stream(DBMSType.values()).filter(dbmsType -> dbmsType.type.equalsIgnoreCase(typeName)).findAny(); - } } diff --git a/src/main/java/org/jabref/model/database/shared/DatabaseConnection.java b/src/main/java/org/jabref/logic/shared/DatabaseConnection.java similarity index 78% rename from src/main/java/org/jabref/model/database/shared/DatabaseConnection.java rename to src/main/java/org/jabref/logic/shared/DatabaseConnection.java index 5f1507d3798..265d534a9a3 100644 --- a/src/main/java/org/jabref/model/database/shared/DatabaseConnection.java +++ b/src/main/java/org/jabref/logic/shared/DatabaseConnection.java @@ -1,4 +1,4 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; import java.sql.Connection; diff --git a/src/main/java/org/jabref/model/database/shared/DatabaseConnectionProperties.java b/src/main/java/org/jabref/logic/shared/DatabaseConnectionProperties.java similarity index 89% rename from src/main/java/org/jabref/model/database/shared/DatabaseConnectionProperties.java rename to src/main/java/org/jabref/logic/shared/DatabaseConnectionProperties.java index 95a2b33cb30..6c3d44313a9 100644 --- a/src/main/java/org/jabref/model/database/shared/DatabaseConnectionProperties.java +++ b/src/main/java/org/jabref/logic/shared/DatabaseConnectionProperties.java @@ -1,4 +1,4 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; public interface DatabaseConnectionProperties { diff --git a/src/main/java/org/jabref/model/database/shared/DatabaseLocation.java b/src/main/java/org/jabref/logic/shared/DatabaseLocation.java similarity index 81% rename from src/main/java/org/jabref/model/database/shared/DatabaseLocation.java rename to src/main/java/org/jabref/logic/shared/DatabaseLocation.java index 1356b065c7d..836384bdd1e 100644 --- a/src/main/java/org/jabref/model/database/shared/DatabaseLocation.java +++ b/src/main/java/org/jabref/logic/shared/DatabaseLocation.java @@ -1,4 +1,4 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; import org.jabref.model.database.BibDatabaseContext; diff --git a/src/main/java/org/jabref/model/database/shared/DatabaseNotSupportedException.java b/src/main/java/org/jabref/logic/shared/DatabaseNotSupportedException.java similarity index 68% rename from src/main/java/org/jabref/model/database/shared/DatabaseNotSupportedException.java rename to src/main/java/org/jabref/logic/shared/DatabaseNotSupportedException.java index bd652ae5865..cb7427bd42d 100644 --- a/src/main/java/org/jabref/model/database/shared/DatabaseNotSupportedException.java +++ b/src/main/java/org/jabref/logic/shared/DatabaseNotSupportedException.java @@ -1,7 +1,8 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; /** - * This exception is thrown in case that the SQL database structure is not compatible with the current shared database support mechanisms. + * This exception is thrown in case that the SQL database structure is not compatible with the current shared database + * support mechanisms. */ public class DatabaseNotSupportedException extends Exception { diff --git a/src/main/java/org/jabref/model/database/shared/DatabaseSynchronizer.java b/src/main/java/org/jabref/logic/shared/DatabaseSynchronizer.java similarity index 91% rename from src/main/java/org/jabref/model/database/shared/DatabaseSynchronizer.java rename to src/main/java/org/jabref/logic/shared/DatabaseSynchronizer.java index 5a9906045a6..1d30d31bfc6 100644 --- a/src/main/java/org/jabref/model/database/shared/DatabaseSynchronizer.java +++ b/src/main/java/org/jabref/logic/shared/DatabaseSynchronizer.java @@ -1,4 +1,4 @@ -package org.jabref.model.database.shared; +package org.jabref.logic.shared; import org.jabref.model.entry.BibEntry; diff --git a/src/main/java/org/jabref/logic/shared/MySQLProcessor.java b/src/main/java/org/jabref/logic/shared/MySQLProcessor.java index b4a350e2fee..bdac07e5fa0 100644 --- a/src/main/java/org/jabref/logic/shared/MySQLProcessor.java +++ b/src/main/java/org/jabref/logic/shared/MySQLProcessor.java @@ -2,8 +2,6 @@ import java.sql.SQLException; -import org.jabref.model.database.shared.DatabaseConnection; - /** * Processes all incoming or outgoing bib data to MySQL Database and manages its structure. */ diff --git a/src/main/java/org/jabref/logic/shared/OracleProcessor.java b/src/main/java/org/jabref/logic/shared/OracleProcessor.java index 868f08a2220..9c4a8401525 100644 --- a/src/main/java/org/jabref/logic/shared/OracleProcessor.java +++ b/src/main/java/org/jabref/logic/shared/OracleProcessor.java @@ -10,7 +10,6 @@ import java.util.stream.Collectors; import org.jabref.logic.shared.listener.OracleNotificationListener; -import org.jabref.model.database.shared.DatabaseConnection; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; diff --git a/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java b/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java index 74ff626405e..6cab1a56ea9 100644 --- a/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java +++ b/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java @@ -8,7 +8,6 @@ import org.jabref.JabRefExecutorService; import org.jabref.logic.shared.listener.PostgresSQLNotificationListener; -import org.jabref.model.database.shared.DatabaseConnection; import org.jabref.model.entry.BibEntry; import org.postgresql.PGConnection; diff --git a/src/main/java/org/jabref/logic/shared/prefs/SharedDatabasePreferences.java b/src/main/java/org/jabref/logic/shared/prefs/SharedDatabasePreferences.java index 45346f334a2..d3b6bbb5770 100644 --- a/src/main/java/org/jabref/logic/shared/prefs/SharedDatabasePreferences.java +++ b/src/main/java/org/jabref/logic/shared/prefs/SharedDatabasePreferences.java @@ -7,8 +7,8 @@ import java.util.prefs.Preferences; import org.jabref.JabRefMain; +import org.jabref.logic.shared.DatabaseConnectionProperties; import org.jabref.logic.shared.security.Password; -import org.jabref.model.database.shared.DatabaseConnectionProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java b/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java index 60972fba036..fd790491fe2 100644 --- a/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java +++ b/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java @@ -16,7 +16,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jabref.model.texparser.LatexParser; import org.jabref.model.texparser.LatexParserResult; import org.slf4j.Logger; diff --git a/src/main/java/org/jabref/model/texparser/LatexParser.java b/src/main/java/org/jabref/logic/texparser/LatexParser.java similarity index 90% rename from src/main/java/org/jabref/model/texparser/LatexParser.java rename to src/main/java/org/jabref/logic/texparser/LatexParser.java index 36526ed6ae5..9c64ff9a810 100644 --- a/src/main/java/org/jabref/model/texparser/LatexParser.java +++ b/src/main/java/org/jabref/logic/texparser/LatexParser.java @@ -1,8 +1,10 @@ -package org.jabref.model.texparser; +package org.jabref.logic.texparser; import java.nio.file.Path; import java.util.List; +import org.jabref.model.texparser.LatexParserResult; + /** * Parses a LaTeX file */ diff --git a/src/main/java/org/jabref/model/database/event/CoarseChangeFilter.java b/src/main/java/org/jabref/logic/util/CoarseChangeFilter.java similarity index 96% rename from src/main/java/org/jabref/model/database/event/CoarseChangeFilter.java rename to src/main/java/org/jabref/logic/util/CoarseChangeFilter.java index d41e0b41b74..9c7a7236a3a 100644 --- a/src/main/java/org/jabref/model/database/event/CoarseChangeFilter.java +++ b/src/main/java/org/jabref/logic/util/CoarseChangeFilter.java @@ -1,9 +1,9 @@ -package org.jabref.model.database.event; +package org.jabref.logic.util; import java.util.Optional; -import org.jabref.logic.util.DelayTaskThrottler; import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.database.event.BibDatabaseContextChangedEvent; import org.jabref.model.entry.event.FieldChangedEvent; import org.jabref.model.entry.field.Field; diff --git a/src/main/java/org/jabref/logic/util/io/DatabaseFileLookup.java b/src/main/java/org/jabref/logic/util/io/DatabaseFileLookup.java index becce9fc6d5..d8e5c0f0265 100644 --- a/src/main/java/org/jabref/logic/util/io/DatabaseFileLookup.java +++ b/src/main/java/org/jabref/logic/util/io/DatabaseFileLookup.java @@ -13,7 +13,7 @@ import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; /** * Search class for files.
diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 6d9d81f5d76..e294e7efe02 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -18,7 +18,7 @@ import org.jabref.JabRefMain; import org.jabref.gui.maintable.ColumnPreferences; import org.jabref.gui.maintable.MainTableColumnModel; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.model.entry.field.SpecialField; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.types.EntryTypeFactory; diff --git a/src/main/java/org/jabref/model/database/BibDatabaseContext.java b/src/main/java/org/jabref/model/database/BibDatabaseContext.java index 20d3c85ddbb..9c3c76ff593 100644 --- a/src/main/java/org/jabref/model/database/BibDatabaseContext.java +++ b/src/main/java/org/jabref/model/database/BibDatabaseContext.java @@ -8,17 +8,19 @@ import java.util.Optional; import java.util.stream.Collectors; -import org.jabref.model.database.event.CoarseChangeFilter; -import org.jabref.model.database.shared.DatabaseLocation; -import org.jabref.model.database.shared.DatabaseSynchronizer; +import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.logic.shared.DatabaseLocation; +import org.jabref.logic.shared.DatabaseSynchronizer; +import org.jabref.logic.util.CoarseChangeFilter; import org.jabref.model.entry.BibEntry; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; /** * Represents everything related to a BIB file.

The entries are stored in BibDatabase, the other data in MetaData * and the options relevant for this file in Defaults. */ +@AllowedToUseLogic("because it needs access to shared database features") public class BibDatabaseContext { private final BibDatabase database; diff --git a/src/main/java/org/jabref/model/entry/AuthorList.java b/src/main/java/org/jabref/model/entry/AuthorList.java index 4f2467da8f9..b432088070c 100644 --- a/src/main/java/org/jabref/model/entry/AuthorList.java +++ b/src/main/java/org/jabref/model/entry/AuthorList.java @@ -7,6 +7,8 @@ import java.util.WeakHashMap; import java.util.stream.Collectors; +import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.logic.importer.AuthorListParser; import org.jabref.model.strings.LatexToUnicodeAdapter; /** @@ -116,6 +118,7 @@ * K." * */ +@AllowedToUseLogic("because it needs access to AuthorList parser") public class AuthorList { private static final WeakHashMap AUTHOR_CACHE = new WeakHashMap<>(); @@ -142,11 +145,11 @@ public class AuthorList { * * @param authors the list of authors which should underlie this instance */ - protected AuthorList(List authors) { + public AuthorList(List authors) { this.authors = Objects.requireNonNull(authors); } - protected AuthorList(Author author) { + public AuthorList(Author author) { this(Collections.singletonList(author)); } diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index de6abdc1f8c..a4e0aeb131c 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -20,6 +20,9 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableMap; +import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.logic.bibtex.FileFieldWriter; +import org.jabref.logic.importer.util.FileFieldParser; import org.jabref.model.FieldChange; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.event.EntriesEventSource; @@ -49,6 +52,7 @@ *

* In case you search for a builder as described in Item 2 of the book "Effective Java", you won't find one. Please use the methods {@link #withCiteKey(String)} and {@link #withField(Field, String)}. */ +@AllowedToUseLogic("because it needs access to parser and writers") public class BibEntry implements Cloneable { public static final EntryType DEFAULT_TYPE = StandardEntryType.Misc; diff --git a/src/main/java/org/jabref/model/entry/LinkedFile.java b/src/main/java/org/jabref/model/entry/LinkedFile.java index d57c2d6b35a..8730ff13171 100644 --- a/src/main/java/org/jabref/model/entry/LinkedFile.java +++ b/src/main/java/org/jabref/model/entry/LinkedFile.java @@ -17,8 +17,8 @@ import javafx.beans.property.StringProperty; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.util.FileHelper; +import org.jabref.preferences.FilePreferences; /** * Represents the link to an external file (e.g. associated PDF file). diff --git a/src/main/java/org/jabref/model/groups/TexGroup.java b/src/main/java/org/jabref/model/groups/TexGroup.java index 63e35555352..03eb1a57903 100644 --- a/src/main/java/org/jabref/model/groups/TexGroup.java +++ b/src/main/java/org/jabref/model/groups/TexGroup.java @@ -8,8 +8,9 @@ import java.util.Objects; import java.util.Set; -import org.jabref.model.auxparser.AuxParser; -import org.jabref.model.auxparser.AuxParserResult; +import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.logic.auxparser.AuxParser; +import org.jabref.logic.auxparser.AuxParserResult; import org.jabref.model.entry.BibEntry; import org.jabref.model.metadata.MetaData; import org.jabref.model.util.FileHelper; @@ -19,6 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@AllowedToUseLogic("because it needs access to aux parser") public class TexGroup extends AbstractGroup implements FileUpdateListener { private static final Logger LOGGER = LoggerFactory.getLogger(TexGroup.class); diff --git a/src/main/java/org/jabref/model/metadata/MetaData.java b/src/main/java/org/jabref/model/metadata/MetaData.java index e1c409a22e8..cf6008e4ecb 100644 --- a/src/main/java/org/jabref/model/metadata/MetaData.java +++ b/src/main/java/org/jabref/model/metadata/MetaData.java @@ -9,10 +9,11 @@ import java.util.Objects; import java.util.Optional; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.DatabaseCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanups; +import org.jabref.architecture.AllowedToUseLogic; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; +import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.database.event.ChangePropagation; import org.jabref.model.entry.field.Field; @@ -25,6 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@AllowedToUseLogic("because it needs access to citation pattern and cleanups") public class MetaData { public static final String META_FLAG = "jabref-meta: "; diff --git a/src/main/java/org/jabref/model/util/FileHelper.java b/src/main/java/org/jabref/model/util/FileHelper.java index 61d7da7d263..f4ee0576cc8 100644 --- a/src/main/java/org/jabref/model/util/FileHelper.java +++ b/src/main/java/org/jabref/model/util/FileHelper.java @@ -12,7 +12,7 @@ import java.util.Optional; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import org.apache.tika.config.TikaConfig; import org.apache.tika.detect.Detector; diff --git a/src/main/java/org/jabref/model/metadata/FilePreferences.java b/src/main/java/org/jabref/preferences/FilePreferences.java similarity index 98% rename from src/main/java/org/jabref/model/metadata/FilePreferences.java rename to src/main/java/org/jabref/preferences/FilePreferences.java index 1868aa719b9..ebed675c1a0 100644 --- a/src/main/java/org/jabref/model/metadata/FilePreferences.java +++ b/src/main/java/org/jabref/preferences/FilePreferences.java @@ -1,4 +1,4 @@ -package org.jabref.model.metadata; +package org.jabref.preferences; import java.nio.file.Path; import java.util.Optional; diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 064683a3651..b8c79e9911a 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -59,11 +59,13 @@ import org.jabref.logic.bibtex.FieldContentFormatterPreferences; import org.jabref.logic.bibtex.FieldWriterPreferences; import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.logic.citationstyle.CitationStyle; import org.jabref.logic.citationstyle.CitationStylePreviewLayout; import org.jabref.logic.cleanup.CleanupPreferences; import org.jabref.logic.cleanup.CleanupPreset; import org.jabref.logic.cleanup.Cleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.exporter.SavePreferences; import org.jabref.logic.exporter.TemplateExporter; import org.jabref.logic.importer.ImportFormatPreferences; @@ -92,8 +94,6 @@ import org.jabref.logic.util.io.AutoLinkPreferences; import org.jabref.logic.util.io.FileHistory; import org.jabref.logic.xmp.XmpPreferences; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.BibEntryTypesManager; @@ -103,7 +103,6 @@ import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.EntryTypeFactory; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.SaveOrderConfig; import org.jabref.model.strings.StringUtil; diff --git a/src/main/java/org/jabref/preferences/PreferencesService.java b/src/main/java/org/jabref/preferences/PreferencesService.java index cc565990896..194090a683b 100644 --- a/src/main/java/org/jabref/preferences/PreferencesService.java +++ b/src/main/java/org/jabref/preferences/PreferencesService.java @@ -19,6 +19,7 @@ import org.jabref.logic.bibtex.FieldContentFormatterPreferences; import org.jabref.logic.bibtex.FieldWriterPreferences; import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.logic.cleanup.CleanupPreferences; import org.jabref.logic.cleanup.CleanupPreset; import org.jabref.logic.exporter.SavePreferences; @@ -38,12 +39,10 @@ import org.jabref.logic.util.io.AutoLinkPreferences; import org.jabref.logic.util.io.FileHistory; import org.jabref.logic.xmp.XmpPreferences; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.model.entry.field.Field; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.SaveOrderConfig; public interface PreferencesService { diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index ce83fbd0ec7..2062dbb8838 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -213,8 +213,6 @@ Default=Default Default\ encoding=Default encoding -Default\ grouping\ field=Default grouping field - Downloading=Downloading Execute\ default\ action\ in\ dialog=Execute default action in dialog @@ -262,8 +260,6 @@ Duplicate\ string\ name=Duplicate string name Duplicates\ found=Duplicates found -Dynamic\ groups=Dynamic groups - Dynamically\ group\ entries\ by\ a\ free-form\ search\ expression=Dynamically group entries by a free-form search expression Dynamically\ group\ entries\ by\ searching\ a\ field\ for\ a\ keyword=Dynamically group entries by searching a field for a keyword @@ -2269,6 +2265,5 @@ Replaces\ consecutive\ spaces\ with\ a\ single\ space\ in\ the\ field\ content.= Remove\ digits=Remove digits Removes\ digits.=Removes digits. The\ query\ cannot\ contain\ a\ year\ and\ year-range\ field.=The query cannot contain a year and year-range field. -This\ query\ uses\ an\ unsupported\ syntax.=This query uses an unsupported syntax. -This\ search\ contains\ entries\ that\ match\ all\ specified\ terms.=This search contains entries that match all specified terms. - +This\ query\ uses\ unsupported\ fields.=This query uses unsupported fields. +This\ query\ uses\ unsupported\ syntax.=This query uses unsupported syntax. diff --git a/src/test/java/org/jabref/architecture/MainArchitectureTests.java b/src/test/java/org/jabref/architecture/MainArchitectureTests.java index 060896c560c..c46aa576ac6 100644 --- a/src/test/java/org/jabref/architecture/MainArchitectureTests.java +++ b/src/test/java/org/jabref/architecture/MainArchitectureTests.java @@ -1,113 +1,135 @@ package org.jabref.architecture; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MainArchitectureTests { +import java.nio.file.Paths; + +import com.tngtech.archunit.core.domain.JavaClasses; +import com.tngtech.archunit.junit.AnalyzeClasses; +import com.tngtech.archunit.junit.ArchIgnore; +import com.tngtech.archunit.junit.ArchTest; + +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; +import static com.tngtech.archunit.library.Architectures.layeredArchitecture; + +@AnalyzeClasses(packages = "org.jabref") +class MainArchitectureTests { public static final String CLASS_ORG_JABREF_GLOBALS = "org.jabref.Globals"; - private static final String PACKAGE_JAVAX_SWING = "javax.swing"; - private static final String PACKAGE_JAVA_AWT = "java.awt"; - private static final String PACKAGE_JAVA_FX = "javafx"; - private static final String PACKAGE_ORG_JABREF_GUI = "org.jabref.gui"; - private static final String PACKAGE_ORG_JABREF_LOGIC = "org.jabref.logic"; - private static final String PACKAGE_ORG_JABREF_MODEL = "org.jabref.model"; - private static final String EXCEPTION_PACKAGE_JAVA_AWT_GEOM = "java.awt.geom"; - private static final String EXCEPTION_PACKAGE_JAVA_FX_COLLECTIONS = "javafx.collections"; - private static final String EXCEPTION_PACKAGE_JAVA_FX_BEANS = "javafx.beans"; - private static final String EXCEPTION_CLASS_JAVA_FX_COLOR = "javafx.scene.paint.Color"; - private static final String EXCEPTION_CLASS_JAVA_FX_PAIR = "javafx.util.Pair"; - - private static Map> exceptions; - - @BeforeAll - static void setUp() { - exceptions = new HashMap<>(); - // Add exceptions for the architectural test here - // Note that bending the architectural constraints should not be done inconsiderately - - List logicExceptions = new ArrayList<>(4); - logicExceptions.add(EXCEPTION_PACKAGE_JAVA_AWT_GEOM); - logicExceptions.add(EXCEPTION_PACKAGE_JAVA_FX_COLLECTIONS); - logicExceptions.add(EXCEPTION_PACKAGE_JAVA_FX_BEANS); - logicExceptions.add(EXCEPTION_CLASS_JAVA_FX_COLOR); - logicExceptions.add(EXCEPTION_CLASS_JAVA_FX_PAIR); - - List modelExceptions = new ArrayList<>(4); - modelExceptions.add(EXCEPTION_PACKAGE_JAVA_FX_COLLECTIONS); - modelExceptions.add(EXCEPTION_CLASS_JAVA_FX_COLOR); - modelExceptions.add(EXCEPTION_PACKAGE_JAVA_FX_COLLECTIONS); - modelExceptions.add(EXCEPTION_PACKAGE_JAVA_FX_BEANS); - - exceptions.put(PACKAGE_ORG_JABREF_LOGIC, logicExceptions); - exceptions.put(PACKAGE_ORG_JABREF_MODEL, modelExceptions); + private static final String PACKAGE_JAVAX_SWING = "javax.swing.."; + private static final String PACKAGE_JAVA_AWT = "java.awt.."; + private static final String PACKAGE_JAVA_FX = "javafx.."; + private static final String PACKAGE_ORG_JABREF_GUI = "org.jabref.gui.."; + private static final String PACKAGE_ORG_JABREF_LOGIC = "org.jabref.logic.."; + private static final String PACKAGE_ORG_JABREF_MODEL = "org.jabref.model.."; + + @ArchTest + public static void doNotUseApacheCommonsLang3(JavaClasses classes) { + noClasses().that().areNotAnnotatedWith(ApacheCommonsLang3Allowed.class) + .should().accessClassesThat().resideInAPackage("org.apache.commons.lang3") + .check(classes); + } + + @ArchTest + public static void doNotUseSwing(JavaClasses classes) { + // This checks for all all Swing packages, but not the UndoManager + noClasses().should().accessClassesThat().resideInAnyPackage("javax.swing", + "javax.swing.border..", + "javax.swing.colorchooser..", + "javax.swing.event..", + "javax.swing.filechooser..", + "javax.swing.plaf..", + "javax.swing.table..", + "javax.swing.text..", + "javax.swing.tree.." + ).check(classes); + } + + @ArchTest + public static void doNotUseJGoodies(JavaClasses classes) { + noClasses().should().accessClassesThat().resideInAPackage("com.jgoodies..") + .check(classes); + } + + @ArchTest + public static void doNotUseGlazedLists(JavaClasses classes) { + noClasses().should().accessClassesThat().resideInAPackage("ca.odell.glazedlists..") + .check(classes); + } + + @ArchTest + public static void doNotUseGlyphsDirectly(JavaClasses classes) { + noClasses().that().resideOutsideOfPackage("org.jabref.gui.icon") + .should().accessClassesThat().resideInAnyPackage("de.jensd.fx.glyphs", "de.jensd.fx.glyphs.materialdesignicons") + .check(classes); } - private static Stream getPackages() { - - return Stream.of( - Arguments.of(PACKAGE_ORG_JABREF_LOGIC, PACKAGE_JAVA_AWT), - Arguments.of(PACKAGE_ORG_JABREF_LOGIC, PACKAGE_JAVAX_SWING), - Arguments.of(PACKAGE_ORG_JABREF_LOGIC, PACKAGE_JAVA_FX), - Arguments.of(PACKAGE_ORG_JABREF_LOGIC, PACKAGE_ORG_JABREF_GUI), - Arguments.of(PACKAGE_ORG_JABREF_LOGIC, CLASS_ORG_JABREF_GLOBALS), - - Arguments.of(PACKAGE_ORG_JABREF_MODEL, PACKAGE_JAVA_AWT), - Arguments.of(PACKAGE_ORG_JABREF_MODEL, PACKAGE_JAVAX_SWING), - Arguments.of(PACKAGE_ORG_JABREF_MODEL, PACKAGE_JAVA_FX), - Arguments.of(PACKAGE_ORG_JABREF_MODEL, PACKAGE_ORG_JABREF_GUI), - Arguments.of(PACKAGE_ORG_JABREF_MODEL, PACKAGE_ORG_JABREF_LOGIC), - Arguments.of(PACKAGE_ORG_JABREF_MODEL, CLASS_ORG_JABREF_GLOBALS)); + @ArchTest + public static void doNotUseAssertJ(JavaClasses classes) { + noClasses().should().accessClassesThat().resideInAPackage("org.assertj..") + .check(classes); } - @ParameterizedTest(name = "{index} -- is {0} independent of {1}?") - @MethodSource("getPackages") - void firstPackageIsIndependentOfSecondPackage(String firstPackage, String secondPackage) throws IOException { - Predicate isExceptionPackage = (s) -> (s.startsWith("import " + secondPackage) - || s.startsWith("import static " + secondPackage)) - && exceptions.getOrDefault(firstPackage, Collections.emptyList()) - .stream() - .noneMatch(exception -> s.startsWith("import " + exception)); - - Predicate isPackage = (s) -> s.startsWith("package " + firstPackage); - - try (Stream pathStream = Files.walk(Path.of("src/main/"))) { - List files = pathStream - .filter(p -> p.toString().endsWith(".java")) - .filter(p -> { - try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isPackage); - } catch (IOException e) { - return false; - } - }) - .filter(p -> { - try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isExceptionPackage); - } catch (IOException e) { - return false; - } - }) - .collect(Collectors.toList()); - - assertEquals(Collections.emptyList(), files, "The following classes are not allowed to depend on " + secondPackage); - } + // "Currently disabled as there is no alternative for the rest of classes who need awt" + @ArchIgnore + @ArchTest + public static void doNotUseJavaAWT(JavaClasses classes) { + noClasses().should().accessClassesThat().resideInAPackage("java.awt..") + .check(classes); } + + @ArchTest + public static void doNotUsePaths(JavaClasses classes) { + noClasses().should() + .accessClassesThat() + .belongToAnyOf(Paths.class) + .because("Path.of(...) should be used instead") + .check(classes); + } + + @ArchTest + @ArchIgnore // Fails currently + public static void respectLayeredArchitecture(JavaClasses classes) { + layeredArchitecture() + .layer("Gui").definedBy(PACKAGE_ORG_JABREF_GUI) + .layer("Logic").definedBy(PACKAGE_ORG_JABREF_LOGIC) + .layer("Model").definedBy(PACKAGE_ORG_JABREF_MODEL) + .layer("Cli").definedBy("org.jabref.cli..") + .layer("Migrations").definedBy("org.jabref.migrations..") // TODO: Move to logic + .layer("Preferences").definedBy("org.jabref.preferences..") + .layer("Styletester").definedBy("org.jabref.styletester..") + + .whereLayer("Gui").mayOnlyBeAccessedByLayers("Preferences", "Cli") // TODO: Remove preferences here + .whereLayer("Logic").mayOnlyBeAccessedByLayers("Gui", "Cli", "Model", "Migrations", "Preferences") + .whereLayer("Model").mayOnlyBeAccessedByLayers("Gui", "Logic", "Migrations", "Cli", "Preferences") + .whereLayer("Cli").mayNotBeAccessedByAnyLayer() + .whereLayer("Migrations").mayOnlyBeAccessedByLayers("Logic") + .whereLayer("Preferences").mayOnlyBeAccessedByLayers("Gui", "Logic", "Migrations", "Styletester", "Cli") // TODO: Remove logic here + + .check(classes); + } + + @ArchTest + public static void doNotUseLogicInModel(JavaClasses classes) { + noClasses().that().resideInAPackage(PACKAGE_ORG_JABREF_MODEL).and().areNotAnnotatedWith(AllowedToUseLogic.class) + .should().dependOnClassesThat().resideInAPackage(PACKAGE_ORG_JABREF_LOGIC) + .check(classes); + } + + @ArchTest + public static void restrictUsagesInModel(JavaClasses classes) { + noClasses().that().resideInAPackage(PACKAGE_ORG_JABREF_MODEL) + .should().dependOnClassesThat().resideInAPackage(PACKAGE_JAVA_AWT) + .orShould().dependOnClassesThat().resideInAPackage(PACKAGE_JAVAX_SWING) + .orShould().dependOnClassesThat().haveFullyQualifiedName(CLASS_ORG_JABREF_GLOBALS) + .check(classes); + } + + @ArchTest + public static void restrictUsagesInLogic(JavaClasses classes) { + noClasses().that().resideInAPackage(PACKAGE_ORG_JABREF_LOGIC) + .should().dependOnClassesThat().resideInAPackage(PACKAGE_JAVA_AWT) + .orShould().dependOnClassesThat().resideInAPackage(PACKAGE_JAVAX_SWING) + .orShould().dependOnClassesThat().haveFullyQualifiedName(CLASS_ORG_JABREF_GLOBALS) + .check(classes); + } + } diff --git a/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java b/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java deleted file mode 100644 index 0ac0430258b..00000000000 --- a/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jabref.architecture; - -import java.nio.file.Paths; - -import com.tngtech.archunit.core.domain.JavaClasses; -import com.tngtech.archunit.junit.AnalyzeClasses; -import com.tngtech.archunit.junit.ArchIgnore; -import com.tngtech.archunit.junit.ArchTest; - -import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; - -@AnalyzeClasses(packages = "org.jabref") -class MainArchitectureTestsWithArchUnit { - - @ArchTest - static void doNotUseApacheCommonsLang3(JavaClasses classes) { - noClasses().that().areNotAnnotatedWith(ApacheCommonsLang3Allowed.class) - .should().accessClassesThat().resideInAPackage("org.apache.commons.lang3") - .check(classes); - } - - @ArchTest - public static void doNotUseSwing(JavaClasses classes) { - // This checks for all all Swing packages, but not the UndoManager - noClasses().should().accessClassesThat().resideInAnyPackage("javax.swing", - "javax.swing.border..", - "javax.swing.colorchooser..", - "javax.swing.event..", - "javax.swing.filechooser..", - "javax.swing.plaf..", - "javax.swing.table..", - "javax.swing.text..", - "javax.swing.tree.." - ).check(classes); - } - - @ArchTest - public static void doNotUseJGoodies(JavaClasses classes) { - noClasses().should().accessClassesThat().resideInAPackage("com.jgoodies..").check(classes); - } - - @ArchTest - public static void doNotUseGlazedLists(JavaClasses classes) { - noClasses().should().accessClassesThat().resideInAPackage("ca.odell.glazedlists..").check(classes); - } - - @ArchTest - public static void doNotUseGlyphsDirectly(JavaClasses classes) { - noClasses().that().resideOutsideOfPackage("org.jabref.gui.icon").should().accessClassesThat().resideInAnyPackage("de.jensd.fx.glyphs", "de.jensd.fx.glyphs.materialdesignicons").check(classes); - } - - @ArchTest - public static void doNotUseAssertJ(JavaClasses classes) { - noClasses().should().accessClassesThat().resideInAPackage("org.assertj..").check(classes); - } - - // "Currently disabled as there is no alternative for the rest of classes who need awt" - @ArchIgnore - @ArchTest - public static void doNotUseJavaAWT(JavaClasses classes) { - noClasses().should().accessClassesThat().resideInAPackage("java.awt..").check(classes); - } - - @ArchTest - public static void doNotUsePaths(JavaClasses classes) { - noClasses().should() - .accessClassesThat() - .belongToAnyOf(Paths.class) - .check(classes); - } -} diff --git a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java index 691ac790eac..5ee07e4d58e 100644 --- a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java @@ -18,11 +18,11 @@ import org.jabref.logic.bibtex.FieldContentFormatterPreferences; import org.jabref.logic.bibtex.FieldWriterPreferences; import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.logic.exporter.SavePreferences; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index 2a331035c64..990d9c25c50 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -12,7 +12,7 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.types.StandardEntryType; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java index bac8b112273..63c9c3eb8bb 100644 --- a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java +++ b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java @@ -22,7 +22,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import org.jabref.testutils.category.FetcherTest; import org.junit.jupiter.api.Assertions; diff --git a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java index c2a80b7c7b1..e171fb56ccd 100644 --- a/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java +++ b/src/test/java/org/jabref/logic/auxparser/AuxParserTest.java @@ -12,8 +12,6 @@ import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.logic.importer.ParserResult; import org.jabref.logic.importer.fileformat.BibtexParser; -import org.jabref.model.auxparser.AuxParser; -import org.jabref.model.auxparser.AuxParserResult; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.DummyFileUpdateMonitor; diff --git a/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java b/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java similarity index 96% rename from src/test/java/org/jabref/model/entry/FileFieldWriterTest.java rename to src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java index 84aba43fcbf..40b73e45d44 100644 --- a/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java @@ -1,8 +1,11 @@ -package org.jabref.model.entry; +package org.jabref.logic.bibtex; import java.util.Arrays; import java.util.Collections; +import org.jabref.logic.importer.util.FileFieldParser; +import org.jabref.model.entry.LinkedFile; + import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java b/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java index 60dce65c498..dac2892c109 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java @@ -6,7 +6,6 @@ import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.logic.importer.ParseException; import org.jabref.logic.importer.fileformat.BibtexParser; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java b/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java index ea55e8de8be..4d08b07d116 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java @@ -2,8 +2,6 @@ import java.util.Optional; -import org.jabref.model.bibtexkeypattern.DatabaseCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 75cb1c30d2a..ba2f98a708a 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; import org.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; @@ -21,17 +22,14 @@ import org.jabref.logic.protectedterms.ProtectedTermsLoader; import org.jabref.logic.protectedterms.ProtectedTermsPreferences; import org.jabref.model.FieldChange; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java index dc0b5a9958c..27cbd8d322d 100644 --- a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java @@ -5,7 +5,6 @@ import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; import org.jabref.logic.formatter.casechanger.UpperCaseFormatter; -import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.InternalField; diff --git a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java index f9d1b76d484..daf131f728e 100644 --- a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java @@ -6,7 +6,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 63246e9f04d..80d8feb2c87 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -8,15 +8,15 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.model.FieldChange; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java index 136423d9a3c..1b67a2b227a 100644 --- a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java @@ -6,14 +6,14 @@ import java.util.Arrays; import java.util.Optional; +import org.jabref.logic.bibtex.FileFieldWriter; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.jabref.model.entry.FileFieldWriter; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java b/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java index fa56cb9324d..1574506d300 100644 --- a/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java +++ b/src/test/java/org/jabref/logic/database/DatabaseMergerTest.java @@ -15,7 +15,6 @@ import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.metadata.ContentSelector; import org.jabref.model.metadata.MetaData; -import org.jabref.preferences.JabRefPreferences; import org.junit.jupiter.api.Test; @@ -144,7 +143,7 @@ void mergeMetaDataWithAllEntriesGroup() { List expectedContentSelectors = List.of(new ContentSelector(StandardField.AUTHOR, List.of("Test Author")), new ContentSelector(StandardField.TITLE, List.of("Test Title"))); - GroupTreeNode expectedImportedGroupNode = new GroupTreeNode(new ExplicitGroup("Imported unknown", GroupHierarchyType.INDEPENDENT, JabRefPreferences.getInstance().getKeywordDelimiter())); + GroupTreeNode expectedImportedGroupNode = new GroupTreeNode(new ExplicitGroup("Imported unknown", GroupHierarchyType.INDEPENDENT, ';')); new DatabaseMerger().mergeMetaData(target, other, "unknown", List.of()); diff --git a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java index e112afedab5..a16d08dd51c 100644 --- a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java +++ b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java @@ -11,6 +11,11 @@ import java.util.Collection; import java.util.Collections; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; +import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.formatter.casechanger.TitleCaseFormatter; import org.jabref.logic.formatter.casechanger.UpperCaseFormatter; @@ -19,11 +24,6 @@ import org.jabref.logic.importer.ParserResult; import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.util.OS; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.DatabaseCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; diff --git a/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java b/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java index b6a9b8de6c7..1d63aabf653 100644 --- a/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java +++ b/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java @@ -6,12 +6,12 @@ import java.util.Optional; import org.jabref.logic.cleanup.Cleanups; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.formatter.IdentityFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.types.StandardEntryType; diff --git a/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java b/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java index 51200ddc429..a36a482bffb 100644 --- a/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java +++ b/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java @@ -6,11 +6,11 @@ import java.util.Map; import java.util.TreeMap; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.util.OS; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.entry.field.StandardField; import org.jabref.model.metadata.ContentSelector; import org.jabref.model.metadata.MetaData; diff --git a/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/src/test/java/org/jabref/logic/formatter/FormatterTest.java index 412483c5907..d465658add7 100644 --- a/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -5,11 +5,11 @@ 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; import org.jabref.logic.protectedterms.ProtectedTermsPreferences; -import org.jabref.model.cleanup.Formatter; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/model/entry/AuthorListParserTest.java b/src/test/java/org/jabref/logic/importer/AuthorListParserTest.java similarity index 88% rename from src/test/java/org/jabref/model/entry/AuthorListParserTest.java rename to src/test/java/org/jabref/logic/importer/AuthorListParserTest.java index c2112663f65..d6bb46531f0 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListParserTest.java +++ b/src/test/java/org/jabref/logic/importer/AuthorListParserTest.java @@ -1,7 +1,11 @@ -package org.jabref.model.entry; +package org.jabref.logic.importer; import java.util.stream.Stream; +import org.jabref.model.entry.Author; +import org.jabref.model.entry.AuthorList; + +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -29,7 +33,7 @@ private static Stream data() { @MethodSource("data") void parseCorrectly(String authorsString, Author authorsParsed) { AuthorListParser parser = new AuthorListParser(); - assertEquals(new AuthorList(authorsParsed), parser.parse(authorsString)); + Assertions.assertEquals(new AuthorList(authorsParsed), parser.parse(authorsString)); } @Test diff --git a/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java b/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java index 10df92ac461..1bff22bbb94 100644 --- a/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java +++ b/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java @@ -5,7 +5,6 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Collection; import java.util.Optional; @@ -39,8 +38,7 @@ class OpenDatabaseTest { bibWrongHeader = Path.of(OpenDatabaseTest.class.getResource("wrong-header.bib").toURI()); bibHeader = Path.of(OpenDatabaseTest.class.getResource("encoding-header.bib").toURI()); bibHeaderAndSignature = Path.of(OpenDatabaseTest.class.getResource("jabref-header.bib").toURI()); - bibEncodingWithoutNewline = Paths - .get(OpenDatabaseTest.class.getResource("encodingWithoutNewline.bib").toURI()); + bibEncodingWithoutNewline = Path.of(OpenDatabaseTest.class.getResource("encodingWithoutNewline.bib").toURI()); } @BeforeEach diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index d988b03bce4..c72d834d827 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -11,17 +11,17 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.citationkeypattern.AbstractCitationKeyPattern; +import org.jabref.logic.citationkeypattern.DatabaseCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.exporter.SavePreferences; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.logic.importer.ParseException; import org.jabref.logic.importer.ParserResult; import org.jabref.logic.util.OS; -import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.DatabaseCitationKeyPattern; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryType; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java index 1a13480a197..fe48bcb86ca 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java @@ -7,7 +7,6 @@ import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -77,8 +76,7 @@ void doesNotRecognizeEmptyFiles() throws IOException { @Test void testImportMultipleEntriesInSingleFile() throws IOException, URISyntaxException { - Path inputFile = Paths - .get(MedlinePlainImporter.class.getResource("MedlinePlainImporterTestMultipleEntries.txt").toURI()); + Path inputFile = Path.of(MedlinePlainImporter.class.getResource("MedlinePlainImporterTestMultipleEntries.txt").toURI()); List entries = importer.importDatabase(inputFile, StandardCharsets.UTF_8).getDatabase() .getEntries(); @@ -198,8 +196,7 @@ void testWithNbibFile() throws IOException, URISyntaxException { @Test void testWithMultipleEntries() throws IOException, URISyntaxException { - Path file = Paths - .get(MedlinePlainImporter.class.getResource("MedlinePlainImporterStringOutOfBounds.txt").toURI()); + Path file = Path.of(MedlinePlainImporter.class.getResource("MedlinePlainImporterStringOutOfBounds.txt").toURI()); List entries = importer.importDatabase(file, Charsets.UTF_8).getDatabase().getEntries(); @@ -208,8 +205,7 @@ void testWithMultipleEntries() throws IOException, URISyntaxException { @Test void testInvalidFormat() throws URISyntaxException, IOException { - Path file = Paths - .get(MedlinePlainImporter.class.getResource("MedlinePlainImporterTestInvalidFormat.xml").toURI()); + Path file = Path.of(MedlinePlainImporter.class.getResource("MedlinePlainImporterTestInvalidFormat.xml").toURI()); List entries = importer.importDatabase(file, Charsets.UTF_8).getDatabase().getEntries(); diff --git a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java index eeb5f5e5845..384f4d39f1a 100644 --- a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java +++ b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java @@ -11,8 +11,8 @@ import org.jabref.logic.citationkeypattern.CitationKeyGenerator; import org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.logic.journals.JournalAbbreviationLoader; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; @@ -23,8 +23,8 @@ import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.IEEETranEntryType; import org.jabref.model.entry.types.StandardEntryType; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; diff --git a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java index 08c6e29d12b..8c2f8bb91b6 100644 --- a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java +++ b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java @@ -8,8 +8,8 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.pdf.FileAnnotation; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java index 98bf2c7a709..65efb43cb4a 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java @@ -4,7 +4,6 @@ import java.io.FileNotFoundException; import java.net.URISyntaxException; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -47,10 +46,10 @@ void testGetProtectedTerms() throws URISyntaxException { @Test void testAddProtectedTermsListFromFile() throws URISyntaxException { - String filename = Paths - .get(ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms") - .toURI()) - .toFile().getPath(); + String filename = Path.of( + ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms") + .toURI()) + .toFile().getPath(); assertEquals(ProtectedTermsLoader.getInternalLists().size(), loader.getProtectedTermsLists().size()); loader.addProtectedTermsListFromFile(filename, false); assertEquals(ProtectedTermsLoader.getInternalLists().size() + 1, loader.getProtectedTermsLists().size()); diff --git a/src/test/java/org/jabref/logic/shared/DBMSConnectionPropertiesTest.java b/src/test/java/org/jabref/logic/shared/DBMSConnectionPropertiesTest.java index 6b8aef0fbf0..5f7e6e983b8 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSConnectionPropertiesTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSConnectionPropertiesTest.java @@ -1,7 +1,5 @@ package org.jabref.logic.shared; -import org.jabref.model.database.shared.DBMSType; - import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java index c272d604e7f..9187bf81904 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java @@ -2,7 +2,6 @@ import java.sql.SQLException; -import org.jabref.model.database.shared.DBMSType; import org.jabref.testutils.category.DatabaseTest; import org.junit.jupiter.params.ParameterizedTest; diff --git a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java index 653f0a11f3e..aa4c8679a52 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java @@ -12,7 +12,6 @@ import java.util.stream.Collectors; import org.jabref.logic.shared.exception.OfflineLockException; -import org.jabref.model.database.shared.DBMSType; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index 2fd54058701..36534eb7da2 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -6,15 +6,14 @@ import java.util.List; import java.util.Map; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.cleanup.FieldFormatterCleanup; +import org.jabref.logic.cleanup.FieldFormatterCleanups; import org.jabref.logic.exporter.MetaDataSerializer; import org.jabref.logic.formatter.casechanger.LowerCaseFormatter; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; -import org.jabref.model.cleanup.FieldFormatterCleanup; -import org.jabref.model.cleanup.FieldFormatterCleanups; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; -import org.jabref.model.database.shared.DBMSType; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.event.EntriesEventSource; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java index 1854ddd41db..9b087519da1 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java @@ -2,7 +2,6 @@ import java.util.Optional; -import org.jabref.model.database.shared.DBMSType; import org.jabref.testutils.category.DatabaseTest; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java index 6a331d632b6..c439f7c2aa4 100644 --- a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java +++ b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java @@ -3,7 +3,7 @@ import java.sql.SQLException; import java.util.List; -import org.jabref.model.bibtexkeypattern.GlobalCitationKeyPattern; +import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; diff --git a/src/test/java/org/jabref/logic/shared/TestConnector.java b/src/test/java/org/jabref/logic/shared/TestConnector.java index f48bb98e422..a2a3f98674c 100644 --- a/src/test/java/org/jabref/logic/shared/TestConnector.java +++ b/src/test/java/org/jabref/logic/shared/TestConnector.java @@ -3,7 +3,6 @@ import java.sql.SQLException; import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException; -import org.jabref.model.database.shared.DBMSType; import org.jabref.testutils.category.DatabaseTest; /** diff --git a/src/test/java/org/jabref/logic/shared/TestManager.java b/src/test/java/org/jabref/logic/shared/TestManager.java index 55c79812083..48012830211 100644 --- a/src/test/java/org/jabref/logic/shared/TestManager.java +++ b/src/test/java/org/jabref/logic/shared/TestManager.java @@ -3,8 +3,6 @@ import java.sql.SQLException; import java.util.Objects; -import org.jabref.model.database.shared.DBMSType; - /** * This class provides helping methods for database tests. Furthermore it determines database systems which are ready to * be used for tests. diff --git a/src/test/java/org/jabref/model/database/BibDatabaseContextTest.java b/src/test/java/org/jabref/model/database/BibDatabaseContextTest.java index a714a5e672a..f73ae5c2408 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseContextTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseContextTest.java @@ -6,8 +6,8 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.types.IEEETranEntryType; -import org.jabref.model.metadata.FilePreferences; import org.jabref.model.metadata.MetaData; +import org.jabref.preferences.FilePreferences; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/model/groups/TexGroupTest.java b/src/test/java/org/jabref/model/groups/TexGroupTest.java index 7cf52a66aa2..b27c496fd7e 100644 --- a/src/test/java/org/jabref/model/groups/TexGroupTest.java +++ b/src/test/java/org/jabref/model/groups/TexGroupTest.java @@ -2,6 +2,7 @@ import java.nio.file.Path; +import org.jabref.architecture.AllowedToUseLogic; import org.jabref.logic.auxparser.DefaultAuxParser; import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.BibEntry; @@ -15,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +@AllowedToUseLogic("because class under test relies on logic classes") public class TexGroupTest { private MetaData metaData;