Skip to content

Commit 8a94233

Browse files
authored
Merge branch 'main' into main
2 parents 3387631 + f52fcb4 commit 8a94233

File tree

18 files changed

+269
-124
lines changed

18 files changed

+269
-124
lines changed

.jbang/JabSrvLauncher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
//DEPS info.picocli:picocli:4.7.7
6161
//DEPS org.postgresql:postgresql:42.7.7
6262
//DEPS org.bouncycastle:bcprov-jdk18on:1.81
63-
//DEPS com.konghq:unirest-modules-gson:4.4.7
63+
//DEPS com.konghq:unirest-modules-gson:4.4.12
6464
//DEPS jakarta.ws.rs:jakarta.ws.rs-api:4.0.0
6565
//DEPS org.glassfish.jersey.core:jersey-server:3.1.10
6666
//DEPS org.glassfish.jersey.inject:jersey-hk2:3.1.10
@@ -72,7 +72,7 @@
7272
//DEPS org.glassfish.grizzly:grizzly-framework:4.0.2
7373
//DEPS jakarta.validation:jakarta.validation-api:3.1.1
7474
//DEPS org.hibernate.validator:hibernate-validator:9.0.1.Final
75-
//DEPS com.konghq:unirest-modules-gson:4.4.7
75+
//DEPS com.konghq:unirest-modules-gson:4.4.12
7676
//DEPS com.google.guava:guava:33.4.8-jre
7777
//DEPS org.jabref:afterburner.fx:2.0.0
7878
//DEPS net.harawata:appdirs:1.4.0

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
7474
- We fixed an issue where Document Viewer showed technical exceptions when opening entries with non-PDF files. [#13198](https://github.com/JabRef/jabref/issues/13198)
7575
- When creating a library, if you drag a PDF file containing only a single column, the dialog will now automatically close. [#13262](https://github.com/JabRef/jabref/issues/13262)
7676
- We fixed an issue where the tab showing the fulltext search results would appear blank after switching library. [#13241](https://github.com/JabRef/jabref/issues/13241)
77+
- Enhanced field selection logic in the Merge Entries dialog when fetching from DOI to prefer valid years and entry types. [#12549](https://github.com/JabRef/jabref/issues/12549)
7778

7879
### Removed
7980

build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts

Lines changed: 84 additions & 78 deletions
Large diffs are not rendered by default.

build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ javaModulePackaging {
1818
target("ubuntu-22.04") {
1919
operatingSystem = OperatingSystemFamily.LINUX
2020
architecture = MachineArchitecture.X86_64
21-
packageTypes = listOf("app-image", "deb")
21+
packageTypes = listOf("app-image", "deb", "rpm")
2222
}
2323
target("ubuntu-22.04-arm") {
2424
operatingSystem = OperatingSystemFamily.LINUX
2525
architecture = MachineArchitecture.ARM64
26-
packageTypes = listOf("app-image", "deb")
26+
packageTypes = listOf("app-image", "deb", "rpm")
2727
}
2828
target("macos-13") {
2929
operatingSystem = OperatingSystemFamily.MACOS

jabgui/src/main/java/module-info.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
provides org.kordamp.ikonli.IkonProvider
4848
with org.jabref.gui.icon.JabrefIconProvider;
4949

50-
requires org.reactfx;
50+
requires reactfx;
5151
// endregion
5252

5353
// region: Logging
@@ -92,7 +92,7 @@
9292
// region HTTP clients
9393
requires org.apache.httpcomponents.core5.httpcore5;
9494
requires org.jsoup;
95-
requires com.konghq.unirest.java.core;
95+
requires unirest.java.core;
9696
// requires unirest.modules.gson;
9797
// endregion
9898

@@ -130,14 +130,14 @@
130130
// requires org.apache.xmpbox;
131131
// requires com.ibm.icu;
132132

133-
requires com.vladsch.flexmark;
134-
requires com.vladsch.flexmark.html2md.converter;
135-
requires com.vladsch.flexmark.util.ast;
136-
requires com.vladsch.flexmark.util.data;
133+
requires flexmark;
134+
requires flexmark.html2md.converter;
135+
requires flexmark.util.ast;
136+
requires flexmark.util.data;
137137

138138
// requires com.h2database.mvstore;
139139

140-
requires com.github.java.keyring;
140+
requires java.keyring;
141141
// requires org.freedesktop.dbus;
142142

143143
requires org.jooq.jool;
@@ -148,15 +148,15 @@
148148
// requires ai.djl.tokenizers;
149149
// requires jvm.openai;
150150
// requires langchain4j;
151-
requires dev.langchain4j.core;
151+
requires langchain4j.core;
152152
// requires langchain4j.google.ai.gemini;
153153
// requires langchain4j.hugging.face;
154154
// requires langchain4j.mistral.ai;
155155
// requires langchain4j.open.ai;
156156
// uses ai.djl.engine.EngineProvider;
157157
// uses ai.djl.repository.RepositoryFactory;
158158
// uses ai.djl.repository.zoo.ZooProvider;
159-
// uses dev.langchain4j.spi.prompt.PromptTemplateFactory;
159+
// uses langchain4j.spi.prompt.PromptTemplateFactory;
160160
// requires velocity.engine.core;
161161
// endregion
162162

jabgui/src/main/java/org/jabref/gui/mergeentries/FetchAndMergeEntry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private void showMergeDialog(BibEntry originalEntry, BibEntry fetchedEntry, WebF
107107
dialog.setTitle(Localization.lang("Merge entry with %0 information", fetcher.getName()));
108108
dialog.setLeftHeaderText(Localization.lang("Original entry"));
109109
dialog.setRightHeaderText(Localization.lang("Entry from %0", fetcher.getName()));
110+
dialog.autoSelectBetterFields();
110111
Optional<BibEntry> mergedEntry = dialogService.showCustomDialogAndWait(dialog).map(EntriesMergeResult::mergedEntry);
111112

112113
if (mergedEntry.isPresent()) {

jabgui/src/main/java/org/jabref/gui/mergeentries/MergeEntriesDialog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,8 @@ public void setRightHeaderText(String rightHeaderText) {
6464
public void configureDiff(ShowDiffConfig diffConfig) {
6565
threeWayMergeView.showDiff(diffConfig);
6666
}
67+
68+
public void autoSelectBetterFields() {
69+
threeWayMergeView.autoSelectBetterFields();
70+
}
6771
}

jabgui/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ public boolean hasEqualLeftAndRightValues() {
208208
return viewModel.hasEqualLeftAndRightValues();
209209
}
210210

211+
public void autoSelectBetterValue() {
212+
viewModel.autoSelectBetterValue();
213+
}
214+
211215
@Override
212216
public String toString() {
213217
return "FieldRowView [shouldShowDiffs=" + shouldShowDiffs.get() + ", fieldNameCell=" + fieldNameCell + ", leftValueCell=" + leftValueCell + ", rightValueCell=" + rightValueCell + ", mergedValueCell=" + mergedValueCell + "]";

jabgui/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowViewModel.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616

1717
import org.jabref.gui.mergeentries.newmergedialog.fieldsmerger.FieldMerger;
1818
import org.jabref.gui.mergeentries.newmergedialog.fieldsmerger.FieldMergerFactory;
19+
import org.jabref.logic.bibtex.comparator.ComparisonResult;
20+
import org.jabref.logic.bibtex.comparator.YearFieldValuePlausibilityComparator;
1921
import org.jabref.model.entry.BibEntry;
2022
import org.jabref.model.entry.field.Field;
2123
import org.jabref.model.entry.field.InternalField;
24+
import org.jabref.model.entry.field.StandardField;
2225
import org.jabref.model.entry.types.EntryTypeFactory;
26+
import org.jabref.model.entry.types.StandardEntryType;
2327
import org.jabref.model.strings.StringUtil;
2428

2529
import com.tobiasdiez.easybind.EasyBind;
@@ -120,6 +124,25 @@ public FieldRowViewModel(Field field, BibEntry leftEntry, BibEntry rightEntry, B
120124
EasyBind.subscribe(hasEqualLeftAndRightBinding(), this::setIsFieldsMerged);
121125
}
122126

127+
public void autoSelectBetterValue() {
128+
String leftValue = getLeftFieldValue();
129+
String rightValue = getRightFieldValue();
130+
131+
if (StandardField.YEAR == field) {
132+
YearFieldValuePlausibilityComparator comparator = new YearFieldValuePlausibilityComparator();
133+
ComparisonResult comparison = comparator.compare(leftValue, rightValue);
134+
if (ComparisonResult.RIGHT_BETTER == comparison) {
135+
selectRightValue();
136+
} else if (ComparisonResult.LEFT_BETTER == comparison) {
137+
selectLeftValue();
138+
}
139+
} else if (InternalField.TYPE_HEADER == field) {
140+
if (leftValue.equalsIgnoreCase(StandardEntryType.Misc.getName())) {
141+
selectRightValue();
142+
}
143+
}
144+
}
145+
123146
public void selectNonEmptyValue() {
124147
if (StringUtil.isNullOrEmpty(leftFieldValue.get())) {
125148
selectRightValue();

jabgui/src/main/java/org/jabref/gui/mergeentries/newmergedialog/ThreeWayMergeView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,10 @@ public BibEntry getRightEntry() {
200200
public void saveConfiguration() {
201201
toolbar.saveToolbarConfiguration();
202202
}
203+
204+
public void autoSelectBetterFields() {
205+
for (FieldRowView row : fieldRows) {
206+
row.autoSelectBetterValue();
207+
}
208+
}
203209
}

0 commit comments

Comments
 (0)