Skip to content

Commit 68d53fb

Browse files
committed
Merge tag 'v1.5.10' into development
Tag hotfix
2 parents d8e2c72 + 1448a4d commit 68d53fb

File tree

91 files changed

+1430
-1222
lines changed

Some content is hidden

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

91 files changed

+1430
-1222
lines changed

pom.xml

+16-7
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@
140140
<dependency>
141141
<groupId>commons-io</groupId>
142142
<artifactId>commons-io</artifactId>
143-
<version>2.16.1</version>
143+
<version>2.17.0</version>
144144
</dependency>
145145

146146
<dependency>
147147
<groupId>org.apache.commons</groupId>
148148
<artifactId>commons-csv</artifactId>
149-
<version>1.11.0</version>
149+
<version>1.12.0</version>
150150
</dependency>
151151

152152
<dependency>
@@ -159,7 +159,7 @@
159159
<dependency>
160160
<groupId>nl.basjes.parse.useragent</groupId>
161161
<artifactId>yauaa</artifactId>
162-
<version>7.26.1</version>
162+
<version>7.28.1</version>
163163
</dependency>
164164

165165
<!-- Testing Support -->
@@ -229,7 +229,7 @@
229229
<plugin>
230230
<groupId>org.apache.maven.plugins</groupId>
231231
<artifactId>maven-enforcer-plugin</artifactId>
232-
<version>1.4.1</version>
232+
<version>3.5.0</version>
233233
<executions>
234234
<execution>
235235
<id>enforce-maven</id>
@@ -239,7 +239,7 @@
239239
<configuration>
240240
<rules>
241241
<requireMavenVersion>
242-
<version>[3.0.5,)</version>
242+
<version>[3.6.3,)</version>
243243
</requireMavenVersion>
244244
</rules>
245245
</configuration>
@@ -249,7 +249,7 @@
249249
<plugin>
250250
<groupId>org.codehaus.mojo</groupId>
251251
<artifactId>exec-maven-plugin</artifactId>
252-
<version>3.0.0</version>
252+
<version>3.4.1</version>
253253
<executions>
254254
<execution>
255255
<id>npm-install-dependencies</id>
@@ -302,7 +302,7 @@
302302
<plugin>
303303
<groupId>com.amashchenko.maven.plugin</groupId>
304304
<artifactId>gitflow-maven-plugin</artifactId>
305-
<version>1.19.0</version>
305+
<version>1.21.0</version>
306306
<configuration>
307307
<!-- Do not push to remote -->
308308
<pushRemote>false</pushRemote>
@@ -321,6 +321,15 @@
321321
</gitFlowConfig>
322322
</configuration>
323323
</plugin>
324+
<plugin>
325+
<groupId>org.codehaus.mojo</groupId>
326+
<artifactId>versions-maven-plugin</artifactId>
327+
<version>2.17.1</version>
328+
<configuration>
329+
<allowMajorUpdates>false</allowMajorUpdates>
330+
<processDependencyManagement>false</processDependencyManagement>
331+
</configuration>
332+
</plugin>
324333
</plugins>
325334
</build>
326335

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

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.springframework.boot.SpringApplication;
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66
import org.springframework.cache.annotation.EnableCaching;
7-
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
87
import org.springframework.scheduling.annotation.EnableScheduling;
98

109
@SpringBootApplication

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

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

33
import lombok.extern.apachecommons.CommonsLog;
4-
import org.springframework.beans.BeansException;
5-
import org.springframework.context.ApplicationContext;
6-
import org.springframework.context.ApplicationContextAware;
74
import org.springframework.context.ResourceLoaderAware;
85
import org.springframework.context.annotation.Configuration;
9-
import org.springframework.context.support.GenericApplicationContext;
106
import org.springframework.core.io.DefaultResourceLoader;
117
import org.springframework.core.io.ResourceLoader;
128
import ubc.pavlab.rdp.util.PurlResolver;

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.springframework.context.annotation.Configuration;
99
import org.springframework.core.io.Resource;
1010
import org.springframework.http.converter.FormHttpMessageConverter;
11+
import org.springframework.lang.Nullable;
1112
import org.springframework.web.client.RestTemplate;
1213
import ubc.pavlab.rdp.validation.*;
1314

@@ -27,8 +28,8 @@ public class ValidationConfig {
2728

2829
@Bean
2930
public EmailValidator emailValidator(
30-
@Value("${rdp.settings.allowed-email-domains}") List<String> allowedEmailDomains,
31-
@Value("${rdp.settings.allowed-email-domains-file}") Resource allowedEmailDomainsFile,
31+
@Value("${rdp.settings.allowed-email-domains}") @Nullable List<String> allowedEmailDomains,
32+
@Value("${rdp.settings.allowed-email-domains-file}") @Nullable Resource allowedEmailDomainsFile,
3233
@Value("${rdp.settings.allowed-email-domains-file-refresh-delay}") @DurationUnit(ChronoUnit.SECONDS) Duration refreshDelay,
3334
@Value("${rdp.settings.allow-internationalized-email-domains}") boolean allowIdn ) throws IOException {
3435
List<AllowedDomainStrategy> strategies = new ArrayList<>();

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

-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import ubc.pavlab.rdp.security.authentication.TokenBasedAuthenticationManager;
2626
import ubc.pavlab.rdp.services.UserService;
2727
import ubc.pavlab.rdp.settings.ApplicationSettings;
28-
import ubc.pavlab.rdp.settings.SiteSettings;
2928

3029
import javax.servlet.*;
3130
import javax.servlet.http.HttpServletRequest;
@@ -63,9 +62,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
6362
@Autowired
6463
private UserService userService;
6564

66-
@Autowired
67-
private SiteSettings siteSettings;
68-
6965
@Override
7066
protected void configure( AuthenticationManagerBuilder auth ) throws Exception {
7167
auth.userDetailsService( userDetailsService ).passwordEncoder( bCryptPasswordEncoder );

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

+26-18
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public Object createServiceAccount( @Validated(User.ValidationServiceAccount.cla
148148
}
149149

150150
@PostMapping(value = "/admin/users/{user}/roles")
151-
public Object updateRoles( @PathVariable User user, @RequestParam(required = false) Set<Role> roles, RedirectAttributes redirectAttributes, Locale locale ) {
151+
public Object updateRoles( @PathVariable User user, @RequestParam(required = false) @Nullable Set<Role> roles, RedirectAttributes redirectAttributes, Locale locale ) {
152152
if ( roles == null ) {
153153
roles = Collections.emptySet();
154154
}
@@ -176,7 +176,7 @@ public Object updateRoles( @PathVariable User user, @RequestParam(required = fal
176176
* Retrieve a user's details.
177177
*/
178178
@GetMapping(value = "/admin/users/{user}")
179-
public Object getUser( @PathVariable(required = false) User user, @SuppressWarnings("unused") ConfirmEmailForm confirmEmailForm, Locale locale ) {
179+
public Object getUser( @PathVariable(required = false) @Nullable User user, @SuppressWarnings("unused") ConfirmEmailForm confirmEmailForm, Locale locale ) {
180180
if ( user == null ) {
181181
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
182182
.addObject( "message", messageSource.getMessage( "AdminController.userNotFoundById", null, locale ) );
@@ -185,7 +185,7 @@ public Object getUser( @PathVariable(required = false) User user, @SuppressWarni
185185
}
186186

187187
@PostMapping(value = "/admin/users/{user}/create-access-token")
188-
public Object createAccessTokenForUser( @PathVariable(required = false) User user, RedirectAttributes redirectAttributes, Locale locale ) {
188+
public Object createAccessTokenForUser( @PathVariable(required = false) @Nullable User user, RedirectAttributes redirectAttributes, Locale locale ) {
189189
if ( user == null ) {
190190
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
191191
.addObject( "message", messageSource.getMessage( "AdminController.userNotFoundById", null, locale ) );
@@ -196,7 +196,7 @@ public Object createAccessTokenForUser( @PathVariable(required = false) User use
196196
}
197197

198198
@PostMapping(value = "/admin/users/{user}/revoke-access-token/{accessToken}")
199-
public Object revokeAccessTn( @PathVariable(required = false) User user, @PathVariable(required = false) AccessToken accessToken, RedirectAttributes redirectAttributes, Locale locale ) {
199+
public Object revokeAccessTn( @PathVariable(required = false) @Nullable User user, @PathVariable(required = false) @Nullable AccessToken accessToken, RedirectAttributes redirectAttributes, Locale locale ) {
200200
if ( user == null ) {
201201
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
202202
.addObject( "message", messageSource.getMessage( "AdminController.userNotFoundById", null, locale ) );
@@ -218,7 +218,7 @@ public static class ConfirmEmailForm {
218218
* Delete a given user.
219219
*/
220220
@DeleteMapping(value = "/admin/users/{user}")
221-
public Object deleteUser( @PathVariable(required = false) User user,
221+
public Object deleteUser( @PathVariable(required = false) @Nullable User user,
222222
@Valid ConfirmEmailForm confirmEmailForm, BindingResult bindingResult,
223223
Locale locale ) {
224224
if ( user == null ) {
@@ -245,7 +245,7 @@ public ModelAndView getOntologies( @SuppressWarnings("unused") ImportOntologyFor
245245
}
246246

247247
@GetMapping("/admin/ontologies/{ontology}")
248-
public ModelAndView getOntology( @PathVariable(required = false) Ontology ontology, Locale locale ) {
248+
public ModelAndView getOntology( @PathVariable(required = false) @Nullable Ontology ontology, Locale locale ) {
249249
if ( ontology == null ) {
250250
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
251251
.addObject( "message", messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
@@ -293,15 +293,17 @@ public static UpdateOntologyForm fromOntology( Ontology ontology ) {
293293
@Size(min = 1, max = Ontology.MAX_NAME_LENGTH)
294294
private String name;
295295

296+
@Nullable
296297
private String definition;
297298

299+
@Nullable
298300
private URL ontologyUrl;
299301

300302
private boolean availableForGeneSearch;
301303
}
302304

303305
@PostMapping("/admin/ontologies/{ontology}")
304-
public ModelAndView updateOntology( @PathVariable(required = false) Ontology ontology,
306+
public ModelAndView updateOntology( @PathVariable(required = false) @Nullable Ontology ontology,
305307
@Valid UpdateOntologyForm updateOntologyForm, BindingResult bindingResult,
306308
Locale locale ) {
307309
if ( ontology == null ) {
@@ -337,7 +339,7 @@ public ModelAndView updateOntology( @PathVariable(required = false) Ontology ont
337339
}
338340

339341
@DeleteMapping("/admin/ontologies/{ontology}")
340-
public Object deleteOntology( @PathVariable(required = false) Ontology ontology,
342+
public Object deleteOntology( @PathVariable(required = false) @Nullable Ontology ontology,
341343
@Valid DeleteOntologyForm deleteOntologyForm, BindingResult bindingResult,
342344
RedirectAttributes redirectAttributes,
343345
Locale locale ) {
@@ -395,7 +397,7 @@ public Object createSimpleOntology( @SuppressWarnings("unused") ImportOntologyFo
395397
}
396398

397399
@PostMapping("/admin/ontologies/{ontology}/update-simple-ontology")
398-
public Object updateSimpleOntology( @PathVariable(required = false) Ontology ontology,
400+
public Object updateSimpleOntology( @PathVariable(required = false) @Nullable Ontology ontology,
399401
@Valid SimpleOntologyForm simpleOntologyForm, BindingResult bindingResult,
400402
RedirectAttributes redirectAttributes, Locale locale ) {
401403
if ( ontology == null ) {
@@ -483,6 +485,7 @@ public static SimpleOntologyTermForm emptyRow() {
483485
/**
484486
* Auto-generated if null or empty, which is why we allow zero as a size.
485487
*/
488+
@Nullable
486489
@Size(max = OntologyTermInfo.MAX_TERM_ID_LENGTH, groups = RowNotEmpty.class)
487490
private String termId;
488491
@NotNull(groups = RowNotEmpty.class)
@@ -631,7 +634,7 @@ public void initBinding2( WebDataBinder webDataBinder ) {
631634
}
632635

633636
@PostMapping("/admin/ontologies/{ontology}/update")
634-
public Object updateOntology( @PathVariable(required = false) Ontology ontology,
637+
public Object updateOntology( @PathVariable(required = false) @Nullable Ontology ontology,
635638
RedirectAttributes redirectAttributes,
636639
Locale locale ) {
637640
if ( ontology == null ) {
@@ -716,7 +719,12 @@ public Object importReactomePathways( RedirectAttributes redirectAttributes ) {
716719
@PostMapping("/admin/ontologies/{ontology}/update-reactome-pathways")
717720
public Object updateReactomePathways( @PathVariable(required = false) @Nullable Ontology ontology, RedirectAttributes redirectAttributes, Locale locale ) {
718721
// null-check is not necessary, but can save a database call
719-
if ( ontology == null || !ontology.equals( reactomeService.findPathwaysOntology() ) ) {
722+
if ( ontology == null ) {
723+
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
724+
.addObject( "message", messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
725+
}
726+
Ontology reactome = reactomeService.findPathwaysOntology();
727+
if ( reactome == null || !reactome.equals( ontology ) ) {
720728
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
721729
.addObject( "message", messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
722730
}
@@ -821,7 +829,7 @@ public static class DeactivateOntologyForm extends ActivateOrDeactivateOntologyF
821829
}
822830

823831
@PostMapping("/admin/ontologies/{ontology}/activate")
824-
public Object activateOntology( @PathVariable(required = false) Ontology ontology, ActivateOntologyForm activateOntologyForm, RedirectAttributes redirectAttributes, Locale locale ) {
832+
public Object activateOntology( @PathVariable(required = false) @Nullable Ontology ontology, ActivateOntologyForm activateOntologyForm, RedirectAttributes redirectAttributes, Locale locale ) {
825833
if ( ontology == null ) {
826834
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
827835
.addObject( "message", messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
@@ -833,7 +841,7 @@ public Object activateOntology( @PathVariable(required = false) Ontology ontolog
833841
}
834842

835843
@PostMapping("/admin/ontologies/{ontology}/deactivate")
836-
public Object deactivateOntology( @PathVariable(required = false) Ontology ontology, DeactivateOntologyForm deactivateOntologyForm, RedirectAttributes redirectAttributes, Locale locale ) {
844+
public Object deactivateOntology( @PathVariable(required = false) @Nullable Ontology ontology, DeactivateOntologyForm deactivateOntologyForm, RedirectAttributes redirectAttributes, Locale locale ) {
837845
if ( ontology == null ) {
838846
return new ModelAndView( "error/404", HttpStatus.NOT_FOUND )
839847
.addObject( "message", messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
@@ -890,7 +898,7 @@ public Object deactivateTerm( @PathVariable(required = false) Ontology ontology,
890898
return activateOrDeactivateTerm( ontology, deactivateTermForm, bindingResult, redirectAttributes, locale );
891899
}
892900

893-
private Object activateOrDeactivateTerm( Ontology ontology,
901+
private Object activateOrDeactivateTerm( @Nullable Ontology ontology,
894902
ActivateOrDeactivateTermForm activateOrDeactivateTermForm, BindingResult bindingResult,
895903
RedirectAttributes redirectAttributes,
896904
Locale locale ) {
@@ -901,7 +909,7 @@ private Object activateOrDeactivateTerm( Ontology ontology,
901909
OntologyTermInfo ontologyTermInfo = null;
902910

903911
if ( !bindingResult.hasFieldErrors( "ontologyTermInfoId" ) ) {
904-
ontologyTermInfo = ontologyService.findTermByTermIdAndOntology( activateOrDeactivateTermForm.ontologyTermInfoId, ontology );
912+
ontologyTermInfo = ontologyService.findTermByTermIdAndOntology( activateOrDeactivateTermForm.ontologyTermInfoId, ontology ).orElse( null );
905913
if ( ontologyTermInfo == null ) {
906914
bindingResult.rejectValue( "ontologyTermInfoId", "AdminController.ActivateOrDeactivateTermForm.unknownTermInOntology",
907915
new String[]{ activateOrDeactivateTermForm.getOntologyTermInfoId(), messageSource.getMessage( ontology.getResolvableTitle(), locale ) }, null );
@@ -953,7 +961,7 @@ private Object activateOrDeactivateTerm( Ontology ontology,
953961
* Provides the ontology in OBO format.
954962
*/
955963
@GetMapping(value = "/admin/ontologies/{ontology}/download", produces = "text/plain")
956-
public ResponseEntity<StreamingResponseBody> downloadOntology( @PathVariable(required = false) Ontology ontology, TimeZone timeZone ) {
964+
public ResponseEntity<StreamingResponseBody> downloadOntology( @PathVariable(required = false) @Nullable Ontology ontology, TimeZone timeZone ) {
957965
if ( ontology == null ) {
958966
return ResponseEntity.notFound().build();
959967
}
@@ -969,7 +977,7 @@ public ResponseEntity<StreamingResponseBody> downloadOntology( @PathVariable(req
969977

970978
@ResponseBody
971979
@GetMapping("/admin/ontologies/{ontology}/autocomplete-terms")
972-
public Object autocompleteOntologyTerms( @PathVariable(required = false) Ontology ontology, @RequestParam String query, Locale locale ) {
980+
public Object autocompleteOntologyTerms( @PathVariable(required = false) @Nullable Ontology ontology, @RequestParam String query, Locale locale ) {
973981
if ( ontology == null ) {
974982
return ResponseEntity.status( HttpStatus.NOT_FOUND )
975983
.body( messageSource.getMessage( "AdminController.ontologyNotFoundById", null, locale ) );
@@ -993,7 +1001,7 @@ public ResponseEntity<String> refreshMessages() {
9931001
}
9941002

9951003
@PostMapping("/admin/ontologies/{ontology}/move")
996-
public Object move( @PathVariable(required = false) Ontology ontology, @RequestParam String direction,
1004+
public Object move( @PathVariable(required = false) @Nullable Ontology ontology, @RequestParam String direction,
9971005
@SuppressWarnings("unused") ImportOntologyForm importOntologyForm,
9981006
Locale locale ) {
9991007
if ( ontology == null ) {

0 commit comments

Comments
 (0)