Skip to content

Commit

Permalink
Merge pull request #247 from OHDSI/Release-1.12.2
Browse files Browse the repository at this point in the history
Release 1.12.2
  • Loading branch information
agackovka authored Jul 4, 2018
2 parents 282b620 + 89d8dc1 commit b1e5022
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 36 deletions.
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<artifactId>datanode</artifactId>
<groupId>com.odysseusinc.arachne</groupId>
<version>1.12.1</version>
<version>1.12.2</version>
<packaging>jar</packaging>


Expand All @@ -26,7 +26,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<jjwt.version>0.6.0</jjwt.version>
<postgresql.version>9.1-901-1.jdbc4</postgresql.version>
<postgresql.version>42.2.1</postgresql.version>
<flywayVersion>4.2.0</flywayVersion>
<javaDockerVersion>3.0.6</javaDockerVersion>
<springRetryVersion>1.2.0.RELEASE</springRetryVersion>
Expand All @@ -53,6 +53,12 @@
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.odysseusinc.arachne</groupId>
<artifactId>arachne-no-handler-found-exception-util</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.odysseusinc.arachne</groupId>
<artifactId>execution-engine-commons</artifactId>
Expand Down Expand Up @@ -89,7 +95,7 @@
</dependency>

<dependency>
<groupId>postgresql</groupId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

registry.addResourceHandler("public/**").addResourceLocations("classpath:/public/");
}

@Override
public void addViewControllers(ViewControllerRegistry registry) {

registry.addViewController("/dashboard**").setViewName("index");
registry.addViewController("/study-notebook**").setViewName("index");
registry.addViewController("/auth/login**").setViewName("index");
registry.addViewController("/auth/register**").setViewName("index");
registry.addViewController("/expert-finder**").setViewName("index");
registry.addViewController("/data-catalog**").setViewName("index");
registry.addViewController("/insights-library**").setViewName("index");
registry.addViewController("/study-manager/studies/**").setViewName("index");
registry.addViewController("analysis-execution/analyses/**").setViewName("index");
registry.addViewController("/cdm-source-list/data-sources**").setViewName("index");
registry.addViewController("/cdm-source-list/data-sources/**").setViewName("index");
registry.addViewController("/admin-settings/**").setViewName("index");
}

@Bean
public BeanPostProcessor commonAnnotationBeanPostProcessor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.VALIDATION_ERROR;

import com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult;
import com.odysseusinc.arachne.nohandlerfoundexception.NoHandlerFoundExceptionUtils;
import com.odysseusinc.arachne.datanode.exception.AuthException;
import com.odysseusinc.arachne.datanode.exception.IllegalOperationException;
import com.odysseusinc.arachne.datanode.exception.IntegrationValidationException;
Expand All @@ -37,7 +38,8 @@
import java.sql.SQLException;
import java.util.Objects;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -47,6 +49,7 @@
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.NoHandlerFoundException;

@ControllerAdvice
public class ExceptionHandlingAdvice extends BaseController {
Expand All @@ -57,9 +60,12 @@ public class ExceptionHandlingAdvice extends BaseController {
@Value("${datanode.app.errorsTokenEnabled}")
private boolean errorsTokenEnabled;

public ExceptionHandlingAdvice(UserService userService) {
private NoHandlerFoundExceptionUtils noHandlerFoundExceptionUtils;

public ExceptionHandlingAdvice(UserService userService, NoHandlerFoundExceptionUtils noHandlerFoundExceptionUtils) {

super(userService);
this.noHandlerFoundExceptionUtils = noHandlerFoundExceptionUtils;
}

@ExceptionHandler({SQLException.class, DataAccessException.class})
Expand Down Expand Up @@ -99,13 +105,12 @@ public ResponseEntity<JsonResult> exceptionHandler(AuthException ex) {
private ResponseEntity<JsonResult> getErrorResponse(JsonResult.ErrorCode errorCode, Exception ex) {

JsonResult result = new JsonResult<>(errorCode);
return getErrorResponse(result, ex);
return getErrorResponse(result, ex);
}

private ResponseEntity<JsonResult> getErrorResponse(final JsonResult result, final Exception ex) {

final String message = getErrorMessage(result, ex);

result.setErrorMessage(message);

if (errorsTokenEnabled) {
Expand All @@ -115,7 +120,6 @@ private ResponseEntity<JsonResult> getErrorResponse(final JsonResult result, fin
} else {
LOGGER.error(message, ex);
}

return new ResponseEntity<>(result, HttpStatus.OK);
}

Expand Down Expand Up @@ -155,4 +159,9 @@ private String generateErrorToken() {
return UUID.randomUUID().toString();
}

@ExceptionHandler({NoHandlerFoundException.class})
public void handleNotFoundError(HttpServletRequest request, HttpServletResponse response) throws Exception {

noHandlerFoundExceptionUtils.handleNotFoundError(request, response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult;
import com.odysseusinc.arachne.commons.utils.UserIdUtils;
import com.odysseusinc.arachne.datanode.controller.BaseController;
import com.odysseusinc.arachne.datanode.dto.user.UserDTO;
import com.odysseusinc.arachne.datanode.exception.PermissionDeniedException;
import com.odysseusinc.arachne.datanode.model.atlas.Atlas;
Expand All @@ -41,11 +42,10 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

public abstract class BaseAdminController {
public abstract class BaseAdminController extends BaseController {

public static final int SUGGEST_LIMIT = 10;

protected UserService userService;
protected GenericConversionService conversionService;
protected AtlasService atlasService;

Expand All @@ -55,7 +55,7 @@ public BaseAdminController(
GenericConversionService conversionService,
AtlasService atlasService
) {
this.userService = userService;
super(userService);
this.conversionService = conversionService;
this.atlasService = atlasService;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ spring:
view:
prefix: /
suffix: .html
throw-exception-if-no-handler-found: true
resources:
add-mappings: false
activemq:
packages:
trust-all: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DELETE FROM system_settings USING system_settings_groups sg
WHERE group_id = sg.id AND sg.name = 'atlas';

DELETE FROM system_settings_groups WHERE name = 'atlas';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INSERT INTO system_settings_groups (label, name) VALUES ('Atlas WebAPI', 'atlas') ON CONFLICT (name) DO NOTHING;

INSERT INTO system_settings (group_id, label, name, value, type) VALUES ((SELECT id FROM system_settings_groups WHERE name = 'atlas'), 'Cohort patients log enabled', 'cohorts.result.summaryEnabled', null, 'checkbox') ON CONFLICT (name) DO NOTHING;
INSERT INTO system_settings (group_id, label, name, value, type) VALUES ((SELECT id FROM system_settings_groups WHERE name = 'atlas'), 'Cohort patients count enable', 'cohorts.result.countEnabled', null, 'checkbox') ON CONFLICT (name) DO NOTHING;
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.odysseusinc.arachne.commons.utils.ConverterUtils;
import com.odysseusinc.arachne.datanode.model.achilles.AchillesJob;
import com.odysseusinc.arachne.datanode.repository.AchillesJobRepository;
import com.odysseusinc.arachne.nohandlerfoundexception.NoHandlerFoundExceptionUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -83,6 +84,8 @@ public class AchillesControllerTest {

@MockBean
private ConverterUtils converterUtils;
@MockBean
private NoHandlerFoundExceptionUtils noHandlerFoundExceptionUtils;

@Before
public void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import com.odysseusinc.arachne.commons.utils.ConverterUtils;
import com.odysseusinc.arachne.datanode.service.impl.CohortServiceImpl;
import com.odysseusinc.arachne.nohandlerfoundexception.NoHandlerFoundExceptionUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -63,7 +64,8 @@ public class CohortServiceTest {

@MockBean
private ConverterUtils converterUtils;

@MockBean
private NoHandlerFoundExceptionUtils noHandlerFoundExceptionUtils;

public CohortServiceTest() throws IOException {

Expand Down

0 comments on commit b1e5022

Please sign in to comment.