Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ooPanel
Browse files Browse the repository at this point in the history
* upstream/master:
  Change location of some fields in the entry editor (#4448)
  Bump applicationinsights-core from 2.2.0 to 2.2.1 (#4488)
  Added feature to add server timezone when connecting to shared database (#4483)
  Bump applicationinsights-logging-log4j2 from 2.2.0 to 2.2.1 (#4487)
  fix save button
  Update archunit from 0.9.1 -> 0.9.2
  • Loading branch information
Siedlerchr committed Nov 17, 2018
2 parents 93ac650 + 2953849 commit 04bea3e
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 126 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- We changed the location of some fields in the entry editor (you might need to reset your preferences for these changes to come into effect)
- Journal/Year/Month in biblatex mode -> Deprecated (if filled)
- DOI/URL: General -> Optional
- Internal fields like ranking, read status and priority: Other -> General
- Moreover, empty deprecated fields are no longer shown
- Added server timezone parameter when connecting to a shared database.
- We updated the dialog for setting up general fields.
- URL field formatting is updated. All whitespace chars, located at the beginning/ending of the url, are trimmed automatically
- We changed the behavior of the field formatting dialog such that the `bibtexkey` is not changed when formatting all fields or all text fields.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ dependencies {

errorproneJavac 'com.google.errorprone:javac:1.8.0-u20'

compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.2.0'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.2.0'
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.2.1'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.2.1'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testCompile 'org.junit.jupiter:junit-jupiter-params:5.3.1'
Expand All @@ -174,8 +174,8 @@ dependencies {
testCompile 'org.reflections:reflections:0.9.11'
testCompile 'org.xmlunit:xmlunit-core:2.6.2'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.2'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.9.1'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.9.1'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.9.2'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.9.2'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.entryeditor;

import java.util.Collection;
import java.util.stream.Collectors;

import javax.swing.undo.UndoManager;

Expand All @@ -25,6 +26,9 @@ public DeprecatedFieldsTab(BibDatabaseContext databaseContext, SuggestionProvide

@Override
protected Collection<String> determineFieldsToShow(BibEntry entry, EntryType entryType) {
return entryType.getDeprecatedFields();
return entryType.getDeprecatedFields()
.stream()
.filter(entry::hasField)
.collect(Collectors.toList());
}
}
7 changes: 7 additions & 0 deletions src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ public boolean save() {
panel.frame().output(Localization.lang("Saving library") + "...");
panel.setSaving(true);
return doSave();
} else {
Optional<Path> savePath = getSavePath();
if (savePath.isPresent()) {
saveAs(savePath.get());
return true;
}
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<CheckBox fx:id="useSSL" mnemonicParsing="false" text="%Use SSL" GridPane.rowIndex="5" />
<TextField fx:id="fileKeystore" GridPane.columnIndex="1" GridPane.rowIndex="6" />
<Button fx:id="browseKeystore" mnemonicParsing="false" onAction="#showOpenKeystoreFileDialog" text="%Browse" GridPane.columnIndex="2" GridPane.rowIndex="6" />
<Label text="%Server Timezone:" GridPane.rowIndex="8"/>
<TextField fx:id="serverTimezone" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="8" />
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class SharedDatabaseLoginDialogView extends BaseDialog<Void> {
@FXML private TextField fileKeystore;
@FXML private PasswordField passwordKeystore;
@FXML private Button browseKeystore;
@FXML private TextField serverTimezone;

@Inject private DialogService dialogService;

Expand Down Expand Up @@ -83,6 +84,7 @@ private void initialize() {
user.textProperty().bindBidirectional(viewModel.userProperty());
password.textProperty().bindBidirectional(viewModel.passwordProperty());
port.textProperty().bindBidirectional(viewModel.portProperty());
serverTimezone.textProperty().bindBidirectional(viewModel.serverTimezoneProperty());
databaseType.valueProperty().bindBidirectional(viewModel.selectedDbmstypeProperty());

folder.textProperty().bindBidirectional(viewModel.folderProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class SharedDatabaseLoginDialogViewModel extends AbstractViewModel {
private final StringProperty keystore = new SimpleStringProperty("");
private final BooleanProperty useSSL = new SimpleBooleanProperty();
private final StringProperty keyStorePasswordProperty = new SimpleStringProperty("");
private final StringProperty serverTimezone = new SimpleStringProperty("");

private final JabRefFrame frame;
private final DialogService dialogService;
Expand Down Expand Up @@ -118,6 +119,7 @@ public void openDatabase() {
connectionProperties.setPassword(password.getValue());
connectionProperties.setUseSSL(useSSL.getValue());
connectionProperties.setKeyStore(keystore.getValue());
connectionProperties.setServerTimezone(serverTimezone.getValue());

setupKeyStore();
openSharedDatabase(connectionProperties);
Expand Down Expand Up @@ -200,6 +202,7 @@ private void setPreferences() {
prefs.setUser(user.getValue());
prefs.setUseSSL(useSSL.getValue());
prefs.setKeystoreFile(keystore.getValue());
prefs.setServerTimezone(serverTimezone.getValue());

if (rememberPassword.get()) {
try {
Expand Down Expand Up @@ -364,4 +367,6 @@ public ValidationStatus keystoreValidation() {
public ValidationStatus formValidation() {
return formValidator.getValidationStatus();
}

public StringProperty serverTimezoneProperty() { return serverTimezone; }
}
23 changes: 11 additions & 12 deletions src/main/java/org/jabref/logic/integrity/NoBibtexFieldChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.jabref.model.entry.BiblatexEntryTypes;
import org.jabref.model.entry.BibtexEntryTypes;
import org.jabref.model.entry.FieldName;
import org.jabref.model.entry.InternalBibtexFields;

/**
* This checker checks whether the entry does not contain any field appearing only in biblatex (and not in BibTeX)
Expand All @@ -20,23 +19,23 @@ public class NoBibtexFieldChecker implements Checker {
private List<String> getAllBiblatexOnlyFields() {
Set<String> allBibtexFields = BibtexEntryTypes.ALL.stream().flatMap(type -> type.getAllFields().stream()).collect(Collectors.toSet());
return BiblatexEntryTypes.ALL.stream()
.flatMap(type -> type.getAllFields().stream())
.filter(fieldName -> !allBibtexFields.contains(fieldName))
// these fields are displayed by JabRef as default
.filter(fieldName -> !InternalBibtexFields.DEFAULT_GENERAL_FIELDS.contains(fieldName))
.filter(fieldName -> !fieldName.equals(FieldName.ABSTRACT))
.filter(fieldName -> !fieldName.equals(FieldName.REVIEW))
.sorted()
.collect(Collectors.toList());
.flatMap(type -> type.getAllFields().stream())
.filter(fieldName -> !allBibtexFields.contains(fieldName))
// these fields are displayed by JabRef as default
.filter(fieldName -> !fieldName.equals(FieldName.ABSTRACT))
.filter(fieldName -> !fieldName.equals(FieldName.COMMENT))
.filter(fieldName -> !fieldName.equals(FieldName.DOI))
.filter(fieldName -> !fieldName.equals(FieldName.URL))
.sorted()
.collect(Collectors.toList());
}

@Override
public List<IntegrityMessage> check(BibEntry entry) {
// non-static initalization of ALL_BIBLATEX_ONLY_FIELDS as the user can customize the entry types during runtime
final List<String> allBiblatexOnlyFields = getAllBiblatexOnlyFields();
return entry.getFieldNames().stream()
.filter(name -> allBiblatexOnlyFields.contains(name))
.map(name -> new IntegrityMessage(Localization.lang("biblatex field only"), entry, name)).collect(Collectors.toList());
.filter(allBiblatexOnlyFields::contains)
.map(name -> new IntegrityMessage(Localization.lang("biblatex field only"), entry, name)).collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class DBMSConnectionProperties implements DatabaseConnectionProperties {
private String user;
private String password;
private boolean useSSL;
private String serverTimezone;

//Not needed for connection, but stored for future login
private String keyStore;
Expand All @@ -41,14 +42,15 @@ public DBMSConnectionProperties(SharedDatabasePreferences prefs) {
}

public DBMSConnectionProperties(DBMSType type, String host, int port, String database, String user,
String password, boolean useSSL) {
String password, boolean useSSL, String serverTimezone) {
this.type = type;
this.host = host;
this.port = port;
this.database = database;
this.user = user;
this.password = password;
this.useSSL = useSSL;
this.serverTimezone = serverTimezone;
}

@Override
Expand Down Expand Up @@ -118,6 +120,11 @@ public String getUrl() {
return type.getUrl(host, port, database);
}

@Override
public String getServerTimezone() { return serverTimezone; }

public void setServerTimezone(String serverTimezone) { this.serverTimezone = serverTimezone; }

/**
* Returns username, password and ssl as Properties Object
* @return Properties with values for user, password and ssl
Expand All @@ -126,6 +133,7 @@ public Properties asProperties() {
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", password);
props.setProperty("serverTimezone", serverTimezone);

if (useSSL) {
props.setProperty("ssl", Boolean.toString(useSSL));
Expand Down Expand Up @@ -161,7 +169,9 @@ public boolean equals(Object obj) {
&& Objects.equals(port, properties.getPort())
&& Objects.equals(database, properties.getDatabase())
&& Objects.equals(user, properties.getUser())
&& Objects.equals(useSSL, properties.isUseSSL());
&& Objects.equals(useSSL, properties.isUseSSL())
&& Objects.equals(serverTimezone, properties.getServerTimezone());

}

@Override
Expand All @@ -184,6 +194,7 @@ private void setFromPreferences(SharedDatabasePreferences prefs) {
prefs.getPort().ifPresent(thePort -> this.port = Integer.parseInt(thePort));
prefs.getName().ifPresent(theDatabase -> this.database = theDatabase);
prefs.getKeyStoreFile().ifPresent(theKeystore -> this.keyStore = theKeystore);
prefs.getServerTimezone().ifPresent(theServerTimezone -> this.serverTimezone = theServerTimezone);
this.setUseSSL(prefs.isUseSSL());

if (prefs.getUser().isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class SharedDatabasePreferences {
private static final String SHARED_DATABASE_REMEMBER_PASSWORD = "sharedDatabaseRememberPassword";
private static final String SHARED_DATABASE_USE_SSL = "sharedDatabaseUseSSL";
private static final String SHARED_DATABASE_KEYSTORE_FILE = "sharedDatabaseKeyStoreFile";
private static final String SHARED_DATABASE_SERVER_TIMEZONE = "sharedDatabaseServerTimezone";

// This {@link Preferences} is used only for things which should not appear in real JabRefPreferences due to security reasons.
private final Preferences internalPrefs;
Expand Down Expand Up @@ -72,6 +73,10 @@ public Optional<String> getKeyStoreFile() {
return getOptionalValue(SHARED_DATABASE_KEYSTORE_FILE);
}

public Optional<String> getServerTimezone() {
return getOptionalValue(SHARED_DATABASE_SERVER_TIMEZONE);
}

public boolean getRememberPassword() {
return internalPrefs.getBoolean(SHARED_DATABASE_REMEMBER_PASSWORD, false);
}
Expand Down Expand Up @@ -116,6 +121,10 @@ public void setKeystoreFile(String keystoreFile) {
internalPrefs.put(SHARED_DATABASE_KEYSTORE_FILE, keystoreFile);
}

public void setServerTimezone(String serverTimezone) {
internalPrefs.put(SHARED_DATABASE_SERVER_TIMEZONE, serverTimezone);
}

public void clearPassword() {
internalPrefs.remove(SHARED_DATABASE_PASSWORD);
}
Expand All @@ -142,6 +151,7 @@ public void putAllDBMSConnectionProperties(DatabaseConnectionProperties properti
setUser(properties.getUser());
setUseSSL(properties.isUseSSL());
setKeystoreFile(properties.getKeyStore());
setServerTimezone(properties.getServerTimezone());

try {
setPassword(new Password(properties.getPassword().toCharArray(), properties.getUser()).encrypt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ public interface DatabaseConnectionProperties {

boolean isUseSSL();

String getServerTimezone();

}

0 comments on commit 04bea3e

Please sign in to comment.