Skip to content

Commit

Permalink
Merge branch 'hotfix-1.5.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed Jan 11, 2023
2 parents 3b6c3b1 + e70872e commit 7f5d50c
Show file tree
Hide file tree
Showing 35 changed files with 759 additions and 619 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Rare Disease Project

Registry for model organism researchers, developed for the Canadian Rare
Registry for model organism/system researchers, developed for the Canadian Rare
Disease Models & Mechanisms Network

14 changes: 11 additions & 3 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ set active = 1
where taxon_id = 10090;
```

Every time the new model organisms are added to the application, they will have to be activated in this manner.
Every time new model systems are added to the application, they will have to be activated in this manner.

### Customizing taxon appearance (new in 1.5.5)

By default, taxon are rendered using the common name in title case. The only exception is for *Homo sapiens* which
renders as "Human / Other". You may override this by setting the following entries in the `messages.properties` file,
replacing `{taxonId}` by the taxon ID of your choice:

```properties
rdp.taxa.{taxonId}.title=
```

## Ortholog mapping

Expand Down Expand Up @@ -578,8 +588,6 @@ Here's the list of paths that can be adjusted using the above setting:
```
static/
images/
model-organisms/
<taxon_id>.svg
organs/
<uberon_id>.svg
researcher-categories/
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Likewise, you can set up a proxy for FTP connections with `-Dftp.proxyHost` and
4. Create `application.properties`, and optionally `faq.properties` and
`messages.properties` if you want to [customize messages](customization.md#customizing-the-applications-messages).
5. Test your setup: `java -jar rdp-{{ config.extra.rdp_version }}.jar`
6. Log into the database and activate other organisms and organ systems (optional)
6. Log into the database and activate other model and organ systems (optional)
7. Deploy using [systemd](#integration-with-systemd) or a Docker container

## Integration with systemd
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rare Disease Project

Registry for model organism researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network
Registry for model organism/system researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network

2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ plugins:
markdown_extensions:
- admonition
extra:
rdp_version: 1.5.4
rdp_version: 1.5.5
git_ref: master
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<groupId>ubc.pavlab</groupId>
<artifactId>rdp</artifactId>
<version>1.5.4</version>
<version>1.5.5</version>

<description>
Registry for model organism researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network.
Registry for model organism/system researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network.
</description>

<developers>
Expand All @@ -28,7 +28,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.13</version>
<version>2.6.14</version>
</parent>

<dependencies>
Expand Down Expand Up @@ -113,7 +113,7 @@
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
<version>1.6.12</version>
<version>1.6.14</version>
</dependency>

<!-- Database Migration -->
Expand Down Expand Up @@ -148,6 +148,12 @@
<version>1.9.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>

<!-- Testing Support -->

<dependency>
Expand Down Expand Up @@ -191,7 +197,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220320</version>
<version>20220924</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -268,7 +274,7 @@
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.16.0</version>
<version>1.19.0</version>
<configuration>
<!-- Do not push to remote -->
<pushRemote>false</pushRemote>
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/ubc/pavlab/rdp/EmailConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ubc.pavlab.rdp;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
public class EmailConfig {

@Bean
public JavaMailSender emailSender() {
return new JavaMailSenderImpl();
}

@Bean
public AsyncTaskExecutor emailTaskExecutor() {
return new ThreadPoolTaskExecutor();
}
}
8 changes: 7 additions & 1 deletion src/main/java/ubc/pavlab/rdp/WebMvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
Expand Down Expand Up @@ -40,7 +42,6 @@ public HierarchicalMessageSource messageSourceWithoutOntology() {
}

@Bean

public MessageSource messageSource( @Qualifier("ontologyMessageSource") MessageSource ontologyMessageSource ) {
HierarchicalMessageSource messageSource = messageSourceWithoutOntology();
// if it cannot be resolved in messages.properties, then lookup some of our built-in resolution for
Expand All @@ -49,6 +50,11 @@ public MessageSource messageSource( @Qualifier("ontologyMessageSource") MessageS
return messageSource;
}

@Bean
public AsyncTaskExecutor adminTaskExecutor() {
return new ThreadPoolTaskExecutor();
}

/**
* CORS configuration for the /stats endpoint so that statistics can be queried from the main website.
*/
Expand Down
38 changes: 16 additions & 22 deletions src/main/java/ubc/pavlab/rdp/controllers/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import lombok.extern.apachecommons.CommonsLog;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.io.Resource;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
Expand Down Expand Up @@ -57,8 +59,6 @@
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -94,15 +94,9 @@ public class AdminController {
* Task executor used for background tasks.
* TODO: make this a configurable bean
*/
private final ExecutorService taskExecutor = Executors.newSingleThreadExecutor();

/**
* This is only meant for testing, please don't use.
*/
@Secured(value = {})
ExecutorService getTaskExecutor() {
return taskExecutor;
}
@Autowired
@Qualifier("adminTaskExecutor")
private AsyncTaskExecutor taskExecutor;

/**
* List all users
Expand Down Expand Up @@ -210,7 +204,7 @@ public Object revokeAccessTn( @PathVariable(required = false) User user, @PathVa
}

@Data
private static class ConfirmEmailForm {
public static class ConfirmEmailForm {
private String email;
}

Expand Down Expand Up @@ -279,7 +273,7 @@ public ModelAndView getOntology( @PathVariable(required = false) Ontology ontolo
}

@Data
private static class UpdateOntologyForm {
public static class UpdateOntologyForm {
public static UpdateOntologyForm fromOntology( Ontology ontology ) {
UpdateOntologyForm form = new UpdateOntologyForm();
form.setName( ontology.getName() );
Expand Down Expand Up @@ -371,7 +365,7 @@ public Object deleteOntology( @PathVariable(required = false) Ontology ontology,
}

@Data
private static class DeleteOntologyForm {
public static class DeleteOntologyForm {
@NotNull
private String ontologyNameConfirmation;
}
Expand Down Expand Up @@ -420,7 +414,7 @@ public Object updateSimpleOntology( @PathVariable(required = false) Ontology ont
}

@Data
private static class SimpleOntologyForm {
public static class SimpleOntologyForm {

public static final int DEFAULT_INITIAL_EMPTY_ROWS = 5;

Expand Down Expand Up @@ -798,18 +792,18 @@ private static class ReactomePathwaySummationsUpdateProgress {
}

@Data
private static class ActivateOrDeactivateOntologyForm {
public static class ActivateOrDeactivateOntologyForm {
private boolean includeTerms;
}

@Data
@EqualsAndHashCode(callSuper = true)
private static class ActivateOntologyForm extends ActivateOrDeactivateOntologyForm {
public static class ActivateOntologyForm extends ActivateOrDeactivateOntologyForm {
}

@Data
@EqualsAndHashCode(callSuper = true)
private static class DeactivateOntologyForm extends ActivateOrDeactivateOntologyForm {
public static class DeactivateOntologyForm extends ActivateOrDeactivateOntologyForm {
}

@PostMapping("/admin/ontologies/{ontology}/activate")
Expand Down Expand Up @@ -837,7 +831,7 @@ public Object deactivateOntology( @PathVariable(required = false) Ontology ontol
}

@Data
private static class ActivateOrDeactivateTermForm {
public static class ActivateOrDeactivateTermForm {
@NotEmpty
private String ontologyTermInfoId;
/**
Expand All @@ -848,7 +842,7 @@ private static class ActivateOrDeactivateTermForm {

@Data
@EqualsAndHashCode(callSuper = true)
private static class ActivateTermForm extends ActivateOrDeactivateTermForm {
public static class ActivateTermForm extends ActivateOrDeactivateTermForm {
/**
* Include the ontology in the activation.
*/
Expand All @@ -857,7 +851,7 @@ private static class ActivateTermForm extends ActivateOrDeactivateTermForm {

@Data
@EqualsAndHashCode(callSuper = true)
private static class DeactivateTermForm extends ActivateOrDeactivateTermForm {
public static class DeactivateTermForm extends ActivateOrDeactivateTermForm {
}

@PostMapping("/admin/ontologies/{ontology}/activate-term")
Expand Down Expand Up @@ -1008,7 +1002,7 @@ public Object move( @PathVariable(required = false) Ontology ontology, @RequestP
}

@Data
private static class ImportOntologyForm {
public static class ImportOntologyForm {
private URL ontologyUrl;
private MultipartFile ontologyFile;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public String viewUser( @PathVariable Integer userId,
}

@Data
private static class RequestAccessForm {
public static class RequestAccessForm {
@NotNull(message = "Reason cannot be blank.")
@Size(min = 1, message = "Reason cannot be blank.")
private String reason;
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/ubc/pavlab/rdp/controllers/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ModelAndView model( @PathVariable Integer taxonId ) {
} else {
modelAndView.addObject( "viewOnly", null );
modelAndView.addObject( "user", user );
modelAndView.addObject( "userGenes", user.getGenesByTaxonAndTier( taxon, TierType.MANUAL ) );
modelAndView.addObject( "userGenes", user.getGenesByTaxonAndTier( taxon, getManualTiers() ) );
modelAndView.addObject( "taxon", taxon );
}
return modelAndView;
Expand All @@ -106,7 +106,7 @@ public ModelAndView getTermsGenesForTaxon( @PathVariable Integer taxonId, @PathV
if ( term != null ) {
Collection<Integer> geneIds = goService.getGenesInTaxon( term, taxon );
modelAndView.addObject( "genes",
user.getGenesByTaxonAndTier( taxon, TierType.MANUAL ).stream()
user.getGenesByTaxonAndTier( taxon, getManualTiers() ).stream()
.filter( ug -> geneIds.contains( ug.getGeneId() ) )
.collect( Collectors.toSet() ) );
} else {
Expand Down Expand Up @@ -157,7 +157,7 @@ public ModelAndView support( SupportForm supportForm ) {
}

@Data
private static class SupportForm {
public static class SupportForm {
@NotNull(message = "You must provide your name.")
@Size(min = 1, message = "You must provide your name.")
private String name;
Expand Down Expand Up @@ -511,4 +511,8 @@ public Object getRecommendedTermsForTaxon( @PathVariable Integer taxonId,

return userService.recommendTerms( userService.findCurrentUser(), genes, taxon );
}

private Set<TierType> getManualTiers() {
return applicationSettings.getEnabledTiers().stream().filter( TierType.MANUAL::contains ).collect( Collectors.toSet() );
}
}
8 changes: 8 additions & 0 deletions src/main/java/ubc/pavlab/rdp/model/Taxon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import org.apache.commons.text.WordUtils;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Immutable;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.context.support.DefaultMessageSourceResolvable;

import javax.persistence.*;
import java.io.Serializable;
Expand Down Expand Up @@ -49,4 +52,9 @@ public static Comparator<Taxon> getComparator() {

@JsonIgnore
private Integer ordering;

@JsonIgnore
public MessageSourceResolvable getResolvableTitle() {
return new DefaultMessageSourceResolvable( new String[]{ "rdp.taxa." + id + ".title" }, WordUtils.capitalize( commonName ) );
}
}
Loading

0 comments on commit 7f5d50c

Please sign in to comment.