Skip to content

Commit 3b6c3b1

Browse files
committed
Merge branch 'hotfix-1.5.4'
2 parents 79c312c + 92d27c1 commit 3b6c3b1

File tree

74 files changed

+1684
-1568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1684
-1568
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ src/test/resources/cache/reactome_stable_ids.txt filter=lfs diff=lfs merge=lfs -
1919
src/test/resources/cache/nbo-base.obo filter=lfs diff=lfs merge=lfs -text
2020
src/main/resources/cache/DIOPT_filtered_data_Sept2022.gz filter=lfs diff=lfs merge=lfs -text
2121
src/main/resources/cache/DIOPT_filtered_data_May2021.gz filter=lfs diff=lfs merge=lfs -text
22+
src/test/resources/cache/mondo2.obo filter=lfs diff=lfs merge=lfs -text

docker-compose.yml

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
1+
mysql56:
2+
image: mysql:5.6
3+
ports:
4+
- "3306:3306"
5+
environment:
6+
- MYSQL_USER=springuser
7+
- MYSQL_PASSWORD=ThePassword
8+
- MYSQL_DATABASE=db_example
9+
- MYSQL_RANDOM_ROOT_PASSWORD=true
10+
mysql57:
11+
image: mysql:5.7
12+
ports:
13+
- "3306:3306"
14+
environment:
15+
- MYSQL_USER=springuser
16+
- MYSQL_PASSWORD=ThePassword
17+
- MYSQL_DATABASE=db_example
18+
- MYSQL_RANDOM_ROOT_PASSWORD=true
119
mysql:
2-
image: mysql
20+
image: mysql:8.0
321
ports:
422
- "3306:3306"
523
environment:
624
- MYSQL_USER=springuser
725
- MYSQL_PASSWORD=ThePassword
826
- MYSQL_DATABASE=db_example
927
- MYSQL_RANDOM_ROOT_PASSWORD=true
10-
volumes:
11-
- "./conf.d:/etc/mysql/conf.d:ro"
28+
mariadb:
29+
image: mariadb:10.6
30+
ports:
31+
- "3306:3306"
32+
environment:
33+
- MARIADB_USER=springuser
34+
- MARIADB_PASSWORD=ThePassword
35+
- MARIADB_DATABASE=db_example
36+
- MARIADB_RANDOM_ROOT_PASSWORD=true

docs/customization.md

+24-7
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ The content of `messages.properties` has precedence over the values stored in th
318318
categories and terms. This allows you to override values that are imported from an OBO source as you see fit.
319319

320320
```properties
321-
rdp.ontologies.{ontologyName}.title
322-
rdp.ontologies.{ontologyName}.definition
323-
rdp.ontologies.{ontologyName}.terms.{termName}.title
324-
rdp.ontologies.{ontologyName}.terms.{termName}.definition
321+
rdp.ontologies.{ontologyName}.title=
322+
rdp.ontologies.{ontologyName}.definition=
323+
rdp.ontologies.{ontologyName}.terms.{termName}.title=
324+
rdp.ontologies.{ontologyName}.terms.{termName}.definition=
325325
```
326326

327327
If your ontology/category is based on a [PURL](https://obofoundry.org/principles/fp-003-uris.html) source, its name will
@@ -520,13 +520,30 @@ In the file, each entry requires two parts: `rdp.faq.questions.<q_key>` and `rdp
520520
question and the corresponding answer, respectively.
521521

522522
```properties
523+
rdp.faq.keys=<q_key>
523524
rdp.faq.questions.<q_key>=A relevant question.
524525
rdp.faq.answers.<q_key>=A plausible answer.
525526
```
526527

527-
The provided default file can be found
528-
in [faq.properties](https://github.com/PavlidisLab/rdp/tree/{{ config.extra.git_ref
529-
}}/src/main/resources/faq.properties).
528+
The provided default file can be found in [faq.properties](https://github.com/PavlidisLab/rdp/tree/{{ config.extra.git_ref }}/src/main/resources/faq.properties).
529+
530+
### Ordering FAQ entries
531+
532+
!!! note
533+
534+
New in 1.5.4
535+
536+
he `rdp.faq.keys` FAQ setting can be used to customize the ordering and appearance of FAQ entries. If the setting is
537+
left unset, the default will be to arrange FAQ questions in alphabetic order of their keys.
538+
539+
### Translating FAQ entries
540+
541+
!!! note
542+
543+
New in 1.5.4
544+
545+
The FAQ messages can now be translated by reusing the `rdp.faq.questions.<q_key>` and `rdp.faq.answers.<q_key>` as codes
546+
for the `messages.properties` file.
530547

531548
## Terms of service and privacy policy
532549

docs/installation.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This section describes the essential steps to deploy an RDP registry.
1010

1111
## Obtain a distribution of RDP
1212

13-
Download the [latest JAR distribution](https://github.com/PavlidisLab/rdp/releases/latest) from GitHub.
13+
Download the [JAR distribution from GitHub](https://github.com/PavlidisLab/rdp/releases/v{{ config.extra.rdp_version }}).
1414

1515
```bash
1616
wget https://github.com/PavlidisLab/rdp/releases/download/v{{ config.extra.rdp_version }}/rdp-{{ config.extra.rdp_version }}.jar
@@ -29,9 +29,21 @@ create user '<database username>'@'%' identified by '<database password>';
2929
grant all on rdp.* to '<database username>'@'%';
3030
```
3131

32-
If you're using MySQL 5.6 or prior, use the `utf8` character set. It is a 3 bytes subset of the typical 4-bytes UTF-8
33-
character encoding. Otherwise, you will face issues with the index size limit of 767 bytes due to some of our indexed
34-
columns containing 255 characters (4 * 255 = 1020 > 767, but 3 * 255 = 765).
32+
If you're using MySQL 5.6 or prior, use the `utf8mb3` character set. It is a 3 bytes subset of the typical 4-bytes
33+
UTF-8 character encoding. Otherwise, you will face issues with the index size limit of 767 bytes due to some of our
34+
indexed columns containing 255 characters (4 * 255 = 1020 > 767, but 3 * 255 = 765).
35+
36+
You should also adjust Hibernate dialect by adding the following to your `application.properties`:
37+
38+
```properties
39+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect
40+
```
41+
42+
Likewise, if you are using MariaDB, for which we recommend the current 10.6 LTS, use the following dialect:
43+
44+
```properties
45+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDB106Dialect
46+
```
3547

3648
## Setup application.properties
3749

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ plugins:
1414
markdown_extensions:
1515
- admonition
1616
extra:
17-
rdp_version: 1.5.3
17+
rdp_version: 1.5.4
1818
git_ref: master

pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>ubc.pavlab</groupId>
77
<artifactId>rdp</artifactId>
8-
<version>1.5.3</version>
8+
<version>1.5.4</version>
99

1010
<description>
1111
Registry for model organism researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network.
@@ -28,7 +28,7 @@
2828
<parent>
2929
<groupId>org.springframework.boot</groupId>
3030
<artifactId>spring-boot-starter-parent</artifactId>
31-
<version>2.6.12</version>
31+
<version>2.6.13</version>
3232
</parent>
3333

3434
<dependencies>
@@ -113,7 +113,7 @@
113113
<dependency>
114114
<groupId>org.springdoc</groupId>
115115
<artifactId>springdoc-openapi-webmvc-core</artifactId>
116-
<version>1.6.11</version>
116+
<version>1.6.12</version>
117117
</dependency>
118118

119119
<!-- Database Migration -->
@@ -198,7 +198,7 @@
198198

199199
<properties>
200200
<java.version>1.8</java.version>
201-
<flyway.version>7.15.0</flyway.version>
201+
<flyway.version>5.2.4</flyway.version>
202202
<skipWebpack>false</skipWebpack>
203203
</properties>
204204

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package ubc.pavlab.rdp;
22

3+
import org.springframework.context.annotation.Configuration;
34
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
45

56
/**
67
* Configuration for auditing entities creation and modification with Spring Data JPA.
78
*
89
* @author poirigui
910
*/
11+
@Configuration
1012
@EnableJpaAuditing
1113
public class JpaAuditingConfig {
1214
}

src/main/java/ubc/pavlab/rdp/MigrationConfig.java

+46-31
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
77
import org.springframework.context.annotation.Bean;
88
import org.springframework.context.annotation.Configuration;
9+
import org.springframework.jdbc.core.ConnectionCallback;
10+
import org.springframework.jdbc.core.JdbcTemplate;
911

10-
import java.sql.Connection;
1112
import java.sql.ResultSet;
12-
import java.sql.SQLException;
1313
import java.util.Arrays;
1414

1515
/**
@@ -21,26 +21,43 @@
2121
@CommonsLog
2222
public class MigrationConfig {
2323

24+
@RequiredArgsConstructor
25+
private enum NewChecksumReason {
26+
/**
27+
* A migration applied with Flyway 3.
28+
* <p>
29+
* The checksum algorithm has changed.
30+
*/
31+
FLYWAY_3( "has been performed with Flyway 3.2.1" ),
32+
/**
33+
* A migration that introduced a regression with MySQL 5.7.
34+
*/
35+
MYSQL_5_7_REGRESSION( "introduced a regression with MySQL 5.7" );
36+
final String reason;
37+
}
38+
2439
/**
2540
* Expected migration information that are used to determine if a repair is necessary.
2641
*/
2742
@RequiredArgsConstructor
2843
private static class ExpectedMigrationInfo {
2944
private final String version;
30-
private final int pre15Checksum;
31-
private final int post15Checksum;
45+
private final int preRepairChecksum;
46+
private final int postRepairChecksum;
47+
private final NewChecksumReason newChecksumReason;
3248
}
3349

3450
private static final ExpectedMigrationInfo[] MIGRATION_META = {
35-
new ExpectedMigrationInfo( "1.0.0", -330642568, 1889522940 ),
36-
new ExpectedMigrationInfo( "1.3.2", 1109324745, 1109324745 ),
37-
new ExpectedMigrationInfo( "1.4.0", 310023814, 1017485172 ),
38-
new ExpectedMigrationInfo( "1.4.1", -1543189200, 1330781885 ),
39-
new ExpectedMigrationInfo( "1.4.2", 1706447069, 253128706 ),
40-
new ExpectedMigrationInfo( "1.4.3", 571489108, 571489108 ),
41-
new ExpectedMigrationInfo( "1.4.6", 399726006, 504755998 ),
42-
new ExpectedMigrationInfo( "1.4.11", 1536441374, 709491229 ),
43-
new ExpectedMigrationInfo( "1.4.11.1", -1312864724, -907949910 )
51+
new ExpectedMigrationInfo( "1.0.0", -330642568, 1889522940, NewChecksumReason.FLYWAY_3 ),
52+
new ExpectedMigrationInfo( "1.3.2", 1109324745, 1109324745, NewChecksumReason.FLYWAY_3 ),
53+
new ExpectedMigrationInfo( "1.4.0", 310023814, 1017485172, NewChecksumReason.FLYWAY_3 ),
54+
new ExpectedMigrationInfo( "1.4.1", -1543189200, 1330781885, NewChecksumReason.FLYWAY_3 ),
55+
new ExpectedMigrationInfo( "1.4.2", 1706447069, 253128706, NewChecksumReason.FLYWAY_3 ),
56+
new ExpectedMigrationInfo( "1.4.3", 571489108, 571489108, NewChecksumReason.FLYWAY_3 ),
57+
new ExpectedMigrationInfo( "1.4.6", 399726006, 504755998, NewChecksumReason.FLYWAY_3 ),
58+
new ExpectedMigrationInfo( "1.4.11", 1536441374, 709491229, NewChecksumReason.FLYWAY_3 ),
59+
new ExpectedMigrationInfo( "1.4.11.1", -1312864724, -907949910, NewChecksumReason.FLYWAY_3 ),
60+
new ExpectedMigrationInfo( "1.5.0.4", 625408518, -1065145387, NewChecksumReason.MYSQL_5_7_REGRESSION )
4461
};
4562

4663
/**
@@ -50,20 +67,17 @@ private static class ExpectedMigrationInfo {
5067
@Bean
5168
public FlywayMigrationStrategy flywayMigrationStrategy() {
5269
return flyway -> {
53-
try {
54-
// drop version_rank column
55-
Connection connection = flyway.getConfiguration().getDataSource().getConnection();
56-
// lookup the schema_version table and version_rank column
57-
boolean hasVersionRankColumn;
58-
try ( ResultSet resultSet = connection.getMetaData().getColumns( null, null, "schema_version", "version_rank" ) ) {
59-
hasVersionRankColumn = resultSet.next();
60-
}
61-
if ( hasVersionRankColumn ) {
62-
log.warn( "The 'schema_version' table is still using the 'version_rank' column from Flyway 3.2.1; will proceed to remove it..." );
63-
connection.createStatement().execute( "alter table schema_version drop column version_rank" );
70+
// drop version_rank column
71+
JdbcTemplate jdbcTemplate = new JdbcTemplate( flyway.getConfiguration().getDataSource() );
72+
// lookup the schema_version table and version_rank column
73+
Boolean hasVersionRankColumn = jdbcTemplate.execute( (ConnectionCallback<Boolean>) con -> {
74+
try ( ResultSet resultSet = con.getMetaData().getColumns( null, null, "schema_version", "version_rank" ) ) {
75+
return resultSet.next();
6476
}
65-
} catch ( SQLException e ) {
66-
throw new RuntimeException( e );
77+
} );
78+
if ( hasVersionRankColumn != null && hasVersionRankColumn ) {
79+
log.warn( "The 'schema_version' table is still using the 'version_rank' column from Flyway 3.2.1; will proceed to remove it..." );
80+
jdbcTemplate.execute( "alter table schema_version drop column version_rank" );
6781
}
6882
MigrationInfo[] appliedMigrations = flyway.info().applied();
6983
boolean repairNeeded = false;
@@ -74,15 +88,16 @@ public FlywayMigrationStrategy flywayMigrationStrategy() {
7488
.orElse( null );
7589
if ( expectedMigration != null &&
7690
appliedMigration.getChecksum() != null &&
77-
appliedMigration.getChecksum().equals( expectedMigration.pre15Checksum ) &&
78-
!appliedMigration.getChecksum().equals( expectedMigration.post15Checksum ) ) {
79-
log.warn( String.format( "Flyway migration %s has been performed with Flyway 3.2.1, checksum will be bumped from %s to %s after repair.",
80-
appliedMigration.getVersion(), appliedMigration.getChecksum(), expectedMigration.post15Checksum ) );
91+
appliedMigration.getChecksum().equals( expectedMigration.preRepairChecksum ) &&
92+
!appliedMigration.getChecksum().equals( expectedMigration.postRepairChecksum ) ) {
8193
repairNeeded = true;
94+
log.warn( String.format( "Flyway migration %s %s, checksum will be bumped from %s to %s after repair.",
95+
appliedMigration.getVersion(), expectedMigration.newChecksumReason.reason,
96+
appliedMigration.getChecksum(), expectedMigration.postRepairChecksum ) );
8297
}
8398
}
8499
if ( repairNeeded ) {
85-
log.warn( "Flyway 3.2.1 migrations detected, Flyway repair will be performed." );
100+
log.warn( "Flyway repair will now be performed." );
86101
flyway.repair();
87102
}
88103
flyway.migrate();

src/main/java/ubc/pavlab/rdp/RemoteResourceConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public AsyncRestTemplate remoteResourceRestTemplate( ApplicationSettings applica
1717
SimpleClientHttpRequestFactory httpRequestFactory = new SimpleClientHttpRequestFactory();
1818
httpRequestFactory.setTaskExecutor( new SimpleAsyncTaskExecutor() );
1919
if ( applicationSettings.getIsearch().getRequestTimeout() != null ) {
20-
log.warn( "The 'rdp.settings.isearch.request-timeout' configuration is deprecated." );
20+
log.warn( "The 'rdp.settings.isearch.request-timeout' configuration is deprecated, use 'rdp.settings.isearch.connect-timeout' and 'rdp.settings.isearch.read-timeout' instead." );
2121
httpRequestFactory.setConnectTimeout( 1000 );
2222
httpRequestFactory.setReadTimeout( (int) applicationSettings.getIsearch().getRequestTimeout().toMillis() );
2323
} else {

src/main/java/ubc/pavlab/rdp/controllers/AdminController.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import javax.validation.constraints.Size;
5454
import java.io.*;
5555
import java.net.URL;
56-
import java.sql.Timestamp;
5756
import java.text.MessageFormat;
5857
import java.time.Duration;
5958
import java.time.Instant;
@@ -134,7 +133,7 @@ public Object createServiceAccount( @Validated(User.ValidationServiceAccount.cla
134133

135134
user.setEmail( serviceEmail );
136135
user.setEnabled( true );
137-
user.setEnabledAt( Timestamp.from( Instant.now() ) );
136+
user.setEnabledAt( Instant.now() );
138137

139138
Profile profile = user.getProfile();
140139
profile.setPrivacyLevel( PrivacyLevelType.PRIVATE );

src/main/java/ubc/pavlab/rdp/controllers/ApiController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import ubc.pavlab.rdp.services.*;
3030
import ubc.pavlab.rdp.settings.ApplicationSettings;
3131
import ubc.pavlab.rdp.settings.SiteSettings;
32+
import ubc.pavlab.rdp.util.Messages;
3233

3334
import java.net.URI;
3435
import java.util.*;
@@ -426,7 +427,7 @@ private void initUserTerm( UserOntologyTerm term, Locale locale ) {
426427

427428
@SneakyThrows
428429
private <T extends RemoteResource> T initRemoteResource( T remoteResource, Locale locale ) {
429-
remoteResource.setOrigin( messageSource.getMessage( "rdp.site.shortname", null, locale ) );
430+
remoteResource.setOrigin( messageSource.getMessage( Messages.SHORTNAME, locale ) );
430431
// Ensure that the path of the URL is effectively stripped from any trailing slashes and that its string
431432
// representation is free of query parameters, fragments, etc.
432433
// The main reason we do this is to avoid double slashes when generating URLs to profiles on partner sites

src/main/java/ubc/pavlab/rdp/model/AccessToken.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
import ubc.pavlab.rdp.model.enums.PrivacyLevelType;
88

99
import javax.persistence.*;
10-
import java.sql.Timestamp;
1110
import java.time.Duration;
12-
import java.time.Period;
13-
import java.time.temporal.ChronoUnit;
11+
import java.time.Instant;
1412
import java.time.temporal.TemporalAmount;
1513
import java.util.Optional;
1614

@@ -31,7 +29,7 @@ public class AccessToken extends Token implements UserContent {
3129
private User user;
3230

3331
@CreatedDate
34-
private Timestamp createdAt;
32+
private Instant createdAt;
3533

3634
@Override
3735
protected TemporalAmount getDuration() {

src/main/java/ubc/pavlab/rdp/model/Gene.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import javax.persistence.*;
1111
import java.io.Serializable;
12-
import java.util.Date;
12+
import java.time.LocalDate;
1313

1414
/**
1515
* Created by mjacobson on 17/01/18.
@@ -41,7 +41,6 @@ public abstract class Gene implements Serializable {
4141
private String aliases;
4242

4343
@JsonIgnore
44-
@Temporal(TemporalType.DATE)
4544
@Column(name = "modification_date")
46-
private Date modificationDate;
45+
private LocalDate modificationDate;
4746
}

0 commit comments

Comments
 (0)