Skip to content

Commit

Permalink
Merge pull request #774 from OHDSI/1.19.0-QA-into-master
Browse files Browse the repository at this point in the history
Merging the latest 'qa' into 'master'
  • Loading branch information
alex-odysseus authored Mar 14, 2022
2 parents de63ba2 + 93f9d85 commit 5da00cf
Show file tree
Hide file tree
Showing 54 changed files with 1,137 additions and 340 deletions.
Binary file added ARACHNE 2.0 User Guide 2021.pdf
Binary file not shown.
50 changes: 43 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

<artifactId>portal</artifactId>
<groupId>com.odysseusinc.arachne</groupId>
<version>1.18.0</version>
<version>1.19.0</version>
<packaging>jar</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.18.RELEASE</version>
<version>2.2.13.RELEASE</version>
<relativePath/>
</parent>

Expand All @@ -33,9 +33,12 @@
<ehcache.version>1.3.0</ehcache.version>
<gson.version>2.7</gson.version>
<jodConverter.version>4.3.0</jodConverter.version>
<postgresql.version>42.2.19</postgresql.version>
<postgresql.version>42.2.25</postgresql.version>
<springRetryVersion>1.2.4.RELEASE</springRetryVersion>
<bcprov-jdk15on.version>1.68</bcprov-jdk15on.version>

<!-- Referencing https://github.com/OHDSI/ArachneUI -->
<portal-resources.version>1.19.1</portal-resources.version>
</properties>

<profiles>
Expand Down Expand Up @@ -95,7 +98,7 @@
<dependency>
<artifactId>solr-solrj</artifactId>
<groupId>org.apache.solr</groupId>
<version>7.7.3</version>
<version>8.2.0</version>
</dependency>
<dependency>
<groupId>org.ohdsi</groupId>
Expand Down Expand Up @@ -183,6 +186,10 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
Expand Down Expand Up @@ -319,12 +326,17 @@
<dependency>
<groupId>org.ohdsi.sql</groupId>
<artifactId>SqlRender</artifactId>
<version>1.6.5</version>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.cosium.spring.data</groupId>
<artifactId>spring-data-jpa-entity-graph</artifactId>
<version>2.1.0</version>
<version>2.2.8</version>
</dependency>
<!-- Ensure that spring-data-jpa version is taken from parent dependency management, not from spring-data-jpa-entity-graph -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.jodconverter</groupId>
Expand Down Expand Up @@ -360,6 +372,30 @@
<groupId>org.ohdsi</groupId>
<artifactId>authenticator</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>solr</artifactId>
<version>1.16.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -417,7 +453,7 @@
<artifactItem>
<groupId>com.odysseusinc.arachne</groupId>
<artifactId>portal-resources</artifactId>
<version>${project.version}</version>
<version>${portal-resources.version}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.basedir}/src/main/resources/public/</outputDirectory>
Expand Down
6 changes: 3 additions & 3 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM hub.odysseusinc.com/portal_env:1.1.0
FROM hub.odysseusinc.com/portal_env:1.1.1
MAINTAINER [email protected]
USER root
VOLUME /tmp
ADD portal-exec.jar /portal.jar
ADD run.sh /bin/run.sh
RUN chmod +x /bin/run.sh
EXPOSE 8080 5434 8983
CMD ["/bin/run.sh"]
EXPOSE 8443 5434 8983
CMD ["/bin/run.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package com.odysseusinc.arachne.portal.api.v1.controller;

import com.odysseusinc.arachne.portal.config.PortalAuthMethodConfig;
import com.odysseusinc.arachne.portal.security.passwordvalidator.ArachnePasswordValidator;
import com.odysseusinc.arachne.portal.service.AuthenticationService;
import com.odysseusinc.arachne.portal.service.LoginAttemptService;
Expand All @@ -30,6 +31,8 @@
import com.odysseusinc.arachne.portal.service.AuthenticationHelperService;
import com.odysseusinc.arachne.portal.service.UserService;
import org.ohdsi.authenticator.service.authentication.Authenticator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties;
import org.springframework.web.bind.annotation.RestController;

@RestController
Expand All @@ -42,15 +45,18 @@ public AuthenticationController(Authenticator authenticator,
ProfessionalTypeService professionalTypeService,
LoginAttemptService loginAttemptService,
AuthenticationService authenticationService,
AuthenticationHelperService authenticationHelperService) {

AuthenticationHelperService authenticationHelperService,
@Autowired(required = false) PortalAuthMethodConfig oAuth2ClientProperties
) {
super( authenticator,
userService,
passwordResetService,
passwordValidator,
professionalTypeService,
loginAttemptService,
authenticationService,
authenticationHelperService);
authenticationHelperService,
oAuth2ClientProperties
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.odysseusinc.arachne.commons.api.v1.dto.CommonEntityRequestDTO;
import com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO;
import com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult;
import com.odysseusinc.arachne.commons.conditions.modules.ModuleEnabled;
import com.odysseusinc.arachne.commons.service.messaging.ProducerConsumerTemplate;
import com.odysseusinc.arachne.commons.utils.CommonFilenameUtils;
import com.odysseusinc.arachne.portal.api.v1.dto.AnalysisCreateDTO;
Expand Down Expand Up @@ -63,6 +64,7 @@
import com.odysseusinc.arachne.portal.model.Submission;
import com.odysseusinc.arachne.portal.model.SubmissionInsight;
import com.odysseusinc.arachne.portal.model.search.SubmissionGroupSearch;
import com.odysseusinc.arachne.portal.modules.ModuleHelper;
import com.odysseusinc.arachne.portal.service.BaseDataNodeService;
import com.odysseusinc.arachne.portal.service.DataReferenceService;
import com.odysseusinc.arachne.portal.service.ImportService;
Expand All @@ -75,7 +77,9 @@
import com.odysseusinc.arachne.portal.service.submission.BaseSubmissionService;
import com.odysseusinc.arachne.portal.service.submission.SubmissionInsightService;
import com.odysseusinc.arachne.portal.util.ImportedFile;
import com.odysseusinc.arachne.portal.util.UserUtils;
import io.swagger.annotations.ApiOperation;
import java.util.Optional;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -89,6 +93,7 @@
import org.springframework.jms.support.destination.DestinationResolver;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.core.Authentication;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
Expand Down Expand Up @@ -123,6 +128,7 @@
import static com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR;
import static com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.PERMISSION_DENIED;
import static com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.VALIDATION_ERROR;
import static com.odysseusinc.arachne.commons.utils.CommonFilenameUtils.sanitizeFilename;
import static com.odysseusinc.arachne.portal.util.CommentUtils.getRecentCommentables;
import static com.odysseusinc.arachne.portal.util.HttpUtils.putFileContentToResponse;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
Expand Down Expand Up @@ -300,12 +306,12 @@ public JsonResult<Boolean> delete(
@ApiOperation("List analyses.")
@RequestMapping(value = "/api/v1/analysis-management/analyses", method = GET)
public JsonResult<List<D>> list(
Principal principal,
Authentication principal,
@RequestParam("study-id") Long studyId)
throws PermissionDeniedException, NotExistException {

JsonResult<List<D>> result;
IUser user = userService.getByUsername(principal.getName());
IUser user = userService.getById(UserUtils.getCurrentUser(principal).getId());
if (user == null) {
result = new JsonResult<>(PERMISSION_DENIED);
return result;
Expand Down Expand Up @@ -445,6 +451,7 @@ public JsonResult<Boolean> updateFile(

@ApiOperation("Get submission insight")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/insight", method = GET)
@ModuleEnabled(ModuleHelper.INSIGHT)
public JsonResult<SubmissionInsightDTO> getSubmissionInsight(
@PathVariable("submissionId") Long submissionId,
@RequestParam(value = "size", required = false) Integer size,
Expand All @@ -469,6 +476,7 @@ public JsonResult<SubmissionInsightDTO> getSubmissionInsight(

@ApiOperation("Create submission insight")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/insight", method = POST)
@ModuleEnabled(ModuleHelper.INSIGHT)
public JsonResult<SubmissionInsightDTO> addSubmissionInsight(
@PathVariable("submissionId") Long submissionId,
@RequestBody @Valid SubmissionInsightDTO insightDTO
Expand All @@ -485,6 +493,7 @@ public JsonResult<SubmissionInsightDTO> addSubmissionInsight(

@ApiOperation("Update submission insight")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/insight", method = PUT)
@ModuleEnabled(ModuleHelper.INSIGHT)
public JsonResult<SubmissionInsightDTO> updateSubmissionInsight(
@PathVariable("submissionId") Long submissionId,
@RequestBody SubmissionInsightUpdateDTO insightDTO
Expand Down Expand Up @@ -614,14 +623,7 @@ public void getAllAnalysisFiles(

final Analysis analysis = analysisService.getById(analysisId);

final String archiveName;
if (analysis.getStudy() != null) {
archiveName = String.format("%s_%s_code.zip",
CommonFilenameUtils.sanitizeFilename(analysis.getStudy().getTitle()),
CommonFilenameUtils.sanitizeFilename(analysis.getTitle()));
} else {
archiveName = CommonFilenameUtils.sanitizeFilename(analysis.getTitle()) + "_code.zip";
}
String archiveName = formatStudyName(analysis);

String contentType = "application/zip, application/octet-stream";
response.setContentType(contentType);
Expand All @@ -632,6 +634,16 @@ public void getAllAnalysisFiles(
response.flushBuffer();
}

public static String formatStudyName(Analysis analysis) {
String code = analysis.getType().getCode();
String title = sanitizeFilename(analysis.getTitle()).replaceAll("-", "_");
return Optional.ofNullable(analysis.getStudy()).map(study ->
String.format("%s-%s-%s-code.zip", code, sanitizeFilename(study.getTitle()).replaceAll("-", "_"), title)
).orElseGet(() ->
String.format("%s-%s-code.zip", code, title)
);
}

@ApiOperation("Update code file.")
@PutMapping("/api/v1/analysis-management/analyses/{analysisId}/code-files/{fileUuid}")
public JsonResult<Boolean> putFileContent(
Expand Down
Loading

0 comments on commit 5da00cf

Please sign in to comment.